From: "Nuno Sá" <noname.nuno@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>,
Hardware Monitoring <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH 19/29] hwmon: (adt7x10) Rely on subsystem locking
Date: Fri, 17 Oct 2025 15:08:33 +0100 [thread overview]
Message-ID: <52cb4c0cb382a3ebf67edb9838c6a82c2b7c0f18.camel@gmail.com> (raw)
In-Reply-To: <20251017130221.1823453-20-linux@roeck-us.net>
On Fri, 2025-10-17 at 06:02 -0700, Guenter Roeck wrote:
> Attribute access is now serialized in the hardware monitoring core,
> so locking in the driver code is no longer necessary. Drop it.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> drivers/hwmon/adt7x10.c | 27 +++++----------------------
> 1 file changed, 5 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/hwmon/adt7x10.c b/drivers/hwmon/adt7x10.c
> index 2d329391ed3f..d003ee3ebf06 100644
> --- a/drivers/hwmon/adt7x10.c
> +++ b/drivers/hwmon/adt7x10.c
> @@ -15,7 +15,6 @@
> #include <linux/jiffies.h>
> #include <linux/hwmon.h>
> #include <linux/err.h>
> -#include <linux/mutex.h>
> #include <linux/delay.h>
> #include <linux/interrupt.h>
> #include <linux/regmap.h>
> @@ -55,7 +54,6 @@
> /* Each client has this additional data */
> struct adt7x10_data {
> struct regmap *regmap;
> - struct mutex update_lock;
> u8 config;
> u8 oldconfig;
> bool valid; /* true if temperature valid
> */
> @@ -137,17 +135,13 @@ static int adt7x10_temp_read(struct adt7x10_data *data,
> int index, long *val)
> unsigned int regval;
> int ret;
>
> - mutex_lock(&data->update_lock);
> if (index == adt7x10_temperature && !data->valid) {
> /* wait for valid temperature */
> ret = adt7x10_temp_ready(data->regmap);
> - if (ret) {
> - mutex_unlock(&data->update_lock);
> + if (ret)
> return ret;
> - }
> data->valid = true;
> }
> - mutex_unlock(&data->update_lock);
>
> ret = regmap_read(data->regmap, ADT7X10_REG_TEMP[index], ®val);
> if (ret)
> @@ -159,13 +153,8 @@ static int adt7x10_temp_read(struct adt7x10_data *data,
> int index, long *val)
>
> static int adt7x10_temp_write(struct adt7x10_data *data, int index, long
> temp)
> {
> - int ret;
> -
> - mutex_lock(&data->update_lock);
> - ret = regmap_write(data->regmap, ADT7X10_REG_TEMP[index],
> - ADT7X10_TEMP_TO_REG(temp));
> - mutex_unlock(&data->update_lock);
> - return ret;
> + return regmap_write(data->regmap, ADT7X10_REG_TEMP[index],
> + ADT7X10_TEMP_TO_REG(temp));
> }
>
> static int adt7x10_hyst_read(struct adt7x10_data *data, int index, long *val)
> @@ -197,22 +186,17 @@ static int adt7x10_hyst_write(struct adt7x10_data *data,
> long hyst)
> unsigned int regval;
> int limit, ret;
>
> - mutex_lock(&data->update_lock);
> -
> /* convert absolute hysteresis value to a 4 bit delta value */
> ret = regmap_read(data->regmap, ADT7X10_T_ALARM_HIGH, ®val);
> if (ret < 0)
> - goto abort;
> + return ret;
>
> limit = ADT7X10_REG_TO_TEMP(data, regval);
>
> hyst = clamp_val(hyst, ADT7X10_TEMP_MIN, ADT7X10_TEMP_MAX);
> regval = clamp_val(DIV_ROUND_CLOSEST(limit - hyst, 1000), 0,
> ADT7X10_T_HYST_MASK);
> - ret = regmap_write(data->regmap, ADT7X10_T_HYST, regval);
> -abort:
> - mutex_unlock(&data->update_lock);
> - return ret;
> + return regmap_write(data->regmap, ADT7X10_T_HYST, regval);
> }
>
> static int adt7x10_alarm_read(struct adt7x10_data *data, int index, long
> *val)
> @@ -344,7 +328,6 @@ int adt7x10_probe(struct device *dev, const char *name,
> int irq,
> data->regmap = regmap;
>
> dev_set_drvdata(dev, data);
> - mutex_init(&data->update_lock);
>
> /* configure as specified */
> ret = regmap_read(regmap, ADT7X10_CONFIG, &config);
next prev parent reply other threads:[~2025-10-17 14:08 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 13:01 [PATCH 00/29] hwmon: Rely on subsystem locking [set 2] Guenter Roeck
2025-10-17 13:01 ` [PATCH 01/29] hwmon: (max127) Rely on subsystem locking Guenter Roeck
2025-10-17 13:01 ` [PATCH 02/29] hwmon: (lm95234) " Guenter Roeck
2025-10-17 13:01 ` [PATCH 03/29] hwmon: (lm92) " Guenter Roeck
2025-10-17 13:01 ` [PATCH 04/29] hwmon: (hs3001) " Guenter Roeck
2025-10-17 13:01 ` [PATCH 05/29] hwmon: (sbtsi_temp) " Guenter Roeck
2025-10-17 13:01 ` [PATCH 06/29] hwmon: (ina2xx) " Guenter Roeck
2025-10-17 13:01 ` [PATCH 07/29] hwmon: (sht4x) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 08/29] hwmon: (ina3221) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 09/29] hwmon: (k10temp) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 10/29] hwmon: (mr75203) Drop unnecessary include file Guenter Roeck
2025-10-17 13:02 ` [PATCH 11/29] hwmon: (powr1220) Rely on subsystem locking Guenter Roeck
2025-10-17 13:02 ` [PATCH 12/29] hwmon: (ftsteutates) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 13/29] hwmon: (ina238) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 14/29] hwmon: (lm95241) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 15/29] hwmon: (aht10) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 16/29] hwmon: (adt7411) " Guenter Roeck
2025-10-17 14:10 ` Nuno Sá
2025-10-17 13:02 ` [PATCH 17/29] hwmon: (ltc2947-core) " Guenter Roeck
2025-10-17 14:11 ` Nuno Sá
2025-10-17 13:02 ` [PATCH 18/29] hwmon: (peci) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 19/29] hwmon: (adt7x10) " Guenter Roeck
2025-10-17 14:08 ` Nuno Sá [this message]
2025-10-17 13:02 ` [PATCH 20/29] hwmon: (sfctemp) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 21/29] hwmon: (lochnagar-hwmon) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 22/29] hwmon: (ltc4282) " Guenter Roeck
2025-10-17 14:07 ` Nuno Sá
2025-10-17 13:02 ` [PATCH 23/29] hwmon: (aquacomputer_d5next) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 24/29] hwmon: (gpd-fan) " Guenter Roeck
2025-10-17 13:02 ` [PATCH 25/29] hwmon: (i5500_temp) Drop unnecessary include files Guenter Roeck
2025-10-17 13:02 ` [PATCH 26/29] hwmon: (asus_rog_ryujin) Rely on subsystem locking Guenter Roeck
2025-10-17 13:02 ` [PATCH 27/29] hwmon: (chipcap2) Drop unnecessary include files Guenter Roeck
2025-10-17 13:02 ` [PATCH 28/29] hwmon: (corsair-psu) Rely on subsystem locking Guenter Roeck
2025-10-17 13:02 ` [PATCH 29/29] " 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=52cb4c0cb382a3ebf67edb9838c6a82c2b7c0f18.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
/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