Skip to content

Commit f5b317d

Browse files
dlechjic23
authored andcommitted
iio: adc: cc10001_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 f97661c commit f5b317d

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

drivers/iio/adc/cc10001_adc.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static const struct iio_info cc10001_adc_info = {
262262
static int cc10001_adc_channel_init(struct iio_dev *indio_dev,
263263
unsigned long channel_map)
264264
{
265-
struct iio_chan_spec *chan_array, *timestamp;
265+
struct iio_chan_spec *chan_array;
266266
unsigned int bit, idx = 0;
267267

268268
indio_dev->num_channels = bitmap_weight(&channel_map,
@@ -289,13 +289,7 @@ static int cc10001_adc_channel_init(struct iio_dev *indio_dev,
289289
idx++;
290290
}
291291

292-
timestamp = &chan_array[idx];
293-
timestamp->type = IIO_TIMESTAMP;
294-
timestamp->channel = -1;
295-
timestamp->scan_index = idx;
296-
timestamp->scan_type.sign = 's';
297-
timestamp->scan_type.realbits = 64;
298-
timestamp->scan_type.storagebits = 64;
292+
chan_array[idx] = IIO_CHAN_SOFT_TIMESTAMP(idx);
299293

300294
indio_dev->channels = chan_array;
301295

0 commit comments

Comments
 (0)