diff options
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/atxp1.c | 25 | ||||
-rw-r--r-- | drivers/hwmon/ds1621.c | 28 | ||||
-rw-r--r-- | drivers/hwmon/max1619.c | 33 | ||||
-rw-r--r-- | drivers/hwmon/sis5595.c | 101 | ||||
-rw-r--r-- | drivers/hwmon/via686a.c | 83 |
5 files changed, 185 insertions, 85 deletions
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index ba843f8c4cef..0ccdd0750c44 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/hwmon-vid.h> | 27 | #include <linux/hwmon-vid.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
30 | #include <linux/sysfs.h> | ||
30 | 31 | ||
31 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
32 | MODULE_DESCRIPTION("System voltages control via Attansic ATXP1"); | 33 | MODULE_DESCRIPTION("System voltages control via Attansic ATXP1"); |
@@ -250,6 +251,17 @@ static ssize_t atxp1_storegpio2(struct device *dev, struct device_attribute *att | |||
250 | */ | 251 | */ |
251 | static DEVICE_ATTR(gpio2, S_IRUGO | S_IWUSR, atxp1_showgpio2, atxp1_storegpio2); | 252 | static DEVICE_ATTR(gpio2, S_IRUGO | S_IWUSR, atxp1_showgpio2, atxp1_storegpio2); |
252 | 253 | ||
254 | static struct attribute *atxp1_attributes[] = { | ||
255 | &dev_attr_gpio1.attr, | ||
256 | &dev_attr_gpio2.attr, | ||
257 | &dev_attr_cpu0_vid.attr, | ||
258 | NULL | ||
259 | }; | ||
260 | |||
261 | static const struct attribute_group atxp1_group = { | ||
262 | .attrs = atxp1_attributes, | ||
263 | }; | ||
264 | |||
253 | 265 | ||
254 | static int atxp1_attach_adapter(struct i2c_adapter *adapter) | 266 | static int atxp1_attach_adapter(struct i2c_adapter *adapter) |
255 | { | 267 | { |
@@ -319,21 +331,23 @@ static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind) | |||
319 | goto exit_free; | 331 | goto exit_free; |
320 | } | 332 | } |
321 | 333 | ||
334 | /* Register sysfs hooks */ | ||
335 | if ((err = sysfs_create_group(&new_client->dev.kobj, &atxp1_group))) | ||
336 | goto exit_detach; | ||
337 | |||
322 | data->class_dev = hwmon_device_register(&new_client->dev); | 338 | data->class_dev = hwmon_device_register(&new_client->dev); |
323 | if (IS_ERR(data->class_dev)) { | 339 | if (IS_ERR(data->class_dev)) { |
324 | err = PTR_ERR(data->class_dev); | 340 | err = PTR_ERR(data->class_dev); |
325 | goto exit_detach; | 341 | goto exit_remove_files; |
326 | } | 342 | } |
327 | 343 | ||
328 | device_create_file(&new_client->dev, &dev_attr_gpio1); | ||
329 | device_create_file(&new_client->dev, &dev_attr_gpio2); | ||
330 | device_create_file(&new_client->dev, &dev_attr_cpu0_vid); | ||
331 | |||
332 | dev_info(&new_client->dev, "Using VRM: %d.%d\n", | 344 | dev_info(&new_client->dev, "Using VRM: %d.%d\n", |
333 | data->vrm / 10, data->vrm % 10); | 345 | data->vrm / 10, data->vrm % 10); |
334 | 346 | ||
335 | return 0; | 347 | return 0; |
336 | 348 | ||
349 | exit_remove_files: | ||
350 | sysfs_remove_group(&new_client->dev.kobj, &atxp1_group); | ||
337 | exit_detach: | 351 | exit_detach: |
338 | i2c_detach_client(new_client); | 352 | i2c_detach_client(new_client); |
339 | exit_free: | 353 | exit_free: |
@@ -348,6 +362,7 @@ static int atxp1_detach_client(struct i2c_client * client) | |||
348 | int err; | 362 | int err; |
349 | 363 | ||
350 | hwmon_device_unregister(data->class_dev); | 364 | hwmon_device_unregister(data->class_dev); |
365 | sysfs_remove_group(&client->dev.kobj, &atxp1_group); | ||
351 | 366 | ||
352 | err = i2c_detach_client(client); | 367 | err = i2c_detach_client(client); |
353 | 368 | ||
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 478eb4bb8570..c849c0c6ee9c 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/hwmon.h> | 29 | #include <linux/hwmon.h> |
30 | #include <linux/err.h> | 30 | #include <linux/err.h> |
31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
32 | #include <linux/sysfs.h> | ||
32 | #include "lm75.h" | 33 | #include "lm75.h" |
33 | 34 | ||
34 | /* Addresses to scan */ | 35 | /* Addresses to scan */ |
@@ -178,6 +179,18 @@ static DEVICE_ATTR(temp1_input, S_IRUGO , show_temp, NULL); | |||
178 | static DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO , show_temp_min, set_temp_min); | 179 | static DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO , show_temp_min, set_temp_min); |
179 | static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, set_temp_max); | 180 | static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, set_temp_max); |
180 | 181 | ||
182 | static struct attribute *ds1621_attributes[] = { | ||
183 | &dev_attr_temp1_input.attr, | ||
184 | &dev_attr_temp1_min.attr, | ||
185 | &dev_attr_temp1_max.attr, | ||
186 | &dev_attr_alarms.attr, | ||
187 | NULL | ||
188 | }; | ||
189 | |||
190 | static const struct attribute_group ds1621_group = { | ||
191 | .attrs = ds1621_attributes, | ||
192 | }; | ||
193 | |||
181 | 194 | ||
182 | static int ds1621_attach_adapter(struct i2c_adapter *adapter) | 195 | static int ds1621_attach_adapter(struct i2c_adapter *adapter) |
183 | { | 196 | { |
@@ -253,21 +266,19 @@ static int ds1621_detect(struct i2c_adapter *adapter, int address, | |||
253 | ds1621_init_client(new_client); | 266 | ds1621_init_client(new_client); |
254 | 267 | ||
255 | /* Register sysfs hooks */ | 268 | /* Register sysfs hooks */ |
269 | if ((err = sysfs_create_group(&new_client->dev.kobj, &ds1621_group))) | ||
270 | goto exit_detach; | ||
271 | |||
256 | data->class_dev = hwmon_device_register(&new_client->dev); | 272 | data->class_dev = hwmon_device_register(&new_client->dev); |
257 | if (IS_ERR(data->class_dev)) { | 273 | if (IS_ERR(data->class_dev)) { |
258 | err = PTR_ERR(data->class_dev); | 274 | err = PTR_ERR(data->class_dev); |
259 | goto exit_detach; | 275 | goto exit_remove_files; |
260 | } | 276 | } |
261 | 277 | ||
262 | device_create_file(&new_client->dev, &dev_attr_alarms); | ||
263 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | ||
264 | device_create_file(&new_client->dev, &dev_attr_temp1_min); | ||
265 | device_create_file(&new_client->dev, &dev_attr_temp1_max); | ||
266 | |||
267 | return 0; | 278 | return 0; |
268 | 279 | ||
269 | /* OK, this is not exactly good programming practice, usually. But it is | 280 | exit_remove_files: |
270 | very code-efficient in this case. */ | 281 | sysfs_remove_group(&new_client->dev.kobj, &ds1621_group); |
271 | exit_detach: | 282 | exit_detach: |
272 | i2c_detach_client(new_client); | 283 | i2c_detach_client(new_client); |
273 | exit_free: | 284 | exit_free: |
@@ -282,6 +293,7 @@ static int ds1621_detach_client(struct i2c_client *client) | |||
282 | int err; | 293 | int err; |
283 | 294 | ||
284 | hwmon_device_unregister(data->class_dev); | 295 | hwmon_device_unregister(data->class_dev); |
296 | sysfs_remove_group(&client->dev.kobj, &ds1621_group); | ||
285 | 297 | ||
286 | if ((err = i2c_detach_client(client))) | 298 | if ((err = i2c_detach_client(client))) |
287 | return err; | 299 | return err; |
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index b4135b5971f4..2f58f651f03a 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/hwmon.h> | 34 | #include <linux/hwmon.h> |
35 | #include <linux/err.h> | 35 | #include <linux/err.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/sysfs.h> | ||
37 | 38 | ||
38 | static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, | 39 | static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, |
39 | 0x29, 0x2a, 0x2b, | 40 | 0x29, 0x2a, 0x2b, |
@@ -172,6 +173,22 @@ static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2, | |||
172 | set_temp_hyst2); | 173 | set_temp_hyst2); |
173 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 174 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
174 | 175 | ||
176 | static struct attribute *max1619_attributes[] = { | ||
177 | &dev_attr_temp1_input.attr, | ||
178 | &dev_attr_temp2_input.attr, | ||
179 | &dev_attr_temp2_min.attr, | ||
180 | &dev_attr_temp2_max.attr, | ||
181 | &dev_attr_temp2_crit.attr, | ||
182 | &dev_attr_temp2_crit_hyst.attr, | ||
183 | |||
184 | &dev_attr_alarms.attr, | ||
185 | NULL | ||
186 | }; | ||
187 | |||
188 | static const struct attribute_group max1619_group = { | ||
189 | .attrs = max1619_attributes, | ||
190 | }; | ||
191 | |||
175 | /* | 192 | /* |
176 | * Real code | 193 | * Real code |
177 | */ | 194 | */ |
@@ -273,22 +290,19 @@ static int max1619_detect(struct i2c_adapter *adapter, int address, int kind) | |||
273 | max1619_init_client(new_client); | 290 | max1619_init_client(new_client); |
274 | 291 | ||
275 | /* Register sysfs hooks */ | 292 | /* Register sysfs hooks */ |
293 | if ((err = sysfs_create_group(&new_client->dev.kobj, &max1619_group))) | ||
294 | goto exit_detach; | ||
295 | |||
276 | data->class_dev = hwmon_device_register(&new_client->dev); | 296 | data->class_dev = hwmon_device_register(&new_client->dev); |
277 | if (IS_ERR(data->class_dev)) { | 297 | if (IS_ERR(data->class_dev)) { |
278 | err = PTR_ERR(data->class_dev); | 298 | err = PTR_ERR(data->class_dev); |
279 | goto exit_detach; | 299 | goto exit_remove_files; |
280 | } | 300 | } |
281 | 301 | ||
282 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | ||
283 | device_create_file(&new_client->dev, &dev_attr_temp2_input); | ||
284 | device_create_file(&new_client->dev, &dev_attr_temp2_min); | ||
285 | device_create_file(&new_client->dev, &dev_attr_temp2_max); | ||
286 | device_create_file(&new_client->dev, &dev_attr_temp2_crit); | ||
287 | device_create_file(&new_client->dev, &dev_attr_temp2_crit_hyst); | ||
288 | device_create_file(&new_client->dev, &dev_attr_alarms); | ||
289 | |||
290 | return 0; | 302 | return 0; |
291 | 303 | ||
304 | exit_remove_files: | ||
305 | sysfs_remove_group(&new_client->dev.kobj, &max1619_group); | ||
292 | exit_detach: | 306 | exit_detach: |
293 | i2c_detach_client(new_client); | 307 | i2c_detach_client(new_client); |
294 | exit_free: | 308 | exit_free: |
@@ -318,6 +332,7 @@ static int max1619_detach_client(struct i2c_client *client) | |||
318 | int err; | 332 | int err; |
319 | 333 | ||
320 | hwmon_device_unregister(data->class_dev); | 334 | hwmon_device_unregister(data->class_dev); |
335 | sysfs_remove_group(&client->dev.kobj, &max1619_group); | ||
321 | 336 | ||
322 | if ((err = i2c_detach_client(client))) | 337 | if ((err = i2c_detach_client(client))) |
323 | return err; | 338 | return err; |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 3783af4195bd..95a4b5d9eaf2 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/init.h> | 61 | #include <linux/init.h> |
62 | #include <linux/jiffies.h> | 62 | #include <linux/jiffies.h> |
63 | #include <linux/mutex.h> | 63 | #include <linux/mutex.h> |
64 | #include <linux/sysfs.h> | ||
64 | #include <asm/io.h> | 65 | #include <asm/io.h> |
65 | 66 | ||
66 | 67 | ||
@@ -473,6 +474,50 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
473 | return sprintf(buf, "%d\n", data->alarms); | 474 | return sprintf(buf, "%d\n", data->alarms); |
474 | } | 475 | } |
475 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 476 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
477 | |||
478 | static struct attribute *sis5595_attributes[] = { | ||
479 | &dev_attr_in0_input.attr, | ||
480 | &dev_attr_in0_min.attr, | ||
481 | &dev_attr_in0_max.attr, | ||
482 | &dev_attr_in1_input.attr, | ||
483 | &dev_attr_in1_min.attr, | ||
484 | &dev_attr_in1_max.attr, | ||
485 | &dev_attr_in2_input.attr, | ||
486 | &dev_attr_in2_min.attr, | ||
487 | &dev_attr_in2_max.attr, | ||
488 | &dev_attr_in3_input.attr, | ||
489 | &dev_attr_in3_min.attr, | ||
490 | &dev_attr_in3_max.attr, | ||
491 | |||
492 | &dev_attr_fan1_input.attr, | ||
493 | &dev_attr_fan1_min.attr, | ||
494 | &dev_attr_fan1_div.attr, | ||
495 | &dev_attr_fan2_input.attr, | ||
496 | &dev_attr_fan2_min.attr, | ||
497 | &dev_attr_fan2_div.attr, | ||
498 | |||
499 | &dev_attr_alarms.attr, | ||
500 | NULL | ||
501 | }; | ||
502 | |||
503 | static const struct attribute_group sis5595_group = { | ||
504 | .attrs = sis5595_attributes, | ||
505 | }; | ||
506 | |||
507 | static struct attribute *sis5595_attributes_opt[] = { | ||
508 | &dev_attr_in4_input.attr, | ||
509 | &dev_attr_in4_min.attr, | ||
510 | &dev_attr_in4_max.attr, | ||
511 | |||
512 | &dev_attr_temp1_input.attr, | ||
513 | &dev_attr_temp1_max.attr, | ||
514 | &dev_attr_temp1_max_hyst.attr, | ||
515 | NULL | ||
516 | }; | ||
517 | |||
518 | static const struct attribute_group sis5595_group_opt = { | ||
519 | .attrs = sis5595_attributes_opt, | ||
520 | }; | ||
476 | 521 | ||
477 | /* This is called when the module is loaded */ | 522 | /* This is called when the module is loaded */ |
478 | static int sis5595_detect(struct i2c_adapter *adapter) | 523 | static int sis5595_detect(struct i2c_adapter *adapter) |
@@ -566,43 +611,37 @@ static int sis5595_detect(struct i2c_adapter *adapter) | |||
566 | } | 611 | } |
567 | 612 | ||
568 | /* Register sysfs hooks */ | 613 | /* Register sysfs hooks */ |
614 | if ((err = sysfs_create_group(&new_client->dev.kobj, &sis5595_group))) | ||
615 | goto exit_detach; | ||
616 | if (data->maxins == 4) { | ||
617 | if ((err = device_create_file(&new_client->dev, | ||
618 | &dev_attr_in4_input)) | ||
619 | || (err = device_create_file(&new_client->dev, | ||
620 | &dev_attr_in4_min)) | ||
621 | || (err = device_create_file(&new_client->dev, | ||
622 | &dev_attr_in4_max))) | ||
623 | goto exit_remove_files; | ||
624 | } else { | ||
625 | if ((err = device_create_file(&new_client->dev, | ||
626 | &dev_attr_temp1_input)) | ||
627 | || (err = device_create_file(&new_client->dev, | ||
628 | &dev_attr_temp1_max)) | ||
629 | || (err = device_create_file(&new_client->dev, | ||
630 | &dev_attr_temp1_max_hyst))) | ||
631 | goto exit_remove_files; | ||
632 | } | ||
633 | |||
569 | data->class_dev = hwmon_device_register(&new_client->dev); | 634 | data->class_dev = hwmon_device_register(&new_client->dev); |
570 | if (IS_ERR(data->class_dev)) { | 635 | if (IS_ERR(data->class_dev)) { |
571 | err = PTR_ERR(data->class_dev); | 636 | err = PTR_ERR(data->class_dev); |
572 | goto exit_detach; | 637 | goto exit_remove_files; |
573 | } | 638 | } |
574 | 639 | ||
575 | device_create_file(&new_client->dev, &dev_attr_in0_input); | ||
576 | device_create_file(&new_client->dev, &dev_attr_in0_min); | ||
577 | device_create_file(&new_client->dev, &dev_attr_in0_max); | ||
578 | device_create_file(&new_client->dev, &dev_attr_in1_input); | ||
579 | device_create_file(&new_client->dev, &dev_attr_in1_min); | ||
580 | device_create_file(&new_client->dev, &dev_attr_in1_max); | ||
581 | device_create_file(&new_client->dev, &dev_attr_in2_input); | ||
582 | device_create_file(&new_client->dev, &dev_attr_in2_min); | ||
583 | device_create_file(&new_client->dev, &dev_attr_in2_max); | ||
584 | device_create_file(&new_client->dev, &dev_attr_in3_input); | ||
585 | device_create_file(&new_client->dev, &dev_attr_in3_min); | ||
586 | device_create_file(&new_client->dev, &dev_attr_in3_max); | ||
587 | if (data->maxins == 4) { | ||
588 | device_create_file(&new_client->dev, &dev_attr_in4_input); | ||
589 | device_create_file(&new_client->dev, &dev_attr_in4_min); | ||
590 | device_create_file(&new_client->dev, &dev_attr_in4_max); | ||
591 | } | ||
592 | device_create_file(&new_client->dev, &dev_attr_fan1_input); | ||
593 | device_create_file(&new_client->dev, &dev_attr_fan1_min); | ||
594 | device_create_file(&new_client->dev, &dev_attr_fan1_div); | ||
595 | device_create_file(&new_client->dev, &dev_attr_fan2_input); | ||
596 | device_create_file(&new_client->dev, &dev_attr_fan2_min); | ||
597 | device_create_file(&new_client->dev, &dev_attr_fan2_div); | ||
598 | device_create_file(&new_client->dev, &dev_attr_alarms); | ||
599 | if (data->maxins == 3) { | ||
600 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | ||
601 | device_create_file(&new_client->dev, &dev_attr_temp1_max); | ||
602 | device_create_file(&new_client->dev, &dev_attr_temp1_max_hyst); | ||
603 | } | ||
604 | return 0; | 640 | return 0; |
605 | 641 | ||
642 | exit_remove_files: | ||
643 | sysfs_remove_group(&new_client->dev.kobj, &sis5595_group); | ||
644 | sysfs_remove_group(&new_client->dev.kobj, &sis5595_group_opt); | ||
606 | exit_detach: | 645 | exit_detach: |
607 | i2c_detach_client(new_client); | 646 | i2c_detach_client(new_client); |
608 | exit_free: | 647 | exit_free: |
@@ -619,6 +658,8 @@ static int sis5595_detach_client(struct i2c_client *client) | |||
619 | int err; | 658 | int err; |
620 | 659 | ||
621 | hwmon_device_unregister(data->class_dev); | 660 | hwmon_device_unregister(data->class_dev); |
661 | sysfs_remove_group(&client->dev.kobj, &sis5595_group); | ||
662 | sysfs_remove_group(&client->dev.kobj, &sis5595_group_opt); | ||
622 | 663 | ||
623 | if ((err = i2c_detach_client(client))) | 664 | if ((err = i2c_detach_client(client))) |
624 | return err; | 665 | return err; |
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index 95ae056e5a94..f8acada0537a 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/err.h> | 40 | #include <linux/err.h> |
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/mutex.h> | 42 | #include <linux/mutex.h> |
43 | #include <linux/sysfs.h> | ||
43 | #include <asm/io.h> | 44 | #include <asm/io.h> |
44 | 45 | ||
45 | 46 | ||
@@ -570,6 +571,48 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
570 | } | 571 | } |
571 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 572 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
572 | 573 | ||
574 | static struct attribute *via686a_attributes[] = { | ||
575 | &dev_attr_in0_input.attr, | ||
576 | &dev_attr_in1_input.attr, | ||
577 | &dev_attr_in2_input.attr, | ||
578 | &dev_attr_in3_input.attr, | ||
579 | &dev_attr_in4_input.attr, | ||
580 | &dev_attr_in0_min.attr, | ||
581 | &dev_attr_in1_min.attr, | ||
582 | &dev_attr_in2_min.attr, | ||
583 | &dev_attr_in3_min.attr, | ||
584 | &dev_attr_in4_min.attr, | ||
585 | &dev_attr_in0_max.attr, | ||
586 | &dev_attr_in1_max.attr, | ||
587 | &dev_attr_in2_max.attr, | ||
588 | &dev_attr_in3_max.attr, | ||
589 | &dev_attr_in4_max.attr, | ||
590 | |||
591 | &dev_attr_temp1_input.attr, | ||
592 | &dev_attr_temp2_input.attr, | ||
593 | &dev_attr_temp3_input.attr, | ||
594 | &dev_attr_temp1_max.attr, | ||
595 | &dev_attr_temp2_max.attr, | ||
596 | &dev_attr_temp3_max.attr, | ||
597 | &dev_attr_temp1_max_hyst.attr, | ||
598 | &dev_attr_temp2_max_hyst.attr, | ||
599 | &dev_attr_temp3_max_hyst.attr, | ||
600 | |||
601 | &dev_attr_fan1_input.attr, | ||
602 | &dev_attr_fan2_input.attr, | ||
603 | &dev_attr_fan1_min.attr, | ||
604 | &dev_attr_fan2_min.attr, | ||
605 | &dev_attr_fan1_div.attr, | ||
606 | &dev_attr_fan2_div.attr, | ||
607 | |||
608 | &dev_attr_alarms.attr, | ||
609 | NULL | ||
610 | }; | ||
611 | |||
612 | static const struct attribute_group via686a_group = { | ||
613 | .attrs = via686a_attributes, | ||
614 | }; | ||
615 | |||
573 | /* The driver. I choose to use type i2c_driver, as at is identical to both | 616 | /* The driver. I choose to use type i2c_driver, as at is identical to both |
574 | smbus_driver and isa_driver, and clients could be of either kind */ | 617 | smbus_driver and isa_driver, and clients could be of either kind */ |
575 | static struct i2c_driver via686a_driver = { | 618 | static struct i2c_driver via686a_driver = { |
@@ -650,46 +693,19 @@ static int via686a_detect(struct i2c_adapter *adapter) | |||
650 | via686a_init_client(new_client); | 693 | via686a_init_client(new_client); |
651 | 694 | ||
652 | /* Register sysfs hooks */ | 695 | /* Register sysfs hooks */ |
696 | if ((err = sysfs_create_group(&new_client->dev.kobj, &via686a_group))) | ||
697 | goto exit_detach; | ||
698 | |||
653 | data->class_dev = hwmon_device_register(&new_client->dev); | 699 | data->class_dev = hwmon_device_register(&new_client->dev); |
654 | if (IS_ERR(data->class_dev)) { | 700 | if (IS_ERR(data->class_dev)) { |
655 | err = PTR_ERR(data->class_dev); | 701 | err = PTR_ERR(data->class_dev); |
656 | goto exit_detach; | 702 | goto exit_remove_files; |
657 | } | 703 | } |
658 | 704 | ||
659 | device_create_file(&new_client->dev, &dev_attr_in0_input); | ||
660 | device_create_file(&new_client->dev, &dev_attr_in1_input); | ||
661 | device_create_file(&new_client->dev, &dev_attr_in2_input); | ||
662 | device_create_file(&new_client->dev, &dev_attr_in3_input); | ||
663 | device_create_file(&new_client->dev, &dev_attr_in4_input); | ||
664 | device_create_file(&new_client->dev, &dev_attr_in0_min); | ||
665 | device_create_file(&new_client->dev, &dev_attr_in1_min); | ||
666 | device_create_file(&new_client->dev, &dev_attr_in2_min); | ||
667 | device_create_file(&new_client->dev, &dev_attr_in3_min); | ||
668 | device_create_file(&new_client->dev, &dev_attr_in4_min); | ||
669 | device_create_file(&new_client->dev, &dev_attr_in0_max); | ||
670 | device_create_file(&new_client->dev, &dev_attr_in1_max); | ||
671 | device_create_file(&new_client->dev, &dev_attr_in2_max); | ||
672 | device_create_file(&new_client->dev, &dev_attr_in3_max); | ||
673 | device_create_file(&new_client->dev, &dev_attr_in4_max); | ||
674 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | ||
675 | device_create_file(&new_client->dev, &dev_attr_temp2_input); | ||
676 | device_create_file(&new_client->dev, &dev_attr_temp3_input); | ||
677 | device_create_file(&new_client->dev, &dev_attr_temp1_max); | ||
678 | device_create_file(&new_client->dev, &dev_attr_temp2_max); | ||
679 | device_create_file(&new_client->dev, &dev_attr_temp3_max); | ||
680 | device_create_file(&new_client->dev, &dev_attr_temp1_max_hyst); | ||
681 | device_create_file(&new_client->dev, &dev_attr_temp2_max_hyst); | ||
682 | device_create_file(&new_client->dev, &dev_attr_temp3_max_hyst); | ||
683 | device_create_file(&new_client->dev, &dev_attr_fan1_input); | ||
684 | device_create_file(&new_client->dev, &dev_attr_fan2_input); | ||
685 | device_create_file(&new_client->dev, &dev_attr_fan1_min); | ||
686 | device_create_file(&new_client->dev, &dev_attr_fan2_min); | ||
687 | device_create_file(&new_client->dev, &dev_attr_fan1_div); | ||
688 | device_create_file(&new_client->dev, &dev_attr_fan2_div); | ||
689 | device_create_file(&new_client->dev, &dev_attr_alarms); | ||
690 | |||
691 | return 0; | 705 | return 0; |
692 | 706 | ||
707 | exit_remove_files: | ||
708 | sysfs_remove_group(&new_client->dev.kobj, &via686a_group); | ||
693 | exit_detach: | 709 | exit_detach: |
694 | i2c_detach_client(new_client); | 710 | i2c_detach_client(new_client); |
695 | exit_free: | 711 | exit_free: |
@@ -705,6 +721,7 @@ static int via686a_detach_client(struct i2c_client *client) | |||
705 | int err; | 721 | int err; |
706 | 722 | ||
707 | hwmon_device_unregister(data->class_dev); | 723 | hwmon_device_unregister(data->class_dev); |
724 | sysfs_remove_group(&client->dev.kobj, &via686a_group); | ||
708 | 725 | ||
709 | if ((err = i2c_detach_client(client))) | 726 | if ((err = i2c_detach_client(client))) |
710 | return err; | 727 | return err; |