From: sashiko-bot@kernel.org
To: "Daniel Lezcano" <daniel.lezcano@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 1/2] platform: arm64: lenovo-thinkpad-t14s-ec: Add hwmon support for temperatures
Date: Wed, 01 Jul 2026 10:51:07 +0000 [thread overview]
Message-ID: <20260701105108.8595E1F00ADE@smtp.kernel.org> (raw)
In-Reply-To: <20260701103714.22583-2-daniel.lezcano@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] t14s_ec_hwmon_read() bypasses the regmap lock, allowing concurrent I2C commands to the EC without the required 10ms hardware delay.
- [Low] The driver unconditionally uses hwmon functions but its Kconfig entry does not depend on HWMON, leading to linker errors.
--
commit 53ea0adbdbb89073fdf3f9621385cdebffccdb5b
Author: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
platform: arm64: lenovo-thinkpad-t14s-ec: Add hwmon support for temperatures
This commit exposes the Lenovo ThinkPad T14s EC environmental sensors through
the hwmon subsystem. It registers a hwmon device to provide access to six EC
temperature sensors and exports their labels.
> diff --git a/drivers/platform/arm64/lenovo-thinkpad-t14s.c b/drivers/platform/arm64/lenovo-thinkpad-t14s.c
> index 5590302a5694f..c9917a1d2bd7a 100644
> --- a/drivers/platform/arm64/lenovo-thinkpad-t14s.c
> +++ b/drivers/platform/arm64/lenovo-thinkpad-t14s.c
> @@ -11,6 +11,7 @@
> #include <linux/delay.h>
> #include <linux/dev_printk.h>
> #include <linux/err.h>
> +#include <linux/hwmon.h>
[Severity: Low]
The driver now unconditionally uses hwmon functions like
devm_hwmon_device_register_with_info(), but the Kconfig definition for
EC_LENOVO_THINKPAD_T14S doesn't appear to depend on HWMON.
Will this cause linker errors if EC_LENOVO_THINKPAD_T14S is built-in while
HWMON is built as a module or disabled?
[ ... ]
> @@ -555,6 +574,113 @@ static irqreturn_t t14s_ec_irq_handler(int irq, void *data)
> return IRQ_HANDLED;
> }
>
[ ... ]
> +static int t14s_ec_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
> + u32 attr, int channel, long *val)
> +{
> + struct t14s_ec *ec = dev_get_drvdata(dev);
> + unsigned int value;
> + int ret;
> +
> + switch (type) {
> + case hwmon_temp:
> + if (attr == hwmon_temp_input) {
> + ret = t14s_ec_read(ec, ec->ec_hwmon.sys_thermx[channel].reg, &value);
[Severity: High]
Does calling t14s_ec_read() directly here bypass the regmap serialization?
Multiple subsystems (LEDs, keyboard, etc.) use regmap_write/read which serialize
access and respect the 10ms delay between EC I2C commands.
Since t14s_ec_read() drops the I2C bus lock before sleeping for 10ms:
drivers/platform/arm64/lenovo-thinkpad-t14s.c:t14s_ec_read() {
...
out:
i2c_unlock_bus(client->adapter, I2C_LOCK_SEGMENT);
fsleep(10000);
return ret;
}
could a concurrent regmap access acquire the I2C bus lock immediately, issuing
a new command to the EC before the hardware-mandated 10ms delay has elapsed?
> + if (ret)
> + return ret;
> + *val = value * MILLIDEGREE_PER_DEGREE;
> +
> + return 0;
> + }
> + break;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701103714.22583-1-daniel.lezcano@oss.qualcomm.com?part=1
next prev parent reply other threads:[~2026-07-01 10:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 10:37 [PATCH v3 0/2] Lenovo ThinkPad T14s EC thermal monitoring and thermal zone integration Daniel Lezcano
2026-07-01 10:37 ` [PATCH v3 1/2] platform: arm64: lenovo-thinkpad-t14s-ec: Add hwmon support for temperatures Daniel Lezcano
2026-07-01 10:51 ` sashiko-bot [this message]
2026-07-01 10:37 ` [PATCH v3 2/2] arm64: dts: qcom: x1e78100-t14s: Add thermal zones for keyboard skin and charging sensors Daniel Lezcano
2026-07-01 10:47 ` sashiko-bot
2026-07-02 12:17 ` Konrad Dybcio
2026-07-02 13:35 ` Daniel Lezcano
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=20260701105108.8595E1F00ADE@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=daniel.lezcano@oss.qualcomm.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-hwmon@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox