Skip to content

Commit 98f548b

Browse files
dlechjic23
authored andcommitted
iio: adc: dln2-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 c73b6d7 commit 98f548b

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

drivers/iio/adc/dln2-adc.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -444,16 +444,6 @@ static int dln2_update_scan_mode(struct iio_dev *indio_dev,
444444
lval.scan_type.endianness = IIO_LE; \
445445
}
446446

447-
/* Assignment version of IIO_CHAN_SOFT_TIMESTAMP */
448-
#define IIO_CHAN_SOFT_TIMESTAMP_ASSIGN(lval, _si) { \
449-
lval.type = IIO_TIMESTAMP; \
450-
lval.channel = -1; \
451-
lval.scan_index = _si; \
452-
lval.scan_type.sign = 's'; \
453-
lval.scan_type.realbits = 64; \
454-
lval.scan_type.storagebits = 64; \
455-
}
456-
457447
static const struct iio_info dln2_adc_info = {
458448
.read_raw = dln2_adc_read_raw,
459449
.write_raw = dln2_adc_write_raw,
@@ -614,7 +604,7 @@ static int dln2_adc_probe(struct platform_device *pdev)
614604

615605
for (i = 0; i < chans; ++i)
616606
DLN2_ADC_CHAN(dln2->iio_channels[i], i)
617-
IIO_CHAN_SOFT_TIMESTAMP_ASSIGN(dln2->iio_channels[i], i);
607+
dln2->iio_channels[i] = IIO_CHAN_SOFT_TIMESTAMP(i);
618608

619609
indio_dev->name = DLN2_ADC_MOD_NAME;
620610
indio_dev->info = &dln2_adc_info;

0 commit comments

Comments
 (0)