mirror of https://github.com/torvalds/linux.git
hwmon: (jc42) 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>
This commit is contained in:
parent
6923e2827d
commit
2e2334fa43
|
|
@ -19,7 +19,6 @@
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/hwmon.h>
|
#include <linux/hwmon.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/mutex.h>
|
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
|
|
||||||
/* Addresses to scan */
|
/* Addresses to scan */
|
||||||
|
|
@ -179,7 +178,6 @@ static struct jc42_chips jc42_chips[] = {
|
||||||
|
|
||||||
/* Each client has this additional data */
|
/* Each client has this additional data */
|
||||||
struct jc42_data {
|
struct jc42_data {
|
||||||
struct mutex update_lock; /* protect register access */
|
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
bool extended; /* true if extended range supported */
|
bool extended; /* true if extended range supported */
|
||||||
bool valid;
|
bool valid;
|
||||||
|
|
@ -216,8 +214,6 @@ static int jc42_read(struct device *dev, enum hwmon_sensor_types type,
|
||||||
unsigned int regval;
|
unsigned int regval;
|
||||||
int ret, temp, hyst;
|
int ret, temp, hyst;
|
||||||
|
|
||||||
mutex_lock(&data->update_lock);
|
|
||||||
|
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
case hwmon_temp_input:
|
case hwmon_temp_input:
|
||||||
ret = regmap_read(data->regmap, JC42_REG_TEMP, ®val);
|
ret = regmap_read(data->regmap, JC42_REG_TEMP, ®val);
|
||||||
|
|
@ -295,8 +291,6 @@ static int jc42_read(struct device *dev, enum hwmon_sensor_types type,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&data->update_lock);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -308,8 +302,6 @@ static int jc42_write(struct device *dev, enum hwmon_sensor_types type,
|
||||||
int diff, hyst;
|
int diff, hyst;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mutex_lock(&data->update_lock);
|
|
||||||
|
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
case hwmon_temp_min:
|
case hwmon_temp_min:
|
||||||
ret = regmap_write(data->regmap, JC42_REG_TEMP_LOWER,
|
ret = regmap_write(data->regmap, JC42_REG_TEMP_LOWER,
|
||||||
|
|
@ -356,8 +348,6 @@ static int jc42_write(struct device *dev, enum hwmon_sensor_types type,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&data->update_lock);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -498,7 +488,6 @@ static int jc42_probe(struct i2c_client *client)
|
||||||
return PTR_ERR(data->regmap);
|
return PTR_ERR(data->regmap);
|
||||||
|
|
||||||
i2c_set_clientdata(client, data);
|
i2c_set_clientdata(client, data);
|
||||||
mutex_init(&data->update_lock);
|
|
||||||
|
|
||||||
ret = regmap_read(data->regmap, JC42_REG_CAP, &cap);
|
ret = regmap_read(data->regmap, JC42_REG_CAP, &cap);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue