From: David Lechner <dlechner@baylibre.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Cosmin Tanislav" <cosmin.tanislav@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"Andy Shevchenko" <andy.shevchenko@gmail.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 2/6] iio: adc: ad4130: Fix comparison of channel setups
Date: Tue, 18 Feb 2025 13:18:25 -0600 [thread overview]
Message-ID: <09b61024-1738-4956-aff7-9f443323faf7@baylibre.com> (raw)
In-Reply-To: <4d1ba8c9a890393fce38083b01db6ce03df8ac5b.1739902968.git.u.kleine-koenig@baylibre.com>
On 2/18/25 12:31 PM, Uwe Kleine-König wrote:
> Checking the binary representation of two structs (of the same type)
> for equality doesn't have the same semantic as comparing all members for
> equality. The former might find a difference where the latter doesn't in
> the presence of padding or when ambiguous types like float or bool are
> involved. (Floats typically have different representations for single
> values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has
> at least 8 bits and the raw values 1 and 2 (probably) both evaluate to
> true, but memcmp finds a difference.)
>
> When searching for a channel that already has the configuration we need,
> the comparison by member is the one that is needed.
>
> Convert the comparison accordingly to compare the members one after
> another. Also add a BUILD_BUG guard to (somewhat) ensure that when
Now it is static_assert instead of BUILD_BUG.
> struct ad4130_setup_info is expanded, the comparison is adapted, too.
>
> Fixes: 62094060cf3a ("iio: adc: ad4130: add AD4130 driver")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
next prev parent reply other threads:[~2025-02-18 19:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 18:31 [PATCH v2 0/6] iio: adc: ad{4130,7124,7173}: A few fixes and ad7124 calibration Uwe Kleine-König
2025-02-18 18:31 ` [PATCH v2 1/6] iio: adc: ad_sigma_delta: Disable channel after calibration Uwe Kleine-König
2025-02-18 18:31 ` [PATCH v2 2/6] iio: adc: ad4130: Fix comparison of channel setups Uwe Kleine-König
2025-02-18 19:18 ` David Lechner [this message]
2025-02-19 8:53 ` Andy Shevchenko
2025-02-19 15:54 ` Uwe Kleine-König
2025-02-18 18:31 ` [PATCH v2 3/6] iio: adc: ad7124: Fix comparison of channel configs Uwe Kleine-König
2025-02-18 18:31 ` [PATCH v2 4/6] iio: adc: ad7173: " Uwe Kleine-König
2025-02-18 18:31 ` [PATCH v2 5/6] iio: adc: ad7124: Implement internal calibration at probe time Uwe Kleine-König
2025-02-22 14:44 ` Jonathan Cameron
2025-02-18 18:31 ` [PATCH v2 6/6] iio: adc: ad7124: Implement system calibration Uwe Kleine-König
2025-02-18 19:37 ` David Lechner
2025-02-21 18:23 ` Uwe Kleine-König
2025-02-19 10:45 ` Nuno Sá
2025-02-22 14:48 ` [PATCH v2 0/6] iio: adc: ad{4130,7124,7173}: A few fixes and ad7124 calibration Jonathan Cameron
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=09b61024-1738-4956-aff7-9f443323faf7@baylibre.com \
--to=dlechner@baylibre.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy.shevchenko@gmail.com \
--cc=cosmin.tanislav@analog.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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