mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 18:21:24 +02:00
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>
This commit is contained in:
parent
98f548bb91
commit
f97661c4c7
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user