From: sashiko-bot@kernel.org
To: "Praneeth Balasubramanian" <praneethb2002@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH] hwmon: (it87) Lock the device while reading the temperature sensor type
Date: Fri, 04 Dec 2026 18:57:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-250475@kernel.org> (raw)
In-Reply-To: <20261204184447.1685572-1-praneethb2002@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] hwmon: (it87) redundant it87_update_device() in show_temp_type()
--
commit 1ff8697a4a76a81f49f4fdc1383612abf09626c6
Author: Praneeth Balasubramanian <praneethb2002@gmail.com>
hwmon: (it87) Lock the device while reading the temperature sensor type
This commit acquires it87_lock() around get_temp_type() in show_temp_type()
so direct chip register reads are serialized with other accesses and run
with SMBus disabled.
> diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
> index fa4fcd5f685f9..210927a50cd8f 100644
> --- a/drivers/hwmon/it87.c
> +++ b/drivers/hwmon/it87.c
> @@ -1411,11 +1411,18 @@ static ssize_t show_temp_type(struct device *dev, struct device_attribute *attr,
> {
> struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
> struct it87_data *data = it87_update_device(dev);
> + int type, err;
>
> if (IS_ERR(data))
> return PTR_ERR(data);
>
> - return sprintf(buf, "%d\n", get_temp_type(data, sensor_attr->index));
> + err = it87_lock(data);
> + if (err)
> + return err;
> + type = get_temp_type(data, sensor_attr->index);
> + it87_unlock(data);
> +
> + return sprintf(buf, "%d\n", type);
> }
[Severity: Low]
Does show_temp_type() still need to call it87_update_device()?
get_temp_type() reads the hardware registers directly and does not use
any cached fields from it87_update_device(). Keeping it takes
data->update_lock twice on every read and, when the cache is stale, does
an unused full-chip refresh and an extra smbus_disable()/smbus_enable().
Using dev_get_drvdata(dev) directly, as set_temp_type() does, avoids the
redundant refresh and lock round-trip.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204184447.1685572-1-praneethb2002@gmail.com?part=1
next prev parent reply other threads:[~2026-12-04 18:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 18:44 [PATCH] hwmon: (it87) Lock the device while reading the temperature sensor type Praneeth Balasubramanian
2026-12-04 18:57 ` sashiko-bot [this message]
2026-12-04 19:02 ` Guenter Roeck
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-250475@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=praneethb2002@gmail.com \
--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.