Skip to content

Commit f97661c

Browse files
dlechjic23
authored andcommitted
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>
1 parent 98f548b commit f97661c

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

drivers/iio/adc/at91_adc.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private)
481481
static int at91_adc_channel_init(struct iio_dev *idev)
482482
{
483483
struct at91_adc_state *st = iio_priv(idev);
484-
struct iio_chan_spec *chan_array, *timestamp;
484+
struct iio_chan_spec *chan_array;
485485
int bit, idx = 0;
486486
unsigned long rsvd_mask = 0;
487487

@@ -519,14 +519,8 @@ static int at91_adc_channel_init(struct iio_dev *idev)
519519
chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW);
520520
idx++;
521521
}
522-
timestamp = chan_array + idx;
523-
524-
timestamp->type = IIO_TIMESTAMP;
525-
timestamp->channel = -1;
526-
timestamp->scan_index = idx;
527-
timestamp->scan_type.sign = 's';
528-
timestamp->scan_type.realbits = 64;
529-
timestamp->scan_type.storagebits = 64;
522+
523+
chan_array[idx] = IIO_CHAN_SOFT_TIMESTAMP(idx);
530524

531525
idev->channels = chan_array;
532526
return idev->num_channels;

0 commit comments

Comments
 (0)