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

index 46106200bb862c1dcef73754d46042c41e12a283..5c5170b19b561930cc3874e97ec67c1b89df6382 100644 (file)
@@ -2443,15 +2443,7 @@ static int stm32_adc_chan_fw_init(struct iio_dev *indio_dev, bool timestamping)
        scan_index = ret;
 
        if (timestamping) {
-               struct iio_chan_spec *timestamp = &channels[scan_index];
-
-               timestamp->type = IIO_TIMESTAMP;
-               timestamp->channel = -1;
-               timestamp->scan_index = scan_index;
-               timestamp->scan_type.sign = 's';
-               timestamp->scan_type.realbits = 64;
-               timestamp->scan_type.storagebits = 64;
-
+               channels[scan_index] = IIO_CHAN_SOFT_TIMESTAMP(scan_index);
                scan_index++;
        }