aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-12-01 05:25:33 -0500
committerMark M. Hoffman <mhoffman@lightlink.com>2008-02-07 20:39:44 -0500
commit8f74efe81d122c071410fd74f42879ef81439fa4 (patch)
tree3febd18d58fb42d248ea565d23daa468094797e7
parent345a22245451c0fd2c44b2afb5dfb75628b487fa (diff)
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>
-rw-r--r--drivers/hwmon/adm1025.c3
-rw-r--r--drivers/hwmon/asb100.c6
-rw-r--r--drivers/hwmon/lm85.c8
-rw-r--r--drivers/hwmon/lm87.c3
-rw-r--r--drivers/hwmon/smsc47m192.c3
-rw-r--r--drivers/hwmon/w83791d.c6
-rw-r--r--drivers/hwmon/w83793.c8
7 files changed, 11 insertions, 26 deletions
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c
index 33cc58b2fadb..e96c3725203d 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)
334static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, 334static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
335 const char *buf, size_t count) 335 const char *buf, size_t count)
336{ 336{
337 struct i2c_client *client = to_i2c_client(dev); 337 struct adm1025_data *data = dev_get_drvdata(dev);
338 struct adm1025_data *data = i2c_get_clientdata(client);
339 data->vrm = simple_strtoul(buf, NULL, 10); 338 data->vrm = simple_strtoul(buf, NULL, 10);
340 return count; 339 return count;
341} 340}
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c
index 815493b9788d..3f434de1d993 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
519 519
520static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 520static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
521{ 521{
522 struct i2c_client *client = to_i2c_client(dev); 522 struct asb100_data *data = dev_get_drvdata(dev);
523 struct asb100_data *data = i2c_get_clientdata(client); 523 data->vrm = simple_strtoul(buf, NULL, 10);
524 unsigned long val = simple_strtoul(buf, NULL, 10);
525 data->vrm = val;
526 return count; 524 return count;
527} 525}
528 526
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index 43212db7c798..4bb0f291a6b8 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
443 443
444static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 444static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
445{ 445{
446 struct i2c_client *client = to_i2c_client(dev); 446 struct lm85_data *data = dev_get_drvdata(dev);
447 struct lm85_data *data = i2c_get_clientdata(client); 447 data->vrm = simple_strtoul(buf, NULL, 10);
448 u32 val;
449
450 val = simple_strtoul(buf, NULL, 10);
451 data->vrm = val;
452 return count; 448 return count;
453} 449}
454 450
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
index 7bedf7455e9a..8ee07c5c97a1 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
510} 510}
511static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 511static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
512{ 512{
513 struct i2c_client *client = to_i2c_client(dev); 513 struct lm87_data *data = dev_get_drvdata(dev);
514 struct lm87_data *data = i2c_get_clientdata(client);
515 data->vrm = simple_strtoul(buf, NULL, 10); 514 data->vrm = simple_strtoul(buf, NULL, 10);
516 return count; 515 return count;
517} 516}
diff --git a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c
index b87552652588..8b0c188e60f6 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,
341static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, 341static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
342 const char *buf, size_t count) 342 const char *buf, size_t count)
343{ 343{
344 struct i2c_client *client = to_i2c_client(dev); 344 struct smsc47m192_data *data = dev_get_drvdata(dev);
345 struct smsc47m192_data *data = i2c_get_clientdata(client);
346 data->vrm = simple_strtoul(buf, NULL, 10); 345 data->vrm = simple_strtoul(buf, NULL, 10);
347 return count; 346 return count;
348} 347}
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
index a9c01a6f0057..85bd21ee3298 100644
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -840,14 +840,12 @@ static ssize_t store_vrm_reg(struct device *dev,
840 struct device_attribute *attr, 840 struct device_attribute *attr,
841 const char *buf, size_t count) 841 const char *buf, size_t count)
842{ 842{
843 struct i2c_client *client = to_i2c_client(dev); 843 struct w83791d_data *data = dev_get_drvdata(dev);
844 struct w83791d_data *data = i2c_get_clientdata(client);
845 unsigned long val = simple_strtoul(buf, NULL, 10);
846 844
847 /* No lock needed as vrm is internal to the driver 845 /* No lock needed as vrm is internal to the driver
848 (not read from a chip register) and so is not 846 (not read from a chip register) and so is not
849 updated in w83791d_update_device() */ 847 updated in w83791d_update_device() */
850 data->vrm = val; 848 data->vrm = simple_strtoul(buf, NULL, 10);
851 849
852 return count; 850 return count;
853} 851}
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
index 6b5c99c9e806..3ba1d6b33473 100644
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -243,9 +243,7 @@ static struct i2c_driver w83793_driver = {
243static ssize_t 243static ssize_t
244show_vrm(struct device *dev, struct device_attribute *attr, char *buf) 244show_vrm(struct device *dev, struct device_attribute *attr, char *buf)
245{ 245{
246 struct i2c_client *client = to_i2c_client(dev); 246 struct w83793_data *data = dev_get_drvdata(dev);
247 struct w83793_data *data = i2c_get_clientdata(client);
248
249 return sprintf(buf, "%d\n", data->vrm); 247 return sprintf(buf, "%d\n", data->vrm);
250} 248}
251 249
@@ -264,9 +262,7 @@ static ssize_t
264store_vrm(struct device *dev, struct device_attribute *attr, 262store_vrm(struct device *dev, struct device_attribute *attr,
265 const char *buf, size_t count) 263 const char *buf, size_t count)
266{ 264{
267 struct i2c_client *client = to_i2c_client(dev); 265 struct w83793_data *data = dev_get_drvdata(dev);
268 struct w83793_data *data = i2c_get_clientdata(client);
269
270 data->vrm = simple_strtoul(buf, NULL, 10); 266 data->vrm = simple_strtoul(buf, NULL, 10);
271 return count; 267 return count;
272} 268}