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 | |
parent | 563db2fe9e0843da9d1d85d824f022be0ada4a3c (diff) |
[PATCH] I2C: fix up some sysfs device attribute file parameters
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/i2c/chips/adm9240.c | 54 | ||||
-rw-r--r-- | drivers/i2c/chips/atxp1.c | 12 | ||||
-rw-r--r-- | drivers/i2c/chips/w83627ehf.c | 29 |
3 files changed, 61 insertions, 34 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); |
diff --git a/drivers/i2c/chips/atxp1.c b/drivers/i2c/chips/atxp1.c index 57b0bdde38b2..5c6597aa2c7f 100644 --- a/drivers/i2c/chips/atxp1.c +++ b/drivers/i2c/chips/atxp1.c | |||
@@ -99,7 +99,7 @@ static struct atxp1_data * atxp1_update_device(struct device *dev) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | /* sys file functions for cpu0_vid */ | 101 | /* sys file functions for cpu0_vid */ |
102 | static ssize_t atxp1_showvcore(struct device *dev, char *buf) | 102 | static ssize_t atxp1_showvcore(struct device *dev, struct device_attribute *attr, char *buf) |
103 | { | 103 | { |
104 | int size; | 104 | int size; |
105 | struct atxp1_data *data; | 105 | struct atxp1_data *data; |
@@ -111,7 +111,7 @@ static ssize_t atxp1_showvcore(struct device *dev, char *buf) | |||
111 | return size; | 111 | return size; |
112 | } | 112 | } |
113 | 113 | ||
114 | static ssize_t atxp1_storevcore(struct device *dev, const char* buf, size_t count) | 114 | static ssize_t atxp1_storevcore(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
115 | { | 115 | { |
116 | struct atxp1_data *data; | 116 | struct atxp1_data *data; |
117 | struct i2c_client *client; | 117 | struct i2c_client *client; |
@@ -169,7 +169,7 @@ static ssize_t atxp1_storevcore(struct device *dev, const char* buf, size_t coun | |||
169 | static DEVICE_ATTR(cpu0_vid, S_IRUGO | S_IWUSR, atxp1_showvcore, atxp1_storevcore); | 169 | static DEVICE_ATTR(cpu0_vid, S_IRUGO | S_IWUSR, atxp1_showvcore, atxp1_storevcore); |
170 | 170 | ||
171 | /* sys file functions for GPIO1 */ | 171 | /* sys file functions for GPIO1 */ |
172 | static ssize_t atxp1_showgpio1(struct device *dev, char *buf) | 172 | static ssize_t atxp1_showgpio1(struct device *dev, struct device_attribute *attr, char *buf) |
173 | { | 173 | { |
174 | int size; | 174 | int size; |
175 | struct atxp1_data *data; | 175 | struct atxp1_data *data; |
@@ -181,7 +181,7 @@ static ssize_t atxp1_showgpio1(struct device *dev, char *buf) | |||
181 | return size; | 181 | return size; |
182 | } | 182 | } |
183 | 183 | ||
184 | static ssize_t atxp1_storegpio1(struct device *dev, const char* buf, size_t count) | 184 | static ssize_t atxp1_storegpio1(struct device *dev, struct device_attribute *attr, const char*buf, size_t count) |
185 | { | 185 | { |
186 | struct atxp1_data *data; | 186 | struct atxp1_data *data; |
187 | struct i2c_client *client; | 187 | struct i2c_client *client; |
@@ -211,7 +211,7 @@ static ssize_t atxp1_storegpio1(struct device *dev, const char* buf, size_t coun | |||
211 | static DEVICE_ATTR(gpio1, S_IRUGO | S_IWUSR, atxp1_showgpio1, atxp1_storegpio1); | 211 | static DEVICE_ATTR(gpio1, S_IRUGO | S_IWUSR, atxp1_showgpio1, atxp1_storegpio1); |
212 | 212 | ||
213 | /* sys file functions for GPIO2 */ | 213 | /* sys file functions for GPIO2 */ |
214 | static ssize_t atxp1_showgpio2(struct device *dev, char *buf) | 214 | static ssize_t atxp1_showgpio2(struct device *dev, struct device_attribute *attr, char *buf) |
215 | { | 215 | { |
216 | int size; | 216 | int size; |
217 | struct atxp1_data *data; | 217 | struct atxp1_data *data; |
@@ -223,7 +223,7 @@ static ssize_t atxp1_showgpio2(struct device *dev, char *buf) | |||
223 | return size; | 223 | return size; |
224 | } | 224 | } |
225 | 225 | ||
226 | static ssize_t atxp1_storegpio2(struct device *dev, const char* buf, size_t count) | 226 | static ssize_t atxp1_storegpio2(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
227 | { | 227 | { |
228 | struct atxp1_data *data; | 228 | struct atxp1_data *data; |
229 | struct i2c_client *client; | 229 | struct i2c_client *client; |
diff --git a/drivers/i2c/chips/w83627ehf.c b/drivers/i2c/chips/w83627ehf.c index 4fcc823e89b5..8a40b6976e1a 100644 --- a/drivers/i2c/chips/w83627ehf.c +++ b/drivers/i2c/chips/w83627ehf.c | |||
@@ -486,7 +486,8 @@ store_fan_min(struct device *dev, const char *buf, size_t count, int nr) | |||
486 | 486 | ||
487 | #define sysfs_fan_offset(offset) \ | 487 | #define sysfs_fan_offset(offset) \ |
488 | static ssize_t \ | 488 | static ssize_t \ |
489 | show_reg_fan_##offset(struct device *dev, char *buf) \ | 489 | show_reg_fan_##offset(struct device *dev, struct device_attribute *attr, \ |
490 | char *buf) \ | ||
490 | { \ | 491 | { \ |
491 | return show_fan(dev, buf, offset-1); \ | 492 | return show_fan(dev, buf, offset-1); \ |
492 | } \ | 493 | } \ |
@@ -495,13 +496,14 @@ static DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ | |||
495 | 496 | ||
496 | #define sysfs_fan_min_offset(offset) \ | 497 | #define sysfs_fan_min_offset(offset) \ |
497 | static ssize_t \ | 498 | static ssize_t \ |
498 | show_reg_fan##offset##_min(struct device *dev, char *buf) \ | 499 | show_reg_fan##offset##_min(struct device *dev, struct device_attribute *attr, \ |
500 | char *buf) \ | ||
499 | { \ | 501 | { \ |
500 | return show_fan_min(dev, buf, offset-1); \ | 502 | return show_fan_min(dev, buf, offset-1); \ |
501 | } \ | 503 | } \ |
502 | static ssize_t \ | 504 | static ssize_t \ |
503 | store_reg_fan##offset##_min(struct device *dev, const char *buf, \ | 505 | store_reg_fan##offset##_min(struct device *dev, struct device_attribute *attr, \ |
504 | size_t count) \ | 506 | const char *buf, size_t count) \ |
505 | { \ | 507 | { \ |
506 | return store_fan_min(dev, buf, count, offset-1); \ | 508 | return store_fan_min(dev, buf, count, offset-1); \ |
507 | } \ | 509 | } \ |
@@ -511,7 +513,8 @@ static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | |||
511 | 513 | ||
512 | #define sysfs_fan_div_offset(offset) \ | 514 | #define sysfs_fan_div_offset(offset) \ |
513 | static ssize_t \ | 515 | static ssize_t \ |
514 | show_reg_fan##offset##_div(struct device *dev, char *buf) \ | 516 | show_reg_fan##offset##_div(struct device *dev, struct device_attribute *attr, \ |
517 | char *buf) \ | ||
515 | { \ | 518 | { \ |
516 | return show_fan_div(dev, buf, offset - 1); \ | 519 | return show_fan_div(dev, buf, offset - 1); \ |
517 | } \ | 520 | } \ |
@@ -536,7 +539,8 @@ sysfs_fan_div_offset(5); | |||
536 | 539 | ||
537 | #define show_temp1_reg(reg) \ | 540 | #define show_temp1_reg(reg) \ |
538 | static ssize_t \ | 541 | static ssize_t \ |
539 | show_##reg(struct device *dev, char *buf) \ | 542 | show_##reg(struct device *dev, struct device_attribute *attr, \ |
543 | char *buf) \ | ||
540 | { \ | 544 | { \ |
541 | struct w83627ehf_data *data = w83627ehf_update_device(dev); \ | 545 | struct w83627ehf_data *data = w83627ehf_update_device(dev); \ |
542 | return sprintf(buf, "%d\n", temp1_from_reg(data->reg)); \ | 546 | return sprintf(buf, "%d\n", temp1_from_reg(data->reg)); \ |
@@ -547,7 +551,8 @@ show_temp1_reg(temp1_max_hyst); | |||
547 | 551 | ||
548 | #define store_temp1_reg(REG, reg) \ | 552 | #define store_temp1_reg(REG, reg) \ |
549 | static ssize_t \ | 553 | static ssize_t \ |
550 | store_temp1_##reg(struct device *dev, const char *buf, size_t count) \ | 554 | store_temp1_##reg(struct device *dev, struct device_attribute *attr, \ |
555 | const char *buf, size_t count) \ | ||
551 | { \ | 556 | { \ |
552 | struct i2c_client *client = to_i2c_client(dev); \ | 557 | struct i2c_client *client = to_i2c_client(dev); \ |
553 | struct w83627ehf_data *data = i2c_get_clientdata(client); \ | 558 | struct w83627ehf_data *data = i2c_get_clientdata(client); \ |
@@ -601,7 +606,8 @@ store_temp_reg(HYST, temp_max_hyst); | |||
601 | 606 | ||
602 | #define sysfs_temp_offset(offset) \ | 607 | #define sysfs_temp_offset(offset) \ |
603 | static ssize_t \ | 608 | static ssize_t \ |
604 | show_reg_temp##offset (struct device *dev, char *buf) \ | 609 | show_reg_temp##offset (struct device *dev, struct device_attribute *attr, \ |
610 | char *buf) \ | ||
605 | { \ | 611 | { \ |
606 | return show_temp(dev, buf, offset - 2); \ | 612 | return show_temp(dev, buf, offset - 2); \ |
607 | } \ | 613 | } \ |
@@ -610,13 +616,14 @@ static DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ | |||
610 | 616 | ||
611 | #define sysfs_temp_reg_offset(reg, offset) \ | 617 | #define sysfs_temp_reg_offset(reg, offset) \ |
612 | static ssize_t \ | 618 | static ssize_t \ |
613 | show_reg_temp##offset##_##reg(struct device *dev, char *buf) \ | 619 | show_reg_temp##offset##_##reg(struct device *dev, struct device_attribute *attr, \ |
620 | char *buf) \ | ||
614 | { \ | 621 | { \ |
615 | return show_temp_##reg(dev, buf, offset - 2); \ | 622 | return show_temp_##reg(dev, buf, offset - 2); \ |
616 | } \ | 623 | } \ |
617 | static ssize_t \ | 624 | static ssize_t \ |
618 | store_reg_temp##offset##_##reg(struct device *dev, const char *buf, \ | 625 | store_reg_temp##offset##_##reg(struct device *dev, struct device_attribute *attr, \ |
619 | size_t count) \ | 626 | const char *buf, size_t count) \ |
620 | { \ | 627 | { \ |
621 | return store_temp_##reg(dev, buf, count, offset - 2); \ | 628 | return store_temp_##reg(dev, buf, count, offset - 2); \ |
622 | } \ | 629 | } \ |