diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-12-01 11:25:33 +0100 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-02-07 20:39:44 -0500 |
commit | 8f74efe81d122c071410fd74f42879ef81439fa4 (patch) | |
tree | 3febd18d58fb42d248ea565d23daa468094797e7 /drivers/hwmon | |
parent | 345a22245451c0fd2c44b2afb5dfb75628b487fa (diff) | |
download | linux-3.10-8f74efe81d122c071410fd74f42879ef81439fa4.tar.gz linux-3.10-8f74efe81d122c071410fd74f42879ef81439fa4.tar.bz2 linux-3.10-8f74efe81d122c071410fd74f42879ef81439fa4.zip |
hwmon: VRM is not written to registers
What was true of reading the VRM value is also true of writing it: not
being a register value, it doesn't need hardware access, so we don't
need a reference to the i2c client. This allows for a minor code
cleanup. As gcc appears to be smart enough to simplify the generated
code by itself, this cleanup only affects the source code, the
generated binaries are unchanged.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/adm1025.c | 3 | ||||
-rw-r--r-- | drivers/hwmon/asb100.c | 6 | ||||
-rw-r--r-- | drivers/hwmon/lm85.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/lm87.c | 3 | ||||
-rw-r--r-- | drivers/hwmon/smsc47m192.c | 3 | ||||
-rw-r--r-- | drivers/hwmon/w83791d.c | 6 | ||||
-rw-r--r-- | drivers/hwmon/w83793.c | 8 |
7 files changed, 11 insertions, 26 deletions
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index 33cc58b2fad..e96c3725203 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c @@ -334,8 +334,7 @@ show_vrm(struct device *dev, struct device_attribute *attr, char *buf) static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct i2c_client *client = to_i2c_client(dev); - struct adm1025_data *data = i2c_get_clientdata(client); + struct adm1025_data *data = dev_get_drvdata(dev); data->vrm = simple_strtoul(buf, NULL, 10); return count; } diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 815493b9788..3f434de1d99 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c @@ -519,10 +519,8 @@ static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct i2c_client *client = to_i2c_client(dev); - struct asb100_data *data = i2c_get_clientdata(client); - unsigned long val = simple_strtoul(buf, NULL, 10); - data->vrm = val; + struct asb100_data *data = dev_get_drvdata(dev); + data->vrm = simple_strtoul(buf, NULL, 10); return count; } diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 43212db7c79..4bb0f291a6b 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -443,12 +443,8 @@ static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, c static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct i2c_client *client = to_i2c_client(dev); - struct lm85_data *data = i2c_get_clientdata(client); - u32 val; - - val = simple_strtoul(buf, NULL, 10); - data->vrm = val; + struct lm85_data *data = dev_get_drvdata(dev); + data->vrm = simple_strtoul(buf, NULL, 10); return count; } diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c index 7bedf7455e9..8ee07c5c97a 100644 --- a/drivers/hwmon/lm87.c +++ b/drivers/hwmon/lm87.c @@ -510,8 +510,7 @@ static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char } static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct i2c_client *client = to_i2c_client(dev); - struct lm87_data *data = i2c_get_clientdata(client); + struct lm87_data *data = dev_get_drvdata(dev); data->vrm = simple_strtoul(buf, NULL, 10); return count; } diff --git a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c index b8755265258..8b0c188e60f 100644 --- a/drivers/hwmon/smsc47m192.c +++ b/drivers/hwmon/smsc47m192.c @@ -341,8 +341,7 @@ static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct i2c_client *client = to_i2c_client(dev); - struct smsc47m192_data *data = i2c_get_clientdata(client); + struct smsc47m192_data *data = dev_get_drvdata(dev); data->vrm = simple_strtoul(buf, NULL, 10); return count; } diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c index a9c01a6f005..85bd21ee329 100644 --- a/drivers/hwmon/w83791d.c +++ b/drivers/hwmon/w83791d.c @@ -840,14 +840,12 @@ static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct i2c_client *client = to_i2c_client(dev); - struct w83791d_data *data = i2c_get_clientdata(client); - unsigned long val = simple_strtoul(buf, NULL, 10); + struct w83791d_data *data = dev_get_drvdata(dev); /* No lock needed as vrm is internal to the driver (not read from a chip register) and so is not updated in w83791d_update_device() */ - data->vrm = val; + data->vrm = simple_strtoul(buf, NULL, 10); return count; } diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index 6b5c99c9e80..3ba1d6b3347 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c @@ -243,9 +243,7 @@ static struct i2c_driver w83793_driver = { static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) { - struct i2c_client *client = to_i2c_client(dev); - struct w83793_data *data = i2c_get_clientdata(client); - + struct w83793_data *data = dev_get_drvdata(dev); return sprintf(buf, "%d\n", data->vrm); } @@ -264,9 +262,7 @@ static ssize_t store_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct i2c_client *client = to_i2c_client(dev); - struct w83793_data *data = i2c_get_clientdata(client); - + struct w83793_data *data = dev_get_drvdata(dev); data->vrm = simple_strtoul(buf, NULL, 10); return count; } |