summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorDavid Lechner <dlechner@baylibre.com>2026-05-24 20:38:39 -0500
committerJonathan Cameron <jic23@kernel.org>2026-05-31 11:01:49 +0100
commitb3405ec8496272d42dcded5633cb547e586bad6e (patch)
tree45fb508a6046c32fb603cb91550fc39c28d9aadf /drivers/iio
parent404edaf1e885a7f047f3d2090d29bdf4c5cf77a2 (diff)
downloadlinux-next-b3405ec8496272d42dcded5633cb547e586bad6e.tar.gz
linux-next-b3405ec8496272d42dcded5633cb547e586bad6e.zip
iio: common: cros_ec_sensors: simplify timestamp channel definition
Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of manually filling in the struct iio_chan_spec fields. This makes the code less verbose and mistake-prone. Also drop obvious comment while we're at it. Signed-off-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/common/cros_ec_sensors/cros_ec_activity.c8
-rw-r--r--drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c8
2 files changed, 2 insertions, 14 deletions
diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_activity.c b/drivers/iio/common/cros_ec_sensors/cros_ec_activity.c
index 6e38d115b6fe..6762685e6876 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_activity.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_activity.c
@@ -279,13 +279,7 @@ static int cros_ec_sensors_probe(struct platform_device *pdev)
channel++;
}
- /* Timestamp */
- channel->scan_index = index;
- channel->type = IIO_TIMESTAMP;
- channel->channel = -1;
- channel->scan_type.sign = 's';
- channel->scan_type.realbits = 64;
- channel->scan_type.storagebits = 64;
+ *channel = IIO_CHAN_SOFT_TIMESTAMP(index);
indio_dev->channels = st->channels;
indio_dev->num_channels = index + 1;
diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
index f34e2bbba2d1..651632ccfe0d 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
@@ -279,13 +279,7 @@ static int cros_ec_sensors_probe(struct platform_device *pdev)
}
}
- /* Timestamp */
- channel->type = IIO_TIMESTAMP;
- channel->channel = -1;
- channel->scan_index = CROS_EC_SENSOR_MAX_AXIS;
- channel->scan_type.sign = 's';
- channel->scan_type.realbits = 64;
- channel->scan_type.storagebits = 64;
+ *channel = IIO_CHAN_SOFT_TIMESTAMP(CROS_EC_SENSOR_MAX_AXIS);
indio_dev->channels = state->channels;
indio_dev->num_channels = CROS_EC_SENSORS_MAX_CHANNELS;