]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: adc: cc10001_adc: simplify timestamp channel definition
authorDavid Lechner <dlechner@baylibre.com>
Mon, 25 May 2026 01:38:37 +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.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/cc10001_adc.c

index 2c51b90b71018ad45eed9f0e213b758b50d8871b..d42b747325aa8cd70fc40bb4b45c36b10340b420 100644 (file)
@@ -262,7 +262,7 @@ static const struct iio_info cc10001_adc_info = {
 static int cc10001_adc_channel_init(struct iio_dev *indio_dev,
                                    unsigned long channel_map)
 {
-       struct iio_chan_spec *chan_array, *timestamp;
+       struct iio_chan_spec *chan_array;
        unsigned int bit, idx = 0;
 
        indio_dev->num_channels = bitmap_weight(&channel_map,
@@ -289,13 +289,7 @@ static int cc10001_adc_channel_init(struct iio_dev *indio_dev,
                idx++;
        }
 
-       timestamp = &chan_array[idx];
-       timestamp->type = IIO_TIMESTAMP;
-       timestamp->channel = -1;
-       timestamp->scan_index = idx;
-       timestamp->scan_type.sign = 's';
-       timestamp->scan_type.realbits = 64;
-       timestamp->scan_type.storagebits = 64;
+       chan_array[idx] = IIO_CHAN_SOFT_TIMESTAMP(idx);
 
        indio_dev->channels = chan_array;