All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Louis Adamian" <adamianlouis@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/2] iio: pressure: ms5637: Add variant specific temperature compensation
Date: Wed, 10 Jun 2026 02:14:25 +0000	[thread overview]
Message-ID: <20260610021425.8A41A1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260610020458.104818-3-adamianlouis@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Explicit cast to 64-bit in modulo operation causes build failure on 32-bit architectures.
--

commit 5b2cfee8f94f3621de42a9388dafb2dae478fda9
Author: Louis Adamian <adamianlouis@gmail.com>

iio: pressure: ms5637: Add variant specific temperature compensation

This commit adds variant-specific temperature compensation and pressure
scaling for ms5637, ms5803, and ms5837 sensors. It extracts the compensation
constants into a per-device structure to handle differences across the
sensor variants.

> diff --git a/drivers/iio/pressure/ms5637.c b/drivers/iio/pressure/ms5637.c
> index 03945a4fc7188..36bda9694b4c4 100644
> --- a/drivers/iio/pressure/ms5637.c
> +++ b/drivers/iio/pressure/ms5637.c
[ ... ]
> @@ -73,8 +74,10 @@ static int ms5637_read_raw(struct iio_dev *indio_dev,
>  
>  			return IIO_VAL_INT;
>  		case IIO_PRESSURE:	/* in kPa */
> -			*val = pressure / 1000;
> -			*val2 = (pressure % 1000) * 1000;
> +			*val = pressure / dev_data->comp_consts->press_scale;
> +			*val2 = (pressure %
> +				 (s64)dev_data->comp_consts->press_scale) *
> +				(1000000 / dev_data->comp_consts->press_scale);

[Severity: Low]
Does casting this modulo divisor to a 64-bit integer cause a build failure
on 32-bit architectures?

Since pressure is an unsigned int and press_scale is a u32, the s64 cast
promotes the modulo operation to 64-bit. On 32-bit platforms, this typically
results in an undefined reference to __moddi3 because the kernel does not
link libgcc.

Since the modulo result easily fits within a 32-bit integer, can this s64
cast be removed to prevent breaking 32-bit compile targets?

>  
>  			return IIO_VAL_INT_PLUS_MICRO;
>  		default:

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260610020458.104818-1-adamianlouis@gmail.com?part=2

  reply	other threads:[~2026-06-10  2:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10  2:04 [PATCH v2 0/2] iio: pressure: ms5637: Add variant specific Louis Adamian
2026-06-10  2:04 ` [PATCH v2 1/2] dt-bindings: iio: pressure: Add MS5637 Louis Adamian
2026-06-10  2:15   ` sashiko-bot
2026-06-10 16:45   ` Conor Dooley
2026-06-11 14:48     ` Louis Adamian
2026-06-10  2:04 ` [PATCH v2 2/2] iio: pressure: ms5637: Add variant specific temperature compensation Louis Adamian
2026-06-10  2:14   ` sashiko-bot [this message]
2026-06-10 18:37   ` Andy Shevchenko
2026-06-11 16:50     ` Jonathan Cameron
2026-06-11 19:10     ` Louis Adamian
2026-06-11 19:32       ` Andy Shevchenko
2026-08-05 17:06         ` Louis Adamian
2026-08-06 21:27           ` Andy Shevchenko
2026-08-07 18:32             ` Louis Adamian
2026-08-07 18:33               ` Louis Adamian

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=20260610021425.8A41A1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=adamianlouis@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.