Linux kernel staging patches
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Michael Harris <michaelharriscode@gmail.com>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/4] staging: iio: adt7316: refactor temperature calculation logic
Date: Sat, 7 Mar 2026 11:33:50 +0000	[thread overview]
Message-ID: <20260307113350.2d6c6862@jic23-huawei> (raw)
In-Reply-To: <20260305-adt7316-correct-macros-v2-1-3702e3841c42@gmail.com>

On Thu, 05 Mar 2026 23:16:58 -0800
Michael Harris <michaelharriscode@gmail.com> wrote:

> Replace the manual sign manipulation with sign_extend32() and change the
> affected variable from u16 to s32 to properly handle negative values.
> 
> Resolve a logic error where the sign bit was being checked at bit 10
> instead of bit 9 for a 10-bit value.
> 
> Convert the data variable to be in centidegrees celsius (0.25 C per bit)
> so we can use simple division and modulo for sysfs_emit() instead of the
> convoluted bit shifting and masking.
> 
> Signed-off-by: Michael Harris <michaelharriscode@gmail.com>

As Andy noted needs a fixes tag.

> ---
>  drivers/staging/iio/addac/adt7316.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
> index 8a9a8262c2bec34f3c3e79d8174f492b9a23fb70..1412808c50c76a68b5771a25c46dd3308c5cbcdb 100644
> --- a/drivers/staging/iio/addac/adt7316.c
> +++ b/drivers/staging/iio/addac/adt7316.c
> @@ -155,9 +155,12 @@
>   * ADT7316 value masks
>   */
>  #define ADT7316_VALUE_MASK		0xfff
> -#define ADT7316_T_VALUE_SIGN		0x400
>  #define ADT7316_T_VALUE_FLOAT_OFFSET	2
> -#define ADT7316_T_VALUE_FLOAT_MASK	0x2
> +
> +/*
> + * ADT7316 hardware constants
> + */
> +#define ADT7316_TEMP_CENTIDEG_PER_BIT	25

As it's only used in one place, I'd think just use the numeric value down there
and if you feel it needs more background, add a comment there.



  parent reply	other threads:[~2026-03-07 11:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06  7:16 [PATCH v2 0/4] correct macro issues Michael Harris
2026-03-06  7:16 ` [PATCH v2 1/4] staging: iio: adt7316: refactor temperature calculation logic Michael Harris
2026-03-06 14:51   ` Andy Shevchenko
2026-03-07 11:33   ` Jonathan Cameron [this message]
2026-03-06  7:16 ` [PATCH v2 2/4] staging: iio: adt7316: remove shift/offset macros Michael Harris
2026-03-06 14:53   ` Andy Shevchenko
2026-03-10  1:32     ` Michael Harris
2026-03-10 11:29       ` Andy Shevchenko
2026-03-07 11:30   ` Jonathan Cameron
2026-03-06  7:17 ` [PATCH v2 3/4] staging: iio: adt7316: add config names to registers and reorder Michael Harris
2026-03-06 15:04   ` Andy Shevchenko
2026-03-06  7:17 ` [PATCH v2 4/4] staging: iio: adt7316: convert magic numbers to BIT_U32() or GENMASK_U32() Michael Harris
2026-03-06 15:05   ` Andy Shevchenko
2026-03-07 11:33   ` 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=20260307113350.2d6c6862@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=michaelharriscode@gmail.com \
    --cc=nuno.sa@analog.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