From: Jonathan Cameron <jic23@kernel.org>
To: Nikhil Gautam <nikhilgtr@gmail.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Stefan Windfeldt-Prytz" <stefan.windfeldt-prytz@axis.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/4] iio: light: opt4001: Fix incompatible pointer type passed to div_u64_rem()
Date: Mon, 13 Jul 2026 01:43:19 +0100 [thread overview]
Message-ID: <20260713014319.7033a06b@jic23-huawei> (raw)
In-Reply-To: <20260712202451.20822-3-nikhilgtr@gmail.com>
On Mon, 13 Jul 2026 01:54:49 +0530
Nikhil Gautam <nikhilgtr@gmail.com> wrote:
> div_u64_rem() takes a u32 * for the remainder but is passed val2,
> which is an int *. Use a local u32 for the remainder and assign the
> result to *val2.
State what affect (if any) that has.
>
> Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com>
Fix looks good, just add the tag for v2.
> ---
> drivers/iio/light/opt4001.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/light/opt4001.c b/drivers/iio/light/opt4001.c
> index f2cf496cc243..bdb1eadbd450 100644
> --- a/drivers/iio/light/opt4001.c
> +++ b/drivers/iio/light/opt4001.c
> @@ -173,6 +173,7 @@ static int opt4001_read_lux_value(struct iio_dev *indio_dev,
> u8 crc;
> u8 calc_crc;
> u64 lux_raw;
> + u32 rem;
> int ret;
>
> ret = regmap_read(chip->regmap, OPT4001_LIGHT1_MSB, &light1);
> @@ -199,8 +200,8 @@ static int opt4001_read_lux_value(struct iio_dev *indio_dev,
>
> lux_raw = lux_raw << exp;
> lux_raw = lux_raw * chip->chip_info->mul;
> - *val = div_u64_rem(lux_raw, chip->chip_info->div, val2);
> - *val2 = *val2 * 100;
> + *val = div_u64_rem(lux_raw, chip->chip_info->div, &rem);
> + *val2 = rem * 100;
>
> return IIO_VAL_INT_PLUS_NANO;
> }
L
next prev parent reply other threads:[~2026-07-13 0:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-12 20:24 [PATCH 0/4] iio: light: opt4001: Fixes from code review Nikhil Gautam
2026-07-12 20:24 ` [PATCH v1 1/4] iio: light: opt4001: Fix read-modify-write of wrong register in power down Nikhil Gautam
2026-07-13 0:42 ` Jonathan Cameron
2026-07-13 3:33 ` Nikhil Gautam
2026-07-12 20:24 ` [PATCH v1 2/4] iio: light: opt4001: Fix incompatible pointer type passed to div_u64_rem() Nikhil Gautam
2026-07-13 0:43 ` Jonathan Cameron [this message]
2026-07-13 3:31 ` Nikhil Gautam
2026-07-12 20:24 ` [PATCH v1 3/4] iio: light: opt4001: Reject integration times with a non-zero seconds part Nikhil Gautam
2026-07-13 0:44 ` Jonathan Cameron
2026-07-12 20:24 ` [PATCH v1 4/4] iio: light: opt4001: Fix reversed GENMASK() arguments in fault count mask Nikhil Gautam
2026-07-13 0:45 ` Jonathan Cameron
2026-07-13 11:25 ` 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=20260713014319.7033a06b@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nikhilgtr@gmail.com \
--cc=nuno.sa@analog.com \
--cc=stefan.windfeldt-prytz@axis.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
Powered by JetHome