Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (hs3001) 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 <linux@roeck-us.net>

+1 -9
+1 -9
drivers/hwmon/hs3001.c
··· 42 42 43 43 struct hs3001_data { 44 44 struct i2c_client *client; 45 - struct mutex i2c_lock; /* lock for sending i2c commands */ 46 45 u32 wait_time; /* in us */ 47 46 int temperature; /* in milli degree */ 48 47 u32 humidity; /* in milli % */ ··· 111 112 struct i2c_client *client = data->client; 112 113 int ret; 113 114 114 - mutex_lock(&data->i2c_lock); 115 115 ret = i2c_master_send(client, NULL, 0); 116 - if (ret < 0) { 117 - mutex_unlock(&data->i2c_lock); 116 + if (ret < 0) 118 117 return ret; 119 - } 120 118 121 119 /* 122 120 * Sensor needs some time to process measurement depending on ··· 122 126 fsleep(data->wait_time); 123 127 124 128 ret = hs3001_data_fetch_command(client, data); 125 - mutex_unlock(&data->i2c_lock); 126 - 127 129 if (ret < 0) 128 130 return ret; 129 131 ··· 204 210 */ 205 211 data->wait_time = (HS3001_WAKEUP_TIME + HS3001_14BIT_RESOLUTION + 206 212 HS3001_14BIT_RESOLUTION); 207 - 208 - mutex_init(&data->i2c_lock); 209 213 210 214 hwmon_dev = devm_hwmon_device_register_with_info(dev, 211 215 client->name,