Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 08/29] hwmon: (ina3221) Rely on subsystem locking
Date: Fri, 17 Oct 2025 06:02:00 -0700	[thread overview]
Message-ID: <20251017130221.1823453-9-linux@roeck-us.net> (raw)
In-Reply-To: <20251017130221.1823453-1-linux@roeck-us.net>

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>
---
 drivers/hwmon/ina3221.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
index ce0e3f214f5b..5ecc68dcf169 100644
--- a/drivers/hwmon/ina3221.c
+++ b/drivers/hwmon/ina3221.c
@@ -11,7 +11,6 @@
 #include <linux/hwmon-sysfs.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
-#include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
@@ -115,7 +114,6 @@ struct ina3221_input {
  * @regmap: Register map of the device
  * @fields: Register fields of the device
  * @inputs: Array of channel input source specific structures
- * @lock: mutex lock to serialize sysfs attribute accesses
  * @reg_config: Register value of INA3221_CONFIG
  * @summation_shunt_resistor: equivalent shunt resistor value for summation
  * @summation_channel_control: Value written to SCC field in INA3221_MASK_ENABLE
@@ -126,7 +124,6 @@ struct ina3221_data {
 	struct regmap *regmap;
 	struct regmap_field *fields[F_MAX_FIELDS];
 	struct ina3221_input inputs[INA3221_NUM_CHANNELS];
-	struct mutex lock;
 	u32 reg_config;
 	int summation_shunt_resistor;
 	u32 summation_channel_control;
@@ -530,11 +527,8 @@ static int ina3221_write_enable(struct device *dev, int channel, bool enable)
 static int ina3221_read(struct device *dev, enum hwmon_sensor_types type,
 			u32 attr, int channel, long *val)
 {
-	struct ina3221_data *ina = dev_get_drvdata(dev);
 	int ret;
 
-	mutex_lock(&ina->lock);
-
 	switch (type) {
 	case hwmon_chip:
 		ret = ina3221_read_chip(dev, attr, val);
@@ -550,20 +544,14 @@ static int ina3221_read(struct device *dev, enum hwmon_sensor_types type,
 		ret = -EOPNOTSUPP;
 		break;
 	}
-
-	mutex_unlock(&ina->lock);
-
 	return ret;
 }
 
 static int ina3221_write(struct device *dev, enum hwmon_sensor_types type,
 			 u32 attr, int channel, long val)
 {
-	struct ina3221_data *ina = dev_get_drvdata(dev);
 	int ret;
 
-	mutex_lock(&ina->lock);
-
 	switch (type) {
 	case hwmon_chip:
 		ret = ina3221_write_chip(dev, attr, val);
@@ -579,9 +567,6 @@ static int ina3221_write(struct device *dev, enum hwmon_sensor_types type,
 		ret = -EOPNOTSUPP;
 		break;
 	}
-
-	mutex_unlock(&ina->lock);
-
 	return ret;
 }
 
@@ -886,7 +871,6 @@ static int ina3221_probe(struct i2c_client *client)
 	}
 
 	ina->pm_dev = dev;
-	mutex_init(&ina->lock);
 	dev_set_drvdata(dev, ina);
 
 	/* Enable PM runtime -- status is suspended by default */
@@ -925,7 +909,6 @@ static int ina3221_probe(struct i2c_client *client)
 	/* pm_runtime_put_noidle() will decrease the PM refcount until 0 */
 	for (i = 0; i < INA3221_NUM_CHANNELS; i++)
 		pm_runtime_put_noidle(ina->pm_dev);
-	mutex_destroy(&ina->lock);
 
 	return ret;
 }
@@ -941,8 +924,6 @@ static void ina3221_remove(struct i2c_client *client)
 	/* pm_runtime_put_noidle() will decrease the PM refcount until 0 */
 	for (i = 0; i < INA3221_NUM_CHANNELS; i++)
 		pm_runtime_put_noidle(ina->pm_dev);
-
-	mutex_destroy(&ina->lock);
 }
 
 static int ina3221_suspend(struct device *dev)
-- 
2.45.2


  parent reply	other threads:[~2025-10-17 13:02 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 ` Guenter Roeck [this message]
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á
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=20251017130221.1823453-9-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-hwmon@vger.kernel.org \
    /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