mirror of https://github.com/torvalds/linux.git
hwmon: (lm95241) 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
3da03e4e0e
commit
a640a80bf0
|
|
@ -15,7 +15,6 @@
|
||||||
#include <linux/jiffies.h>
|
#include <linux/jiffies.h>
|
||||||
#include <linux/hwmon.h>
|
#include <linux/hwmon.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/mutex.h>
|
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
|
||||||
#define DEVNAME "lm95241"
|
#define DEVNAME "lm95241"
|
||||||
|
|
@ -75,7 +74,6 @@ static const u8 lm95241_reg_address[] = {
|
||||||
/* Client data (each client gets its own) */
|
/* Client data (each client gets its own) */
|
||||||
struct lm95241_data {
|
struct lm95241_data {
|
||||||
struct i2c_client *client;
|
struct i2c_client *client;
|
||||||
struct mutex update_lock;
|
|
||||||
unsigned long last_updated; /* in jiffies */
|
unsigned long last_updated; /* in jiffies */
|
||||||
unsigned long interval; /* in milli-seconds */
|
unsigned long interval; /* in milli-seconds */
|
||||||
bool valid; /* false until following fields are valid */
|
bool valid; /* false until following fields are valid */
|
||||||
|
|
@ -102,8 +100,6 @@ static struct lm95241_data *lm95241_update_device(struct device *dev)
|
||||||
struct lm95241_data *data = dev_get_drvdata(dev);
|
struct lm95241_data *data = dev_get_drvdata(dev);
|
||||||
struct i2c_client *client = data->client;
|
struct i2c_client *client = data->client;
|
||||||
|
|
||||||
mutex_lock(&data->update_lock);
|
|
||||||
|
|
||||||
if (time_after(jiffies, data->last_updated
|
if (time_after(jiffies, data->last_updated
|
||||||
+ msecs_to_jiffies(data->interval)) ||
|
+ msecs_to_jiffies(data->interval)) ||
|
||||||
!data->valid) {
|
!data->valid) {
|
||||||
|
|
@ -120,9 +116,6 @@ static struct lm95241_data *lm95241_update_device(struct device *dev)
|
||||||
data->last_updated = jiffies;
|
data->last_updated = jiffies;
|
||||||
data->valid = true;
|
data->valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&data->update_lock);
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,8 +197,6 @@ static int lm95241_write_chip(struct device *dev, u32 attr, int channel,
|
||||||
u8 config;
|
u8 config;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mutex_lock(&data->update_lock);
|
|
||||||
|
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
case hwmon_chip_update_interval:
|
case hwmon_chip_update_interval:
|
||||||
config = data->config & ~CFG_CRMASK;
|
config = data->config & ~CFG_CRMASK;
|
||||||
|
|
@ -231,7 +222,6 @@ static int lm95241_write_chip(struct device *dev, u32 attr, int channel,
|
||||||
ret = -EOPNOTSUPP;
|
ret = -EOPNOTSUPP;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mutex_unlock(&data->update_lock);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,8 +232,6 @@ static int lm95241_write_temp(struct device *dev, u32 attr, int channel,
|
||||||
struct i2c_client *client = data->client;
|
struct i2c_client *client = data->client;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mutex_lock(&data->update_lock);
|
|
||||||
|
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
case hwmon_temp_min:
|
case hwmon_temp_min:
|
||||||
if (channel == 1) {
|
if (channel == 1) {
|
||||||
|
|
@ -313,9 +301,6 @@ static int lm95241_write_temp(struct device *dev, u32 attr, int channel,
|
||||||
ret = -EOPNOTSUPP;
|
ret = -EOPNOTSUPP;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&data->update_lock);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -443,7 +428,6 @@ static int lm95241_probe(struct i2c_client *client)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
data->client = client;
|
data->client = client;
|
||||||
mutex_init(&data->update_lock);
|
|
||||||
|
|
||||||
/* Initialize the LM95241 chip */
|
/* Initialize the LM95241 chip */
|
||||||
lm95241_init_client(client, data);
|
lm95241_init_client(client, data);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue