summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorDavid Lechner <dlechner@baylibre.com>2026-05-24 20:38:36 -0500
committerJonathan Cameron <jic23@kernel.org>2026-05-31 11:01:49 +0100
commitf97661c4c713fa2bdf2649c76b181772e27cf325 (patch)
tree16fffd985239980c32ca1a8f3b2ccc3174e1fd72 /drivers/iio
parent98f548bb911908dd2a60073c006ccebf9ce7c60a (diff)
iio: adc: at91_adc: 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. 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/adc/at91_adc.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 6e1930f7c65d..f610ad729bf3 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -481,7 +481,7 @@ static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private)
static int at91_adc_channel_init(struct iio_dev *idev)
{
struct at91_adc_state *st = iio_priv(idev);
- struct iio_chan_spec *chan_array, *timestamp;
+ struct iio_chan_spec *chan_array;
int bit, idx = 0;
unsigned long rsvd_mask = 0;
@@ -519,14 +519,8 @@ static int at91_adc_channel_init(struct iio_dev *idev)
chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW);
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);
idev->channels = chan_array;
return idev->num_channels;