From: sashiko-bot@kernel.org
To: "Yuehong Wu" <wuyuehong@cmss.chinamobile.com>, linux-rtc@vger.kernel.org
Cc: "Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH v2] rtc: ab-eoz9: fix negative temperature readings
Date: Mon, 09 Nov 2026 03:48:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-204383@kernel.org> (raw)
In-Reply-To: <20261109-rtc-ab-eoz9-neg-temp-v2-1-yuehongwu@cmss.chinamobile.com>
> The temperature register is coded with an offset of ABEOZ953_TEMP_MIN
> (-60 degrees C), so the driver computes "raw + ABEOZ953_TEMP_MIN".
> regmap_read() hands the raw value back in an unsigned int, which makes
> that addition - and the multiplication by 1000 that follows - unsigned as
> well: -60 becomes 0xffffffc4 and 1000 * (raw - 60) wraps around for every
> raw value below 60.
>
> On 64-bit systems the wrapped unsigned int is then zero-extended into the
> long hwmon attribute, so every temperature below 0 degrees C is reported
> as a huge positive value: raw 0 (the -60 degrees C code) becomes
> 4294907296 instead of -60000, raw 30 (-30 degrees C) becomes 4294937296
> instead of -30000. This also contradicts temp1_min, which the same
> driver reports as -60000, and consumers that only look for negative
> values (thermal governors, monitoring daemons) do not discard the bogus
> value.
>
> Perform the arithmetic on a signed value.
>
> Fixes: 67075b63cce2 ("rtc: add AB-RTCMC-32.768kHz-EOZ9 RTC support")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Yuehong Wu <wuyuehong@cmss.chinamobile.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109-rtc-ab-eoz9-neg-temp-v2-1-yuehongwu@cmss.chinamobile.com?part=1
prev parent reply other threads:[~2026-11-09 3:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 3:45 [PATCH] rtc: ab-eoz9: fix negative temperature readings Yuehong Wu
2026-11-09 3:25 ` sashiko-bot
2026-11-09 3:50 ` [PATCH v2] " Yuehong Wu
2026-11-09 3:48 ` sashiko-bot [this message]
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=sashiko-outbox-204383@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-rtc@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wuyuehong@cmss.chinamobile.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 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.