]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: common: cros_ec_sensors: simplify timestamp channel definition
authorDavid Lechner <dlechner@baylibre.com>
Mon, 25 May 2026 01:38:39 +0000 (20:38 -0500)
committerJonathan Cameron <jic23@kernel.org>
Sun, 31 May 2026 10:01:49 +0000 (11:01 +0100)
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>
drivers/iio/common/cros_ec_sensors/cros_ec_activity.c
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c

index 6e38d115b6fe80ef640d310fdd971f47d976323a..6762685e6876cd7abc84bea8e5cc3b3f3d26ca41 100644 (file)
@@ -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;
index f34e2bbba2d1e6f9c82cc13a2bb9270b1e86228c..651632ccfe0d3b49dbdb5aaec6313217dd9af76b 100644 (file)
@@ -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;