Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sebastián Peyrott" <speyrott@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [RFC PATCH 1/1] hwmon: Add Minisforum UM780 XTX EC monitoring and fan control
Date: Fri, 07 Aug 2026 00:47:30 +0000	[thread overview]
Message-ID: <20260807004731.4EEC51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260807003842.249957-2-speyrott@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The driver implements a custom mutex for sysfs attributes and background work instead of using the required hwmon_lock(), and performs redundant locking inside the core read callback.
--

--- Patch [1]: [RFC PATCH 1/1] hwmon: Add Minisforum UM780 XTX EC monitoring and fan control ---
commit 82feeb1647789c448c800c2c55cd4d4766858bc1
Author: Sebastián Peyrott <speyrott@gmail.com>

hwmon: Add Minisforum UM780 XTX EC monitoring and fan control

This patch adds a DMI-gated hwmon driver for the embedded controller used by
the Minisforum UM780 XTX. It exposes CPU and system fan control temperatures
and tachometers via sysfs. It also caches coherent fan settings and restores
them after the firmware reloads defaults following resume.

> diff --git a/drivers/hwmon/minisforum-um780xtx.c b/drivers/hwmon/minisforum-um780xtx.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/hwmon/minisforum-um780xtx.c

[ ... ]

> +struct um780xtx_data {
> +	struct device *dev;
> +	/* Serializes EC transactions and cached state updates. */
> +	struct mutex lock;

[Severity: Medium]
Does this driver need a custom mutex? The hardware monitoring subsystem
guidelines state that drivers should use hwmon_lock() and hwmon_unlock()
to serialize attributes registered by other means and for background
handling. Using a custom lock might fragment synchronization and race with
the hwmon core's serialization.

[ ... ]

> +static ssize_t pwm1_enable_store(struct device *dev,
> +				 struct device_attribute *attr,
> +				 const char *buf, size_t count)
> +{
> +	struct um780xtx_data *data = dev_get_drvdata(dev);
> +	unsigned long mode;
> +	u8 expected;
> +	u8 profile;
> +	int ret;
> +
> +	ret = kstrtoul(buf, 10, &mode);
> +	if (ret)
> +		return ret;
> +	if (mode != 2 && mode != 3)
> +		return -EINVAL;
> +	expected = mode == 2 ? UM780XTX_EC_PROFILE_B1 : UM780XTX_EC_PROFILE_B2;
> +
> +	mutex_lock(&data->lock);

[Severity: Medium]
Should this use hwmon_lock() instead of the private data->lock? Since
this attribute is registered outside the core hwmon info array (via
extra_groups), the subsystem guidelines require using hwmon_lock() here to
properly synchronize with core operations.

[ ... ]

> +static int um780xtx_read(struct device *dev, enum hwmon_sensor_types type,
> +			 u32 attr, int channel, long *value)
> +{
> +	struct um780xtx_data *data = dev_get_drvdata(dev);
> +	u8 raw;
> +	int ret;
> +
> +	if (type == hwmon_temp && attr == hwmon_temp_input && channel < 2) {
> +		mutex_lock(&data->lock);

[Severity: Medium]
Is this lock acquisition redundant? The hardware monitoring core already
serializes operations for attributes registered via the info parameter of
hwmon_device_register_with_info(). Acquiring another lock inside the core
read callback might be unnecessary if hwmon_lock() is used throughout.

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

  reply	other threads:[~2026-08-07  0:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07  0:38 [RFC PATCH 0/1] hwmon: Add Minisforum UM780 XTX EC monitoring and fan control Sebastián Peyrott
2026-08-07  0:38 ` [RFC PATCH 1/1] " Sebastián Peyrott
2026-08-07  0:47   ` sashiko-bot [this message]
2026-08-07  1:59   ` Guenter Roeck
2026-08-08  4:21     ` Sebastián Peyrott

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=20260807004731.4EEC51F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=speyrott@gmail.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