Skip to content

Commit 8a2f9c4

Browse files
andy-shevjic23
authored andcommitted
iio: Convert IIO_CHAN_SOFT_TIMESTAMP() to be compound literal
Currently IIO_CHAN_SOFT_TIMESTAMP() can only be used to fill the static data. In some cases it would be convenient to use it as right value in the assignment operation. But it can't be done as is, because compiler has no clue about the data layout. Converting it to be a compound literal allows the above mentioned usage. While at it, tidy up the indentation. We also have to change existing uses of compound literal at the same time to avoid compiler errors. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent d2b3d46 commit 8a2f9c4

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/iio/adc/ad7606.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ static int ad7606_probe_channels(struct iio_dev *indio_dev)
14751475
}
14761476

14771477
if (slow_bus)
1478-
channels[i] = (struct iio_chan_spec)IIO_CHAN_SOFT_TIMESTAMP(i);
1478+
channels[i] = IIO_CHAN_SOFT_TIMESTAMP(i);
14791479

14801480
indio_dev->channels = channels;
14811481

drivers/iio/adc/max11410.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ static int max11410_parse_channels(struct max11410_state *st,
804804
chan_idx++;
805805
}
806806

807-
channels[chan_idx] = (struct iio_chan_spec)IIO_CHAN_SOFT_TIMESTAMP(chan_idx);
807+
channels[chan_idx] = IIO_CHAN_SOFT_TIMESTAMP(chan_idx);
808808

809809
indio_dev->num_channels = chan_idx + 1;
810810
indio_dev->channels = channels;

include/linux/iio/iio.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,15 @@ static inline bool iio_channel_has_available(const struct iio_chan_spec *chan,
353353
(chan->info_mask_shared_by_all_available & BIT(type));
354354
}
355355

356-
#define IIO_CHAN_SOFT_TIMESTAMP(_si) { \
356+
#define IIO_CHAN_SOFT_TIMESTAMP(_si) (struct iio_chan_spec) { \
357357
.type = IIO_TIMESTAMP, \
358358
.channel = -1, \
359359
.scan_index = _si, \
360360
.scan_type = { \
361361
.sign = 's', \
362-
.realbits = 64, \
362+
.realbits = 64, \
363363
.storagebits = 64, \
364-
}, \
364+
}, \
365365
}
366366

367367
s64 iio_get_time_ns(const struct iio_dev *indio_dev);

0 commit comments

Comments
 (0)