diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-22 00:01:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-22 00:51:59 -0400 |
commit | 6f637a6494a1872c613fe68f64ea4831c3e5b037 (patch) | |
tree | a18368e908290ca7bdf3430b0b5b9cbc0131da5b /drivers/i2c/chips/adm9240.c | |
parent | 563db2fe9e0843da9d1d85d824f022be0ada4a3c (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.c | 54 |
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) \ |
188 | static ssize_t show_##value(struct device *dev, char *buf) \ | 188 | static 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); | |||
195 | show_temp(temp, 500); /* 0.5'C per bit */ | 197 | show_temp(temp, 500); /* 0.5'C per bit */ |
196 | 198 | ||
197 | #define set_temp(value, reg) \ | 199 | #define set_temp(value, reg) \ |
198 | static ssize_t set_##value(struct device *dev, const char *buf, \ | 200 | static 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) \ |
269 | static ssize_t show_in##offset(struct device *dev, char *buf) \ | 272 | static 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 | } \ |
273 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL); \ | 278 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL); \ |
274 | static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ | 279 | static 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 | } \ |
278 | static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ | 285 | static 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 | } \ |
282 | static ssize_t \ | 291 | static ssize_t \ |
283 | set_in##offset##_min(struct device *dev, const char *buf, size_t count) \ | 292 | set_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 | } \ |
287 | static ssize_t \ | 298 | static ssize_t \ |
288 | set_in##offset##_max(struct device *dev, const char *buf, size_t count) \ | 299 | set_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) \ |
404 | static ssize_t show_fan_##offset (struct device *dev, char *buf) \ | 417 | static ssize_t show_fan_##offset (struct device *dev, \ |
418 | struct device_attribute *attr, \ | ||
419 | char *buf) \ | ||
405 | { \ | 420 | { \ |
406 | return show_fan(dev, buf, offset - 1); \ | 421 | return show_fan(dev, buf, offset - 1); \ |
407 | } \ | 422 | } \ |
408 | static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ | 423 | static ssize_t show_fan_##offset##_div (struct device *dev, \ |
424 | struct device_attribute *attr, \ | ||
425 | char *buf) \ | ||
409 | { \ | 426 | { \ |
410 | return show_fan_div(dev, buf, offset - 1); \ | 427 | return show_fan_div(dev, buf, offset - 1); \ |
411 | } \ | 428 | } \ |
412 | static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ | 429 | static ssize_t show_fan_##offset##_min (struct device *dev, \ |
430 | struct device_attribute *attr, \ | ||
431 | char *buf) \ | ||
413 | { \ | 432 | { \ |
414 | return show_fan_min(dev, buf, offset - 1); \ | 433 | return show_fan_min(dev, buf, offset - 1); \ |
415 | } \ | 434 | } \ |
416 | static ssize_t set_fan_##offset##_min (struct device *dev, \ | 435 | static ssize_t set_fan_##offset##_min (struct device *dev, \ |
417 | const char *buf, size_t count) \ | 436 | struct device_attribute *attr, \ |
437 | const char *buf, size_t count) \ | ||
418 | { \ | 438 | { \ |
419 | return set_fan_min(dev, buf, count, offset - 1); \ | 439 | return set_fan_min(dev, buf, count, offset - 1); \ |
420 | } \ | 440 | } \ |
@@ -429,7 +449,7 @@ show_fan_offset(1); | |||
429 | show_fan_offset(2); | 449 | show_fan_offset(2); |
430 | 450 | ||
431 | /* alarms */ | 451 | /* alarms */ |
432 | static ssize_t show_alarms(struct device *dev, char *buf) | 452 | static 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) | |||
437 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 457 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
438 | 458 | ||
439 | /* vid */ | 459 | /* vid */ |
440 | static ssize_t show_vid(struct device *dev, char *buf) | 460 | static 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) | |||
445 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); | 465 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); |
446 | 466 | ||
447 | /* analog output */ | 467 | /* analog output */ |
448 | static ssize_t show_aout(struct device *dev, char *buf) | 468 | static 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 | ||
454 | static ssize_t set_aout(struct device *dev, const char *buf, size_t count) | 474 | static 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) | |||
466 | static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout); | 486 | static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout); |
467 | 487 | ||
468 | /* chassis_clear */ | 488 | /* chassis_clear */ |
469 | static ssize_t chassis_clear(struct device *dev, const char *buf, size_t count) | 489 | static 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); |