Skip to content

Commit e102bf1

Browse files
committed
drivers: sensor: lsm9ds1: use consistent variable name data
In both lsm9ds1 and lsm9ds1_mag drivers, the device data structure is generally referenced with the variable name data. However, in the initialization functions, the variable was named lsm9ds1 (or lsm9ds1_mag for the magnetometer), which breaks this convention. Rename these variables to data for consistency across the driver. Signed-off-by: Miguel Gazquez <[email protected]>
1 parent 9543a86 commit e102bf1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/sensor/st/lsm9ds1/lsm9ds1.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ static int lsm9ds1_init(const struct device *dev)
612612
{
613613
const struct lsm9ds1_config *cfg = dev->config;
614614
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
615-
struct lsm9ds1_data *lsm9ds1 = dev->data;
615+
struct lsm9ds1_data *data = dev->data;
616616
uint8_t chip_id, fs;
617617
int ret;
618618

@@ -649,7 +649,7 @@ static int lsm9ds1_init(const struct device *dev)
649649
return ret;
650650
}
651651

652-
lsm9ds1->acc_gain = lsm9ds1_accel_fs_val_to_gain(fs);
652+
data->acc_gain = lsm9ds1_accel_fs_val_to_gain(fs);
653653

654654
fs = cfg->gyro_range;
655655
LOG_DBG("gyro range is %d", fs);
@@ -658,7 +658,7 @@ static int lsm9ds1_init(const struct device *dev)
658658
LOG_ERR("failed to set gyroscope range %d\n", fs);
659659
return ret;
660660
}
661-
lsm9ds1->gyro_gain = (lsm9ds1_gyro_fs_sens[fs] * GAIN_UNIT_G);
661+
data->gyro_gain = (lsm9ds1_gyro_fs_sens[fs] * GAIN_UNIT_G);
662662

663663
return 0;
664664
}

drivers/sensor/st/lsm9ds1_mag/lsm9ds1_mag.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ static int lsm9ds1_mag_init(const struct device *dev)
337337
{
338338
const struct lsm9ds1_mag_config *cfg = dev->config;
339339
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
340-
struct lsm9ds1_mag_data *lsm9ds1_mag = dev->data;
340+
struct lsm9ds1_mag_data *data = dev->data;
341341
uint8_t chip_id, fs;
342342
int ret;
343343

@@ -366,7 +366,7 @@ static int lsm9ds1_mag_init(const struct device *dev)
366366
}
367367

368368
if (cfg->mag_odr == LSM9DS1_MAG_POWER_DOWN) {
369-
lsm9ds1_mag->powered_down = 1;
369+
data->powered_down = 1;
370370
}
371371

372372
fs = cfg->mag_range;
@@ -376,7 +376,7 @@ static int lsm9ds1_mag_init(const struct device *dev)
376376
return ret;
377377
}
378378

379-
lsm9ds1_mag->mag_gain = lsm9ds1_mag_fs_sens[fs];
379+
data->mag_gain = lsm9ds1_mag_fs_sens[fs];
380380

381381
return 0;
382382
}

0 commit comments

Comments
 (0)