Linux IIO development
 help / color / mirror / Atom feed
* [PATCH v0 1/1] iio: Convert IIO_CHAN_SOFT_TIMESTAMP() to be compound literal
@ 2026-05-18  7:13 Andy Shevchenko
  2026-05-18  7:17 ` Andy Shevchenko
  2026-05-18 17:32 ` kernel test robot
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2026-05-18  7:13 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, linux-iio, linux-kernel
  Cc: Nuno Sá, Andy Shevchenko, Andy Shevchenko

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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---

v0: to be incorporated into David's series

 include/linux/iio/iio.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 96b05c86c325..711c00f67371 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -353,15 +353,15 @@ static inline bool iio_channel_has_available(const struct iio_chan_spec *chan,
 		(chan->info_mask_shared_by_all_available & BIT(type));
 }
 
-#define IIO_CHAN_SOFT_TIMESTAMP(_si) {					\
+#define IIO_CHAN_SOFT_TIMESTAMP(_si) (struct iio_chan_spec) {		\
 	.type = IIO_TIMESTAMP,						\
 	.channel = -1,							\
 	.scan_index = _si,						\
 	.scan_type = {							\
 		.sign = 's',						\
-		.realbits = 64,					\
+		.realbits = 64,						\
 		.storagebits = 64,					\
-		},							\
+	},								\
 }
 
 s64 iio_get_time_ns(const struct iio_dev *indio_dev);
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-05-19 12:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-18  7:13 [PATCH v0 1/1] iio: Convert IIO_CHAN_SOFT_TIMESTAMP() to be compound literal Andy Shevchenko
2026-05-18  7:17 ` Andy Shevchenko
2026-05-18 17:32 ` kernel test robot
2026-05-18 18:17   ` Andy Shevchenko
2026-05-19  7:59     ` David Laight
2026-05-19 12:30       ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox