aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/i2c/chips/adm9240.c54
-rw-r--r--drivers/i2c/chips/atxp1.c12
-rw-r--r--drivers/i2c/chips/w83627ehf.c29
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) \
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);
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 */
102static ssize_t atxp1_showvcore(struct device *dev, char *buf) 102static 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
114static ssize_t atxp1_storevcore(struct device *dev, const char* buf, size_t count) 114static 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
169static DEVICE_ATTR(cpu0_vid, S_IRUGO | S_IWUSR, atxp1_showvcore, atxp1_storevcore); 169static 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 */
172static ssize_t atxp1_showgpio1(struct device *dev, char *buf) 172static 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
184static ssize_t atxp1_storegpio1(struct device *dev, const char* buf, size_t count) 184static 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
211static DEVICE_ATTR(gpio1, S_IRUGO | S_IWUSR, atxp1_showgpio1, atxp1_storegpio1); 211static 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 */
214static ssize_t atxp1_showgpio2(struct device *dev, char *buf) 214static 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
226static ssize_t atxp1_storegpio2(struct device *dev, const char* buf, size_t count) 226static 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) \
488static ssize_t \ 488static ssize_t \
489show_reg_fan_##offset(struct device *dev, char *buf) \ 489show_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) \
497static ssize_t \ 498static ssize_t \
498show_reg_fan##offset##_min(struct device *dev, char *buf) \ 499show_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} \
502static ssize_t \ 504static ssize_t \
503store_reg_fan##offset##_min(struct device *dev, const char *buf, \ 505store_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) \
513static ssize_t \ 515static ssize_t \
514show_reg_fan##offset##_div(struct device *dev, char *buf) \ 516show_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) \
538static ssize_t \ 541static ssize_t \
539show_##reg(struct device *dev, char *buf) \ 542show_##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) \
549static ssize_t \ 553static ssize_t \
550store_temp1_##reg(struct device *dev, const char *buf, size_t count) \ 554store_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) \
603static ssize_t \ 608static ssize_t \
604show_reg_temp##offset (struct device *dev, char *buf) \ 609show_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) \
612static ssize_t \ 618static ssize_t \
613show_reg_temp##offset##_##reg(struct device *dev, char *buf) \ 619show_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} \
617static ssize_t \ 624static ssize_t \
618store_reg_temp##offset##_##reg(struct device *dev, const char *buf, \ 625store_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} \