aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/adm9240.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2005-06-22 00:01:59 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-22 00:51:59 -0400
commit6f637a6494a1872c613fe68f64ea4831c3e5b037 (patch)
treea18368e908290ca7bdf3430b0b5b9cbc0131da5b /drivers/i2c/chips/adm9240.c
parent563db2fe9e0843da9d1d85d824f022be0ada4a3c (diff)
[PATCH] I2C: fix up some sysfs device attribute file parameters
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c/chips/adm9240.c')
-rw-r--r--drivers/i2c/chips/adm9240.c54
1 files changed, 37 insertions, 17 deletions
diff --git a/drivers/i2c/chips/adm9240.c b/drivers/i2c/chips/adm9240.c
index 6d609d89e790..5c68e9c311aa 100644
--- a/drivers/i2c/chips/adm9240.c
+++ b/drivers/i2c/chips/adm9240.c
@@ -185,7 +185,9 @@ static int adm9240_write_value(struct i2c_client *client, u8 reg, u8 value)
185 185
186/* temperature */ 186/* temperature */
187#define show_temp(value, scale) \ 187#define show_temp(value, scale) \
188static ssize_t show_##value(struct device *dev, char *buf) \ 188static ssize_t show_##value(struct device *dev, \
189 struct device_attribute *attr, \
190 char *buf) \
189{ \ 191{ \
190 struct adm9240_data *data = adm9240_update_device(dev); \ 192 struct adm9240_data *data = adm9240_update_device(dev); \
191 return sprintf(buf, "%d\n", data->value * scale); \ 193 return sprintf(buf, "%d\n", data->value * scale); \
@@ -195,8 +197,9 @@ show_temp(temp_hyst, 1000);
195show_temp(temp, 500); /* 0.5'C per bit */ 197show_temp(temp, 500); /* 0.5'C per bit */
196 198
197#define set_temp(value, reg) \ 199#define set_temp(value, reg) \
198static ssize_t set_##value(struct device *dev, const char *buf, \ 200static ssize_t set_##value(struct device *dev, \
199 size_t count) \ 201 struct device_attribute *attr, \
202 const char *buf, size_t count) \
200{ \ 203{ \
201 struct i2c_client *client = to_i2c_client(dev); \ 204 struct i2c_client *client = to_i2c_client(dev); \
202 struct adm9240_data *data = adm9240_update_device(dev); \ 205 struct adm9240_data *data = adm9240_update_device(dev); \
@@ -266,26 +269,36 @@ static ssize_t set_in_max(struct device *dev, const char *buf,
266} 269}
267 270
268#define show_in_offset(offset) \ 271#define show_in_offset(offset) \
269static ssize_t show_in##offset(struct device *dev, char *buf) \ 272static ssize_t show_in##offset(struct device *dev, \
273 struct device_attribute *attr, \
274 char *buf) \
270{ \ 275{ \
271 return show_in(dev, buf, offset); \ 276 return show_in(dev, buf, offset); \
272} \ 277} \
273static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL); \ 278static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL); \
274static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ 279static ssize_t show_in##offset##_min(struct device *dev, \
280 struct device_attribute *attr, \
281 char *buf) \
275{ \ 282{ \
276 return show_in_min(dev, buf, offset); \ 283 return show_in_min(dev, buf, offset); \
277} \ 284} \
278static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ 285static ssize_t show_in##offset##_max(struct device *dev, \
286 struct device_attribute *attr, \
287 char *buf) \
279{ \ 288{ \
280 return show_in_max(dev, buf, offset); \ 289 return show_in_max(dev, buf, offset); \
281} \ 290} \
282static ssize_t \ 291static ssize_t \
283set_in##offset##_min(struct device *dev, const char *buf, size_t count) \ 292set_in##offset##_min(struct device *dev, \
293 struct device_attribute *attr, const char *buf, \
294 size_t count) \
284{ \ 295{ \
285 return set_in_min(dev, buf, count, offset); \ 296 return set_in_min(dev, buf, count, offset); \
286} \ 297} \
287static ssize_t \ 298static ssize_t \
288set_in##offset##_max(struct device *dev, const char *buf, size_t count) \ 299set_in##offset##_max(struct device *dev, \
300 struct device_attribute *attr, const char *buf, \
301 size_t count) \
289{ \ 302{ \
290 return set_in_max(dev, buf, count, offset); \ 303 return set_in_max(dev, buf, count, offset); \
291} \ 304} \
@@ -401,20 +414,27 @@ static ssize_t set_fan_min(struct device *dev, const char *buf,
401} 414}
402 415
403#define show_fan_offset(offset) \ 416#define show_fan_offset(offset) \
404static ssize_t show_fan_##offset (struct device *dev, char *buf) \ 417static ssize_t show_fan_##offset (struct device *dev, \
418 struct device_attribute *attr, \
419 char *buf) \
405{ \ 420{ \
406return show_fan(dev, buf, offset - 1); \ 421return show_fan(dev, buf, offset - 1); \
407} \ 422} \
408static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ 423static ssize_t show_fan_##offset##_div (struct device *dev, \
424 struct device_attribute *attr, \
425 char *buf) \
409{ \ 426{ \
410return show_fan_div(dev, buf, offset - 1); \ 427return show_fan_div(dev, buf, offset - 1); \
411} \ 428} \
412static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ 429static ssize_t show_fan_##offset##_min (struct device *dev, \
430 struct device_attribute *attr, \
431 char *buf) \
413{ \ 432{ \
414return show_fan_min(dev, buf, offset - 1); \ 433return show_fan_min(dev, buf, offset - 1); \
415} \ 434} \
416static ssize_t set_fan_##offset##_min (struct device *dev, \ 435static ssize_t set_fan_##offset##_min (struct device *dev, \
417const char *buf, size_t count) \ 436 struct device_attribute *attr, \
437 const char *buf, size_t count) \
418{ \ 438{ \
419return set_fan_min(dev, buf, count, offset - 1); \ 439return set_fan_min(dev, buf, count, offset - 1); \
420} \ 440} \
@@ -429,7 +449,7 @@ show_fan_offset(1);
429show_fan_offset(2); 449show_fan_offset(2);
430 450
431/* alarms */ 451/* alarms */
432static ssize_t show_alarms(struct device *dev, char *buf) 452static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf)
433{ 453{
434 struct adm9240_data *data = adm9240_update_device(dev); 454 struct adm9240_data *data = adm9240_update_device(dev);
435 return sprintf(buf, "%u\n", data->alarms); 455 return sprintf(buf, "%u\n", data->alarms);
@@ -437,7 +457,7 @@ static ssize_t show_alarms(struct device *dev, char *buf)
437static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 457static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
438 458
439/* vid */ 459/* vid */
440static ssize_t show_vid(struct device *dev, char *buf) 460static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
441{ 461{
442 struct adm9240_data *data = adm9240_update_device(dev); 462 struct adm9240_data *data = adm9240_update_device(dev);
443 return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); 463 return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm));
@@ -445,13 +465,13 @@ static ssize_t show_vid(struct device *dev, char *buf)
445static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); 465static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
446 466
447/* analog output */ 467/* analog output */
448static ssize_t show_aout(struct device *dev, char *buf) 468static ssize_t show_aout(struct device *dev, struct device_attribute *attr, char *buf)
449{ 469{
450 struct adm9240_data *data = adm9240_update_device(dev); 470 struct adm9240_data *data = adm9240_update_device(dev);
451 return sprintf(buf, "%d\n", AOUT_FROM_REG(data->aout)); 471 return sprintf(buf, "%d\n", AOUT_FROM_REG(data->aout));
452} 472}
453 473
454static ssize_t set_aout(struct device *dev, const char *buf, size_t count) 474static ssize_t set_aout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
455{ 475{
456 struct i2c_client *client = to_i2c_client(dev); 476 struct i2c_client *client = to_i2c_client(dev);
457 struct adm9240_data *data = i2c_get_clientdata(client); 477 struct adm9240_data *data = i2c_get_clientdata(client);
@@ -466,7 +486,7 @@ static ssize_t set_aout(struct device *dev, const char *buf, size_t count)
466static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout); 486static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout);
467 487
468/* chassis_clear */ 488/* chassis_clear */
469static ssize_t chassis_clear(struct device *dev, const char *buf, size_t count) 489static ssize_t chassis_clear(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
470{ 490{
471 struct i2c_client *client = to_i2c_client(dev); 491 struct i2c_client *client = to_i2c_client(dev);
472 unsigned long val = simple_strtol(buf, NULL, 10); 492 unsigned long val = simple_strtol(buf, NULL, 10);