From: Guenter Roeck Date: Tue, 9 Sep 2025 13:13:13 +0000 (-0700) Subject: hwmon: (corsair-psu) Rely on subsystem locking X-Git-Tag: v6.19-rc1~148^2~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4207069edbf01ae859946fe7f51e3fa03a3bb2f8;p=thirdparty%2Fkernel%2Flinux.git hwmon: (corsair-psu) Rely on subsystem locking 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 --- diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c index 6b5c8f2007803..dddbd2463f8da 100644 --- a/drivers/hwmon/corsair-psu.c +++ b/drivers/hwmon/corsair-psu.c @@ -9,11 +9,9 @@ #include #include #include -#include #include #include #include -#include #include #include @@ -124,7 +122,6 @@ struct corsairpsu_data { struct device *hwmon_dev; struct dentry *debugfs; struct completion wait_completion; - struct mutex lock; /* for locking access to cmd_buffer */ u8 *cmd_buffer; char vendor[REPLY_SIZE]; char product[REPLY_SIZE]; @@ -220,7 +217,6 @@ static int corsairpsu_request(struct corsairpsu_data *priv, u8 cmd, u8 rail, voi { int ret; - mutex_lock(&priv->lock); switch (cmd) { case PSU_CMD_RAIL_VOLTS_HCRIT: case PSU_CMD_RAIL_VOLTS_LCRIT: @@ -230,17 +226,13 @@ static int corsairpsu_request(struct corsairpsu_data *priv, u8 cmd, u8 rail, voi case PSU_CMD_RAIL_WATTS: ret = corsairpsu_usb_cmd(priv, 2, PSU_CMD_SELECT_RAIL, rail, NULL); if (ret < 0) - goto cmd_fail; + return ret; break; default: break; } - ret = corsairpsu_usb_cmd(priv, 3, cmd, 0, data); - -cmd_fail: - mutex_unlock(&priv->lock); - return ret; + return corsairpsu_usb_cmd(priv, 3, cmd, 0, data); } static int corsairpsu_get_value(struct corsairpsu_data *priv, u8 cmd, u8 rail, long *val) @@ -797,7 +789,6 @@ static int corsairpsu_probe(struct hid_device *hdev, const struct hid_device_id priv->hdev = hdev; hid_set_drvdata(hdev, priv); - mutex_init(&priv->lock); init_completion(&priv->wait_completion); hid_device_io_start(hdev);