From: David Lechner <dlechner@baylibre•com>
To: "Jyoti Bhayana" <jbhayana@google•com>,
"Jonathan Cameron" <jic23@kernel•org>,
"Nuno Sá" <nuno.sa@analog•com>,
"Andy Shevchenko" <andy@kernel•org>,
"Nicolas Ferre" <nicolas.ferre@microchip•com>,
"Alexandre Belloni" <alexandre.belloni@bootlin•com>,
"Claudiu Beznea" <claudiu.beznea@tuxon•dev>,
"Maxime Coquelin" <mcoquelin.stm32@gmail•com>,
"Alexandre Torgue" <alexandre.torgue@foss•st.com>,
"Benson Leung" <bleung@chromium•org>,
"Guenter Roeck" <groeck@chromium•org>
Cc: linux-iio@vger•kernel.org, linux-kernel@vger•kernel.org,
linux-arm-kernel@lists•infradead.org,
linux-stm32@st-md-mailman•stormreply.com,
chrome-platform@lists•linux.dev
Subject: Re: [PATCH 0/8] iio: timestamp declaration cleanup
Date: Sun, 17 May 2026 14:22:03 -0500 [thread overview]
Message-ID: <83c11e2c-9688-4cc9-b7ee-6380de30fb58@baylibre.com> (raw)
In-Reply-To: <20260517-iio-timestamp-cleanup-v1-0-61fb908c11c7@baylibre.com>
On 5/17/26 1:17 PM, David Lechner wrote:
> While looking around the code, I noticed that there are a lot of places
> were we are manually filling all of the fields of an IIO timestamp.
>
> This is error-prone (as seen in the first patch) and more verbose than
> it needs to be.
>
> I went with the approach of using the existing IIO_CHAN_SOFT_TIMESTAMP()
> macro for doing a struct assignment. This does require a cast, which
> makes it a bit more verbose, but we were already doing that in to
> drivers, so I went with it anyway.
>
> If we want to consider alternatives, we could make a iio helper function
> or macro like the first and second patches did.
>
I should have looked harder for existing alternatives. Just found one
more that avoids the cast via a local variable (in ad4170-4.c):
/* Add timestamp channel */
struct iio_chan_spec ts_chan = IIO_CHAN_SOFT_TIMESTAMP(chan_num);
st->chans[chan_num] = ts_chan;
And similar code is found in ad7192.c.
next prev parent reply other threads:[~2026-05-17 19:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 18:17 [PATCH 0/8] iio: timestamp declaration cleanup David Lechner
2026-05-17 18:17 ` [PATCH 1/8] iio: common: scmi_sensors: simplify timestamp channel definition David Lechner
2026-05-17 18:17 ` [PATCH 2/8] iio: adc: dln2-adc: " David Lechner
2026-05-17 18:17 ` [PATCH 3/8] iio: adc: at91_adc: " David Lechner
2026-05-17 18:17 ` [PATCH 4/8] iio: adc: cc10001_adc: " David Lechner
2026-05-17 18:17 ` [PATCH 5/8] iio: adc: stm32-adc: " David Lechner
2026-05-17 18:17 ` [PATCH 6/8] iio: common: cros_ec_sensors: " David Lechner
2026-05-17 18:17 ` [PATCH 7/8] iio: light: cros_ec_light_prox: " David Lechner
2026-05-17 18:17 ` [PATCH 8/8] iio: pressure: cros_ec_baro: " David Lechner
2026-05-17 19:22 ` David Lechner [this message]
2026-05-18 7:23 ` [PATCH 0/8] iio: timestamp declaration cleanup Andy Shevchenko
2026-05-18 7:09 ` Andy Shevchenko
2026-05-18 7:14 ` Andy Shevchenko
2026-05-18 14:34 ` David Lechner
2026-05-18 15:44 ` Jonathan Cameron
2026-05-18 7:26 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83c11e2c-9688-4cc9-b7ee-6380de30fb58@baylibre.com \
--to=dlechner@baylibre$(echo .)com \
--cc=alexandre.belloni@bootlin$(echo .)com \
--cc=alexandre.torgue@foss$(echo .)st.com \
--cc=andy@kernel$(echo .)org \
--cc=bleung@chromium$(echo .)org \
--cc=chrome-platform@lists$(echo .)linux.dev \
--cc=claudiu.beznea@tuxon$(echo .)dev \
--cc=groeck@chromium$(echo .)org \
--cc=jbhayana@google$(echo .)com \
--cc=jic23@kernel$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-iio@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-stm32@st-md-mailman$(echo .)stormreply.com \
--cc=mcoquelin.stm32@gmail$(echo .)com \
--cc=nicolas.ferre@microchip$(echo .)com \
--cc=nuno.sa@analog$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox