From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: raffaele.tranfaglia@gmail.com
Cc: "Nuno Sá" <nuno.sa@analog.com>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
linux@analog.com, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] iio: light: adux1020: fix interrupt clear value on SMBus-only adapters
Date: Tue, 10 Nov 2026 01:49:37 +0200 [thread overview]
Message-ID: <avJcESOPo2nGq5wy@ashevche-desk.local> (raw)
In-Reply-To: <20261109-adux1020-measure-fixes-v1-1-fe1ba63f28bc@gmail.com>
On Mon, Nov 09, 2026 at 11:39:02AM +0000, Raffaele Tranfaglia via B4 Relay wrote:
>
> adux1020_measure() clears the mode interrupt by writing the inverted
> interrupt enable mask to INT_STATUS. The mask is a u16, but integer
> promotion makes ~0x00f0 evaluate to 0xffffff0f, which does not fit in
> the 16-bit register.
Huh?! Where did you get it from? the mentioned promotion may only happen for
a signed char which may not hold 0x00f0 in the first place. The above is some
nonsense.
> On adapters supporting plain I2C, regmap formats the value with
> put_unaligned_be16() and silently truncates it to 0xff0f. On adapters
> that only support SMBus word transfers, regmap_smbus_word_write_swapped()
> rejects values above 0xffff with -EINVAL, so every proximity read fails.
>
> Mask the value to 16 bits so that SMBus-only adapters send the same
> 0xff0f that has always been written on plain I2C adapters.
...
> ret = regmap_write(data->regmap, ADUX1020_REG_INT_STATUS,
> - (~adux1020_modes[mode].int_en));
> + ~adux1020_modes[mode].int_en & 0xffff);
On top of that regmap should limit the value to 16-bit anyway. If there is a
problem in regmap to cut the upper bits, it should be addressed rather there.
> if (ret < 0)
> return ret;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-11-09 23:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 11:39 [PATCH 0/2] iio: light: adux1020: fix proximity measurement issues Raffaele Tranfaglia via B4 Relay
2026-11-09 11:39 ` [PATCH 1/2] iio: light: adux1020: fix interrupt clear value on SMBus-only adapters Raffaele Tranfaglia via B4 Relay
2026-11-09 23:49 ` Andy Shevchenko [this message]
2026-11-09 11:39 ` [PATCH 2/2] iio: light: adux1020: extract the FIFO byte count with FIELD_GET() Raffaele Tranfaglia via B4 Relay
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=avJcESOPo2nGq5wy@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@analog.com \
--cc=mani@kernel.org \
--cc=nuno.sa@analog.com \
--cc=raffaele.tranfaglia@gmail.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
all inboxes | Powered by JetHome®