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

hwmon: (sbtsi_temp) 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>

+2 -15
+2 -15
drivers/hwmon/sbtsi_temp.c
··· 12 12 #include <linux/init.h> 13 13 #include <linux/hwmon.h> 14 14 #include <linux/module.h> 15 - #include <linux/mutex.h> 16 15 #include <linux/of.h> 17 16 #include <linux/bitfield.h> 18 17 ··· 51 52 /* Each client has this additional data */ 52 53 struct sbtsi_data { 53 54 struct i2c_client *client; 54 - struct mutex lock; 55 55 bool ext_range_mode; 56 56 bool read_order; 57 57 }; ··· 92 94 93 95 switch (attr) { 94 96 case hwmon_temp_input: 95 - mutex_lock(&data->lock); 96 97 if (data->read_order) { 97 98 temp_dec = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_DEC); 98 99 temp_int = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_INT); ··· 99 102 temp_int = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_INT); 100 103 temp_dec = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_DEC); 101 104 } 102 - mutex_unlock(&data->lock); 103 105 break; 104 106 case hwmon_temp_max: 105 - mutex_lock(&data->lock); 106 107 temp_int = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_HIGH_INT); 107 108 temp_dec = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_HIGH_DEC); 108 - mutex_unlock(&data->lock); 109 109 break; 110 110 case hwmon_temp_min: 111 - mutex_lock(&data->lock); 112 111 temp_int = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_LOW_INT); 113 112 temp_dec = i2c_smbus_read_byte_data(data->client, SBTSI_REG_TEMP_LOW_DEC); 114 - mutex_unlock(&data->lock); 115 113 break; 116 114 default: 117 115 return -EINVAL; ··· 150 158 val = clamp_val(val, SBTSI_TEMP_MIN, SBTSI_TEMP_MAX); 151 159 sbtsi_mc_to_reg(val, &temp_int, &temp_dec); 152 160 153 - mutex_lock(&data->lock); 154 161 err = i2c_smbus_write_byte_data(data->client, reg_int, temp_int); 155 162 if (err) 156 - goto exit; 163 + return err; 157 164 158 - err = i2c_smbus_write_byte_data(data->client, reg_dec, temp_dec); 159 - exit: 160 - mutex_unlock(&data->lock); 161 - return err; 165 + return i2c_smbus_write_byte_data(data->client, reg_dec, temp_dec); 162 166 } 163 167 164 168 static umode_t sbtsi_is_visible(const void *data, ··· 207 219 return -ENOMEM; 208 220 209 221 data->client = client; 210 - mutex_init(&data->lock); 211 222 212 223 err = i2c_smbus_read_byte_data(data->client, SBTSI_REG_CONFIG); 213 224 if (err < 0)