hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
....@@ -275,8 +275,13 @@
275275 {
276276 struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev);
277277 struct device *dev = regmap_get_device(st->map);
278
+ struct inv_icm42600_timestamp *ts = iio_priv(indio_dev);
278279
279280 pm_runtime_get_sync(dev);
281
+
282
+ mutex_lock(&st->lock);
283
+ inv_icm42600_timestamp_reset(ts);
284
+ mutex_unlock(&st->lock);
280285
281286 return 0;
282287 }
....@@ -375,7 +380,6 @@
375380 struct device *dev = regmap_get_device(st->map);
376381 unsigned int sensor;
377382 unsigned int *watermark;
378
- struct inv_icm42600_timestamp *ts;
379383 struct inv_icm42600_sensor_conf conf = INV_ICM42600_SENSOR_CONF_INIT;
380384 unsigned int sleep_temp = 0;
381385 unsigned int sleep_sensor = 0;
....@@ -385,11 +389,9 @@
385389 if (indio_dev == st->indio_gyro) {
386390 sensor = INV_ICM42600_SENSOR_GYRO;
387391 watermark = &st->fifo.watermark.gyro;
388
- ts = iio_priv(st->indio_gyro);
389392 } else if (indio_dev == st->indio_accel) {
390393 sensor = INV_ICM42600_SENSOR_ACCEL;
391394 watermark = &st->fifo.watermark.accel;
392
- ts = iio_priv(st->indio_accel);
393395 } else {
394396 return -EINVAL;
395397 }
....@@ -416,8 +418,6 @@
416418 /* if FIFO is off, turn temperature off */
417419 if (!st->fifo.on)
418420 ret = inv_icm42600_set_temp_conf(st, false, &sleep_temp);
419
-
420
- inv_icm42600_timestamp_reset(ts);
421421
422422 out_unlock:
423423 mutex_unlock(&st->lock);