static int sm_load_drivers(struct invsens_sm_cfg *smcfg) { int res = 0; u16 drv_cnt = 0; INV_DBG_FUNC_NAME; smcfg->driver_count = 0; smcfg->dmp_drv = NULL; #ifdef CONFIG_INV_SENSORS_MPU5400 res = invsens_load_mpu5400(&smcfg->driver_list[drv_cnt++], smcfg->board_cfg); if (res) INVSENS_LOGD("mpu5400 driver failed : %d\n", res); #endif res = invsens_load_aux(&smcfg->driver_list[drv_cnt++], smcfg->board_cfg); if (res) INVSENS_LOGD("aux driver failed : %d\n", res); #ifdef CONFIG_INV_SENSORS_DMP res = invsens_load_dmp(&smcfg->driver_list[drv_cnt++], smcfg->board_cfg); if (res) INVSENS_LOGD("dmp driver failed : %d\n", res); smcfg->dmp_drv =smcfg->driver_list[drv_cnt - 1]; #endif smcfg->driver_count = drv_cnt; return res; }
static int sm_load_drivers(struct invsens_sm_cfg *smcfg) { int res = 0; u16 drv_cnt = 0; INV_DBG_FUNC_NAME; if (!smcfg) return -SM_EINVAL; smcfg->driver_count = 0; smcfg->dmp_drv = NULL; #if defined(CONFIG_INV_SENSORS_MPU65XX) res = invsens_load_mpu65xx(&smcfg->driver_list[drv_cnt++], smcfg->board_cfg); if (res) { INVSENS_LOGD("mpu65xx driver failed : %d\n", res); return res; } #endif res = invsens_load_aux(&smcfg->driver_list[drv_cnt++], smcfg->board_cfg); if (res) { INVSENS_LOGD("aux driver failed : %d\n", res); return res; } #if defined(CONFIG_INV_SENSORS_DMP) res = invsens_load_dmp(&smcfg->driver_list[drv_cnt++], smcfg->board_cfg); if (res) { INVSENS_LOGD("dmp driver failed : %d\n", res); return res; } smcfg->dmp_drv = smcfg->driver_list[drv_cnt - 1]; #endif smcfg->driver_count = drv_cnt; return res; }