aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark M. Hoffman <mhoffman@lightlink.com>2006-09-24 15:15:35 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-28 18:31:17 -0400
commit681c6f7a6702f208d48b501c8829dbc03a2ca238 (patch)
treeedeba1565c69b4be8e3aeb73df97ccea05fce66c
parent0501a3816e5b778830fc2157a6d6bb11a965fc2c (diff)
hwmon: Fix unchecked return status, batch 3
hwmon: Fix unchecked return status, batch 3 Fix up some hwmon drivers so that they no longer ignore return status from device_create_file(). Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/hwmon/adm1021.c31
-rw-r--r--drivers/hwmon/adm1025.c94
-rw-r--r--drivers/hwmon/adm1026.c286
-rw-r--r--drivers/hwmon/adm1031.c114
-rw-r--r--drivers/hwmon/adm9240.c105
5 files changed, 346 insertions, 284 deletions
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
index 2b6e74dd4a82..c466329b2ef4 100644
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -190,6 +190,21 @@ static int adm1021_attach_adapter(struct i2c_adapter *adapter)
190 return i2c_probe(adapter, &addr_data, adm1021_detect); 190 return i2c_probe(adapter, &addr_data, adm1021_detect);
191} 191}
192 192
193static struct attribute *adm1021_attributes[] = {
194 &dev_attr_temp1_max.attr,
195 &dev_attr_temp1_min.attr,
196 &dev_attr_temp1_input.attr,
197 &dev_attr_temp2_max.attr,
198 &dev_attr_temp2_min.attr,
199 &dev_attr_temp2_input.attr,
200 &dev_attr_alarms.attr,
201 NULL
202};
203
204static const struct attribute_group adm1021_group = {
205 .attrs = adm1021_attributes,
206};
207
193static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind) 208static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
194{ 209{
195 int i; 210 int i;
@@ -287,22 +302,19 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
287 adm1021_init_client(new_client); 302 adm1021_init_client(new_client);
288 303
289 /* Register sysfs hooks */ 304 /* Register sysfs hooks */
305 if ((err = sysfs_create_group(&new_client->dev.kobj, &adm1021_group)))
306 goto error2;
307
290 data->class_dev = hwmon_device_register(&new_client->dev); 308 data->class_dev = hwmon_device_register(&new_client->dev);
291 if (IS_ERR(data->class_dev)) { 309 if (IS_ERR(data->class_dev)) {
292 err = PTR_ERR(data->class_dev); 310 err = PTR_ERR(data->class_dev);
293 goto error2; 311 goto error3;
294 } 312 }
295 313
296 device_create_file(&new_client->dev, &dev_attr_temp1_max);
297 device_create_file(&new_client->dev, &dev_attr_temp1_min);
298 device_create_file(&new_client->dev, &dev_attr_temp1_input);
299 device_create_file(&new_client->dev, &dev_attr_temp2_max);
300 device_create_file(&new_client->dev, &dev_attr_temp2_min);
301 device_create_file(&new_client->dev, &dev_attr_temp2_input);
302 device_create_file(&new_client->dev, &dev_attr_alarms);
303
304 return 0; 314 return 0;
305 315
316error3:
317 sysfs_remove_group(&new_client->dev.kobj, &adm1021_group);
306error2: 318error2:
307 i2c_detach_client(new_client); 319 i2c_detach_client(new_client);
308error1: 320error1:
@@ -326,6 +338,7 @@ static int adm1021_detach_client(struct i2c_client *client)
326 int err; 338 int err;
327 339
328 hwmon_device_unregister(data->class_dev); 340 hwmon_device_unregister(data->class_dev);
341 sysfs_remove_group(&client->dev.kobj, &adm1021_group);
329 342
330 if ((err = i2c_detach_client(client))) 343 if ((err = i2c_detach_client(client)))
331 return err; 344 return err;
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c
index a4c859c9fbf8..8c562885b54b 100644
--- a/drivers/hwmon/adm1025.c
+++ b/drivers/hwmon/adm1025.c
@@ -315,6 +315,49 @@ static int adm1025_attach_adapter(struct i2c_adapter *adapter)
315 return i2c_probe(adapter, &addr_data, adm1025_detect); 315 return i2c_probe(adapter, &addr_data, adm1025_detect);
316} 316}
317 317
318static struct attribute *adm1025_attributes[] = {
319 &dev_attr_in0_input.attr,
320 &dev_attr_in1_input.attr,
321 &dev_attr_in2_input.attr,
322 &dev_attr_in3_input.attr,
323 &dev_attr_in5_input.attr,
324 &dev_attr_in0_min.attr,
325 &dev_attr_in1_min.attr,
326 &dev_attr_in2_min.attr,
327 &dev_attr_in3_min.attr,
328 &dev_attr_in5_min.attr,
329 &dev_attr_in0_max.attr,
330 &dev_attr_in1_max.attr,
331 &dev_attr_in2_max.attr,
332 &dev_attr_in3_max.attr,
333 &dev_attr_in5_max.attr,
334 &dev_attr_temp1_input.attr,
335 &dev_attr_temp2_input.attr,
336 &dev_attr_temp1_min.attr,
337 &dev_attr_temp2_min.attr,
338 &dev_attr_temp1_max.attr,
339 &dev_attr_temp2_max.attr,
340 &dev_attr_alarms.attr,
341 &dev_attr_cpu0_vid.attr,
342 &dev_attr_vrm.attr,
343 NULL
344};
345
346static const struct attribute_group adm1025_group = {
347 .attrs = adm1025_attributes,
348};
349
350static struct attribute *adm1025_attributes_opt[] = {
351 &dev_attr_in4_input.attr,
352 &dev_attr_in4_min.attr,
353 &dev_attr_in4_max.attr,
354 NULL
355};
356
357static const struct attribute_group adm1025_group_opt = {
358 .attrs = adm1025_attributes_opt,
359};
360
318/* 361/*
319 * The following function does more than just detection. If detection 362 * The following function does more than just detection. If detection
320 * succeeds, it also registers the new chip. 363 * succeeds, it also registers the new chip.
@@ -415,46 +458,31 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address, int kind)
415 adm1025_init_client(new_client); 458 adm1025_init_client(new_client);
416 459
417 /* Register sysfs hooks */ 460 /* Register sysfs hooks */
418 data->class_dev = hwmon_device_register(&new_client->dev); 461 if ((err = sysfs_create_group(&new_client->dev.kobj, &adm1025_group)))
419 if (IS_ERR(data->class_dev)) {
420 err = PTR_ERR(data->class_dev);
421 goto exit_detach; 462 goto exit_detach;
422 }
423
424 device_create_file(&new_client->dev, &dev_attr_in0_input);
425 device_create_file(&new_client->dev, &dev_attr_in1_input);
426 device_create_file(&new_client->dev, &dev_attr_in2_input);
427 device_create_file(&new_client->dev, &dev_attr_in3_input);
428 device_create_file(&new_client->dev, &dev_attr_in5_input);
429 device_create_file(&new_client->dev, &dev_attr_in0_min);
430 device_create_file(&new_client->dev, &dev_attr_in1_min);
431 device_create_file(&new_client->dev, &dev_attr_in2_min);
432 device_create_file(&new_client->dev, &dev_attr_in3_min);
433 device_create_file(&new_client->dev, &dev_attr_in5_min);
434 device_create_file(&new_client->dev, &dev_attr_in0_max);
435 device_create_file(&new_client->dev, &dev_attr_in1_max);
436 device_create_file(&new_client->dev, &dev_attr_in2_max);
437 device_create_file(&new_client->dev, &dev_attr_in3_max);
438 device_create_file(&new_client->dev, &dev_attr_in5_max);
439 device_create_file(&new_client->dev, &dev_attr_temp1_input);
440 device_create_file(&new_client->dev, &dev_attr_temp2_input);
441 device_create_file(&new_client->dev, &dev_attr_temp1_min);
442 device_create_file(&new_client->dev, &dev_attr_temp2_min);
443 device_create_file(&new_client->dev, &dev_attr_temp1_max);
444 device_create_file(&new_client->dev, &dev_attr_temp2_max);
445 device_create_file(&new_client->dev, &dev_attr_alarms);
446 device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
447 device_create_file(&new_client->dev, &dev_attr_vrm);
448 463
449 /* Pin 11 is either in4 (+12V) or VID4 */ 464 /* Pin 11 is either in4 (+12V) or VID4 */
450 if (!(config & 0x20)) { 465 if (!(config & 0x20)) {
451 device_create_file(&new_client->dev, &dev_attr_in4_input); 466 if ((err = device_create_file(&new_client->dev,
452 device_create_file(&new_client->dev, &dev_attr_in4_min); 467 &dev_attr_in4_input))
453 device_create_file(&new_client->dev, &dev_attr_in4_max); 468 || (err = device_create_file(&new_client->dev,
469 &dev_attr_in4_min))
470 || (err = device_create_file(&new_client->dev,
471 &dev_attr_in4_max)))
472 goto exit_remove;
473 }
474
475 data->class_dev = hwmon_device_register(&new_client->dev);
476 if (IS_ERR(data->class_dev)) {
477 err = PTR_ERR(data->class_dev);
478 goto exit_remove;
454 } 479 }
455 480
456 return 0; 481 return 0;
457 482
483exit_remove:
484 sysfs_remove_group(&new_client->dev.kobj, &adm1025_group);
485 sysfs_remove_group(&new_client->dev.kobj, &adm1025_group_opt);
458exit_detach: 486exit_detach:
459 i2c_detach_client(new_client); 487 i2c_detach_client(new_client);
460exit_free: 488exit_free:
@@ -511,6 +539,8 @@ static int adm1025_detach_client(struct i2c_client *client)
511 int err; 539 int err;
512 540
513 hwmon_device_unregister(data->class_dev); 541 hwmon_device_unregister(data->class_dev);
542 sysfs_remove_group(&client->dev.kobj, &adm1025_group);
543 sysfs_remove_group(&client->dev.kobj, &adm1025_group_opt);
514 544
515 if ((err = i2c_detach_client(client))) 545 if ((err = i2c_detach_client(client)))
516 return err; 546 return err;
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index 6d4f8b8d358e..b4618b2705f7 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -323,15 +323,6 @@ static int adm1026_attach_adapter(struct i2c_adapter *adapter)
323 return i2c_probe(adapter, &addr_data, adm1026_detect); 323 return i2c_probe(adapter, &addr_data, adm1026_detect);
324} 324}
325 325
326static int adm1026_detach_client(struct i2c_client *client)
327{
328 struct adm1026_data *data = i2c_get_clientdata(client);
329 hwmon_device_unregister(data->class_dev);
330 i2c_detach_client(client);
331 kfree(data);
332 return 0;
333}
334
335static int adm1026_read_value(struct i2c_client *client, u8 reg) 326static int adm1026_read_value(struct i2c_client *client, u8 reg)
336{ 327{
337 int res; 328 int res;
@@ -1450,6 +1441,135 @@ static DEVICE_ATTR(temp1_auto_point2_pwm, S_IRUGO, show_auto_pwm_max, NULL);
1450static DEVICE_ATTR(temp2_auto_point2_pwm, S_IRUGO, show_auto_pwm_max, NULL); 1441static DEVICE_ATTR(temp2_auto_point2_pwm, S_IRUGO, show_auto_pwm_max, NULL);
1451static DEVICE_ATTR(temp3_auto_point2_pwm, S_IRUGO, show_auto_pwm_max, NULL); 1442static DEVICE_ATTR(temp3_auto_point2_pwm, S_IRUGO, show_auto_pwm_max, NULL);
1452 1443
1444static struct attribute *adm1026_attributes[] = {
1445 &sensor_dev_attr_in0_input.dev_attr.attr,
1446 &sensor_dev_attr_in0_max.dev_attr.attr,
1447 &sensor_dev_attr_in0_min.dev_attr.attr,
1448 &sensor_dev_attr_in1_input.dev_attr.attr,
1449 &sensor_dev_attr_in1_max.dev_attr.attr,
1450 &sensor_dev_attr_in1_min.dev_attr.attr,
1451 &sensor_dev_attr_in2_input.dev_attr.attr,
1452 &sensor_dev_attr_in2_max.dev_attr.attr,
1453 &sensor_dev_attr_in2_min.dev_attr.attr,
1454 &sensor_dev_attr_in3_input.dev_attr.attr,
1455 &sensor_dev_attr_in3_max.dev_attr.attr,
1456 &sensor_dev_attr_in3_min.dev_attr.attr,
1457 &sensor_dev_attr_in4_input.dev_attr.attr,
1458 &sensor_dev_attr_in4_max.dev_attr.attr,
1459 &sensor_dev_attr_in4_min.dev_attr.attr,
1460 &sensor_dev_attr_in5_input.dev_attr.attr,
1461 &sensor_dev_attr_in5_max.dev_attr.attr,
1462 &sensor_dev_attr_in5_min.dev_attr.attr,
1463 &sensor_dev_attr_in6_input.dev_attr.attr,
1464 &sensor_dev_attr_in6_max.dev_attr.attr,
1465 &sensor_dev_attr_in6_min.dev_attr.attr,
1466 &sensor_dev_attr_in7_input.dev_attr.attr,
1467 &sensor_dev_attr_in7_max.dev_attr.attr,
1468 &sensor_dev_attr_in7_min.dev_attr.attr,
1469 &sensor_dev_attr_in8_input.dev_attr.attr,
1470 &sensor_dev_attr_in8_max.dev_attr.attr,
1471 &sensor_dev_attr_in8_min.dev_attr.attr,
1472 &sensor_dev_attr_in9_input.dev_attr.attr,
1473 &sensor_dev_attr_in9_max.dev_attr.attr,
1474 &sensor_dev_attr_in9_min.dev_attr.attr,
1475 &sensor_dev_attr_in10_input.dev_attr.attr,
1476 &sensor_dev_attr_in10_max.dev_attr.attr,
1477 &sensor_dev_attr_in10_min.dev_attr.attr,
1478 &sensor_dev_attr_in11_input.dev_attr.attr,
1479 &sensor_dev_attr_in11_max.dev_attr.attr,
1480 &sensor_dev_attr_in11_min.dev_attr.attr,
1481 &sensor_dev_attr_in12_input.dev_attr.attr,
1482 &sensor_dev_attr_in12_max.dev_attr.attr,
1483 &sensor_dev_attr_in12_min.dev_attr.attr,
1484 &sensor_dev_attr_in13_input.dev_attr.attr,
1485 &sensor_dev_attr_in13_max.dev_attr.attr,
1486 &sensor_dev_attr_in13_min.dev_attr.attr,
1487 &sensor_dev_attr_in14_input.dev_attr.attr,
1488 &sensor_dev_attr_in14_max.dev_attr.attr,
1489 &sensor_dev_attr_in14_min.dev_attr.attr,
1490 &sensor_dev_attr_in15_input.dev_attr.attr,
1491 &sensor_dev_attr_in15_max.dev_attr.attr,
1492 &sensor_dev_attr_in15_min.dev_attr.attr,
1493 &sensor_dev_attr_in16_input.dev_attr.attr,
1494 &sensor_dev_attr_in16_max.dev_attr.attr,
1495 &sensor_dev_attr_in16_min.dev_attr.attr,
1496 &sensor_dev_attr_fan1_input.dev_attr.attr,
1497 &sensor_dev_attr_fan1_div.dev_attr.attr,
1498 &sensor_dev_attr_fan1_min.dev_attr.attr,
1499 &sensor_dev_attr_fan2_input.dev_attr.attr,
1500 &sensor_dev_attr_fan2_div.dev_attr.attr,
1501 &sensor_dev_attr_fan2_min.dev_attr.attr,
1502 &sensor_dev_attr_fan3_input.dev_attr.attr,
1503 &sensor_dev_attr_fan3_div.dev_attr.attr,
1504 &sensor_dev_attr_fan3_min.dev_attr.attr,
1505 &sensor_dev_attr_fan4_input.dev_attr.attr,
1506 &sensor_dev_attr_fan4_div.dev_attr.attr,
1507 &sensor_dev_attr_fan4_min.dev_attr.attr,
1508 &sensor_dev_attr_fan5_input.dev_attr.attr,
1509 &sensor_dev_attr_fan5_div.dev_attr.attr,
1510 &sensor_dev_attr_fan5_min.dev_attr.attr,
1511 &sensor_dev_attr_fan6_input.dev_attr.attr,
1512 &sensor_dev_attr_fan6_div.dev_attr.attr,
1513 &sensor_dev_attr_fan6_min.dev_attr.attr,
1514 &sensor_dev_attr_fan7_input.dev_attr.attr,
1515 &sensor_dev_attr_fan7_div.dev_attr.attr,
1516 &sensor_dev_attr_fan7_min.dev_attr.attr,
1517 &sensor_dev_attr_fan8_input.dev_attr.attr,
1518 &sensor_dev_attr_fan8_div.dev_attr.attr,
1519 &sensor_dev_attr_fan8_min.dev_attr.attr,
1520 &sensor_dev_attr_temp1_input.dev_attr.attr,
1521 &sensor_dev_attr_temp1_max.dev_attr.attr,
1522 &sensor_dev_attr_temp1_min.dev_attr.attr,
1523 &sensor_dev_attr_temp2_input.dev_attr.attr,
1524 &sensor_dev_attr_temp2_max.dev_attr.attr,
1525 &sensor_dev_attr_temp2_min.dev_attr.attr,
1526 &sensor_dev_attr_temp3_input.dev_attr.attr,
1527 &sensor_dev_attr_temp3_max.dev_attr.attr,
1528 &sensor_dev_attr_temp3_min.dev_attr.attr,
1529 &sensor_dev_attr_temp1_offset.dev_attr.attr,
1530 &sensor_dev_attr_temp2_offset.dev_attr.attr,
1531 &sensor_dev_attr_temp3_offset.dev_attr.attr,
1532 &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
1533 &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr,
1534 &sensor_dev_attr_temp3_auto_point1_temp.dev_attr.attr,
1535 &sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr.attr,
1536 &sensor_dev_attr_temp2_auto_point1_temp_hyst.dev_attr.attr,
1537 &sensor_dev_attr_temp3_auto_point1_temp_hyst.dev_attr.attr,
1538 &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr,
1539 &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr,
1540 &sensor_dev_attr_temp3_auto_point2_temp.dev_attr.attr,
1541 &sensor_dev_attr_temp1_crit.dev_attr.attr,
1542 &sensor_dev_attr_temp2_crit.dev_attr.attr,
1543 &sensor_dev_attr_temp3_crit.dev_attr.attr,
1544 &dev_attr_temp1_crit_enable.attr,
1545 &dev_attr_temp2_crit_enable.attr,
1546 &dev_attr_temp3_crit_enable.attr,
1547 &dev_attr_cpu0_vid.attr,
1548 &dev_attr_vrm.attr,
1549 &dev_attr_alarms.attr,
1550 &dev_attr_alarm_mask.attr,
1551 &dev_attr_gpio.attr,
1552 &dev_attr_gpio_mask.attr,
1553 &dev_attr_pwm1.attr,
1554 &dev_attr_pwm2.attr,
1555 &dev_attr_pwm3.attr,
1556 &dev_attr_pwm1_enable.attr,
1557 &dev_attr_pwm2_enable.attr,
1558 &dev_attr_pwm3_enable.attr,
1559 &dev_attr_temp1_auto_point1_pwm.attr,
1560 &dev_attr_temp2_auto_point1_pwm.attr,
1561 &dev_attr_temp3_auto_point1_pwm.attr,
1562 &dev_attr_temp1_auto_point2_pwm.attr,
1563 &dev_attr_temp2_auto_point2_pwm.attr,
1564 &dev_attr_temp3_auto_point2_pwm.attr,
1565 &dev_attr_analog_out.attr,
1566 NULL
1567};
1568
1569static const struct attribute_group adm1026_group = {
1570 .attrs = adm1026_attributes,
1571};
1572
1453static int adm1026_detect(struct i2c_adapter *adapter, int address, 1573static int adm1026_detect(struct i2c_adapter *adapter, int address,
1454 int kind) 1574 int kind)
1455{ 1575{
@@ -1554,145 +1674,20 @@ static int adm1026_detect(struct i2c_adapter *adapter, int address,
1554 adm1026_init_client(new_client); 1674 adm1026_init_client(new_client);
1555 1675
1556 /* Register sysfs hooks */ 1676 /* Register sysfs hooks */
1677 if ((err = sysfs_create_group(&new_client->dev.kobj, &adm1026_group)))
1678 goto exitdetach;
1679
1557 data->class_dev = hwmon_device_register(&new_client->dev); 1680 data->class_dev = hwmon_device_register(&new_client->dev);
1558 if (IS_ERR(data->class_dev)) { 1681 if (IS_ERR(data->class_dev)) {
1559 err = PTR_ERR(data->class_dev); 1682 err = PTR_ERR(data->class_dev);
1560 goto exitdetach; 1683 goto exitremove;
1561 } 1684 }
1562 1685
1563 device_create_file(&new_client->dev, &sensor_dev_attr_in0_input.dev_attr);
1564 device_create_file(&new_client->dev, &sensor_dev_attr_in0_max.dev_attr);
1565 device_create_file(&new_client->dev, &sensor_dev_attr_in0_min.dev_attr);
1566 device_create_file(&new_client->dev, &sensor_dev_attr_in1_input.dev_attr);
1567 device_create_file(&new_client->dev, &sensor_dev_attr_in1_max.dev_attr);
1568 device_create_file(&new_client->dev, &sensor_dev_attr_in1_min.dev_attr);
1569 device_create_file(&new_client->dev, &sensor_dev_attr_in2_input.dev_attr);
1570 device_create_file(&new_client->dev, &sensor_dev_attr_in2_max.dev_attr);
1571 device_create_file(&new_client->dev, &sensor_dev_attr_in2_min.dev_attr);
1572 device_create_file(&new_client->dev, &sensor_dev_attr_in3_input.dev_attr);
1573 device_create_file(&new_client->dev, &sensor_dev_attr_in3_max.dev_attr);
1574 device_create_file(&new_client->dev, &sensor_dev_attr_in3_min.dev_attr);
1575 device_create_file(&new_client->dev, &sensor_dev_attr_in4_input.dev_attr);
1576 device_create_file(&new_client->dev, &sensor_dev_attr_in4_max.dev_attr);
1577 device_create_file(&new_client->dev, &sensor_dev_attr_in4_min.dev_attr);
1578 device_create_file(&new_client->dev, &sensor_dev_attr_in5_input.dev_attr);
1579 device_create_file(&new_client->dev, &sensor_dev_attr_in5_max.dev_attr);
1580 device_create_file(&new_client->dev, &sensor_dev_attr_in5_min.dev_attr);
1581 device_create_file(&new_client->dev, &sensor_dev_attr_in6_input.dev_attr);
1582 device_create_file(&new_client->dev, &sensor_dev_attr_in6_max.dev_attr);
1583 device_create_file(&new_client->dev, &sensor_dev_attr_in6_min.dev_attr);
1584 device_create_file(&new_client->dev, &sensor_dev_attr_in7_input.dev_attr);
1585 device_create_file(&new_client->dev, &sensor_dev_attr_in7_max.dev_attr);
1586 device_create_file(&new_client->dev, &sensor_dev_attr_in7_min.dev_attr);
1587 device_create_file(&new_client->dev, &sensor_dev_attr_in8_input.dev_attr);
1588 device_create_file(&new_client->dev, &sensor_dev_attr_in8_max.dev_attr);
1589 device_create_file(&new_client->dev, &sensor_dev_attr_in8_min.dev_attr);
1590 device_create_file(&new_client->dev, &sensor_dev_attr_in9_input.dev_attr);
1591 device_create_file(&new_client->dev, &sensor_dev_attr_in9_max.dev_attr);
1592 device_create_file(&new_client->dev, &sensor_dev_attr_in9_min.dev_attr);
1593 device_create_file(&new_client->dev, &sensor_dev_attr_in10_input.dev_attr);
1594 device_create_file(&new_client->dev, &sensor_dev_attr_in10_max.dev_attr);
1595 device_create_file(&new_client->dev, &sensor_dev_attr_in10_min.dev_attr);
1596 device_create_file(&new_client->dev, &sensor_dev_attr_in11_input.dev_attr);
1597 device_create_file(&new_client->dev, &sensor_dev_attr_in11_max.dev_attr);
1598 device_create_file(&new_client->dev, &sensor_dev_attr_in11_min.dev_attr);
1599 device_create_file(&new_client->dev, &sensor_dev_attr_in12_input.dev_attr);
1600 device_create_file(&new_client->dev, &sensor_dev_attr_in12_max.dev_attr);
1601 device_create_file(&new_client->dev, &sensor_dev_attr_in12_min.dev_attr);
1602 device_create_file(&new_client->dev, &sensor_dev_attr_in13_input.dev_attr);
1603 device_create_file(&new_client->dev, &sensor_dev_attr_in13_max.dev_attr);
1604 device_create_file(&new_client->dev, &sensor_dev_attr_in13_min.dev_attr);
1605 device_create_file(&new_client->dev, &sensor_dev_attr_in14_input.dev_attr);
1606 device_create_file(&new_client->dev, &sensor_dev_attr_in14_max.dev_attr);
1607 device_create_file(&new_client->dev, &sensor_dev_attr_in14_min.dev_attr);
1608 device_create_file(&new_client->dev, &sensor_dev_attr_in15_input.dev_attr);
1609 device_create_file(&new_client->dev, &sensor_dev_attr_in15_max.dev_attr);
1610 device_create_file(&new_client->dev, &sensor_dev_attr_in15_min.dev_attr);
1611 device_create_file(&new_client->dev, &sensor_dev_attr_in16_input.dev_attr);
1612 device_create_file(&new_client->dev, &sensor_dev_attr_in16_max.dev_attr);
1613 device_create_file(&new_client->dev, &sensor_dev_attr_in16_min.dev_attr);
1614 device_create_file(&new_client->dev, &sensor_dev_attr_fan1_input.dev_attr);
1615 device_create_file(&new_client->dev, &sensor_dev_attr_fan1_div.dev_attr);
1616 device_create_file(&new_client->dev, &sensor_dev_attr_fan1_min.dev_attr);
1617 device_create_file(&new_client->dev, &sensor_dev_attr_fan2_input.dev_attr);
1618 device_create_file(&new_client->dev, &sensor_dev_attr_fan2_div.dev_attr);
1619 device_create_file(&new_client->dev, &sensor_dev_attr_fan2_min.dev_attr);
1620 device_create_file(&new_client->dev, &sensor_dev_attr_fan3_input.dev_attr);
1621 device_create_file(&new_client->dev, &sensor_dev_attr_fan3_div.dev_attr);
1622 device_create_file(&new_client->dev, &sensor_dev_attr_fan3_min.dev_attr);
1623 device_create_file(&new_client->dev, &sensor_dev_attr_fan4_input.dev_attr);
1624 device_create_file(&new_client->dev, &sensor_dev_attr_fan4_div.dev_attr);
1625 device_create_file(&new_client->dev, &sensor_dev_attr_fan4_min.dev_attr);
1626 device_create_file(&new_client->dev, &sensor_dev_attr_fan5_input.dev_attr);
1627 device_create_file(&new_client->dev, &sensor_dev_attr_fan5_div.dev_attr);
1628 device_create_file(&new_client->dev, &sensor_dev_attr_fan5_min.dev_attr);
1629 device_create_file(&new_client->dev, &sensor_dev_attr_fan6_input.dev_attr);
1630 device_create_file(&new_client->dev, &sensor_dev_attr_fan6_div.dev_attr);
1631 device_create_file(&new_client->dev, &sensor_dev_attr_fan6_min.dev_attr);
1632 device_create_file(&new_client->dev, &sensor_dev_attr_fan7_input.dev_attr);
1633 device_create_file(&new_client->dev, &sensor_dev_attr_fan7_div.dev_attr);
1634 device_create_file(&new_client->dev, &sensor_dev_attr_fan7_min.dev_attr);
1635 device_create_file(&new_client->dev, &sensor_dev_attr_fan8_input.dev_attr);
1636 device_create_file(&new_client->dev, &sensor_dev_attr_fan8_div.dev_attr);
1637 device_create_file(&new_client->dev, &sensor_dev_attr_fan8_min.dev_attr);
1638 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_input.dev_attr);
1639 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_max.dev_attr);
1640 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_min.dev_attr);
1641 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_input.dev_attr);
1642 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_max.dev_attr);
1643 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_min.dev_attr);
1644 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_input.dev_attr);
1645 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_max.dev_attr);
1646 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_min.dev_attr);
1647 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_offset.dev_attr);
1648 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_offset.dev_attr);
1649 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_offset.dev_attr);
1650 device_create_file(&new_client->dev,
1651 &sensor_dev_attr_temp1_auto_point1_temp.dev_attr);
1652 device_create_file(&new_client->dev,
1653 &sensor_dev_attr_temp2_auto_point1_temp.dev_attr);
1654 device_create_file(&new_client->dev,
1655 &sensor_dev_attr_temp3_auto_point1_temp.dev_attr);
1656 device_create_file(&new_client->dev,
1657 &sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr);
1658 device_create_file(&new_client->dev,
1659 &sensor_dev_attr_temp2_auto_point1_temp_hyst.dev_attr);
1660 device_create_file(&new_client->dev,
1661 &sensor_dev_attr_temp3_auto_point1_temp_hyst.dev_attr);
1662 device_create_file(&new_client->dev,
1663 &sensor_dev_attr_temp1_auto_point2_temp.dev_attr);
1664 device_create_file(&new_client->dev,
1665 &sensor_dev_attr_temp2_auto_point2_temp.dev_attr);
1666 device_create_file(&new_client->dev,
1667 &sensor_dev_attr_temp3_auto_point2_temp.dev_attr);
1668 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_crit.dev_attr);
1669 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_crit.dev_attr);
1670 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_crit.dev_attr);
1671 device_create_file(&new_client->dev, &dev_attr_temp1_crit_enable);
1672 device_create_file(&new_client->dev, &dev_attr_temp2_crit_enable);
1673 device_create_file(&new_client->dev, &dev_attr_temp3_crit_enable);
1674 device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
1675 device_create_file(&new_client->dev, &dev_attr_vrm);
1676 device_create_file(&new_client->dev, &dev_attr_alarms);
1677 device_create_file(&new_client->dev, &dev_attr_alarm_mask);
1678 device_create_file(&new_client->dev, &dev_attr_gpio);
1679 device_create_file(&new_client->dev, &dev_attr_gpio_mask);
1680 device_create_file(&new_client->dev, &dev_attr_pwm1);
1681 device_create_file(&new_client->dev, &dev_attr_pwm2);
1682 device_create_file(&new_client->dev, &dev_attr_pwm3);
1683 device_create_file(&new_client->dev, &dev_attr_pwm1_enable);
1684 device_create_file(&new_client->dev, &dev_attr_pwm2_enable);
1685 device_create_file(&new_client->dev, &dev_attr_pwm3_enable);
1686 device_create_file(&new_client->dev, &dev_attr_temp1_auto_point1_pwm);
1687 device_create_file(&new_client->dev, &dev_attr_temp2_auto_point1_pwm);
1688 device_create_file(&new_client->dev, &dev_attr_temp3_auto_point1_pwm);
1689 device_create_file(&new_client->dev, &dev_attr_temp1_auto_point2_pwm);
1690 device_create_file(&new_client->dev, &dev_attr_temp2_auto_point2_pwm);
1691 device_create_file(&new_client->dev, &dev_attr_temp3_auto_point2_pwm);
1692 device_create_file(&new_client->dev, &dev_attr_analog_out);
1693 return 0; 1686 return 0;
1694 1687
1695 /* Error out and cleanup code */ 1688 /* Error out and cleanup code */
1689exitremove:
1690 sysfs_remove_group(&new_client->dev.kobj, &adm1026_group);
1696exitdetach: 1691exitdetach:
1697 i2c_detach_client(new_client); 1692 i2c_detach_client(new_client);
1698exitfree: 1693exitfree:
@@ -1700,6 +1695,17 @@ exitfree:
1700exit: 1695exit:
1701 return err; 1696 return err;
1702} 1697}
1698
1699static int adm1026_detach_client(struct i2c_client *client)
1700{
1701 struct adm1026_data *data = i2c_get_clientdata(client);
1702 hwmon_device_unregister(data->class_dev);
1703 sysfs_remove_group(&client->dev.kobj, &adm1026_group);
1704 i2c_detach_client(client);
1705 kfree(data);
1706 return 0;
1707}
1708
1703static int __init sm_adm1026_init(void) 1709static int __init sm_adm1026_init(void)
1704{ 1710{
1705 return i2c_add_driver(&adm1026_driver); 1711 return i2c_add_driver(&adm1026_driver);
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
index 3bf2da621aed..122683fc91d0 100644
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -730,6 +730,61 @@ static int adm1031_attach_adapter(struct i2c_adapter *adapter)
730 return i2c_probe(adapter, &addr_data, adm1031_detect); 730 return i2c_probe(adapter, &addr_data, adm1031_detect);
731} 731}
732 732
733static struct attribute *adm1031_attributes[] = {
734 &dev_attr_fan1_input.attr,
735 &dev_attr_fan1_div.attr,
736 &dev_attr_fan1_min.attr,
737 &dev_attr_pwm1.attr,
738 &dev_attr_auto_fan1_channel.attr,
739 &dev_attr_temp1_input.attr,
740 &dev_attr_temp1_min.attr,
741 &dev_attr_temp1_max.attr,
742 &dev_attr_temp1_crit.attr,
743 &dev_attr_temp2_input.attr,
744 &dev_attr_temp2_min.attr,
745 &dev_attr_temp2_max.attr,
746 &dev_attr_temp2_crit.attr,
747
748 &dev_attr_auto_temp1_off.attr,
749 &dev_attr_auto_temp1_min.attr,
750 &dev_attr_auto_temp1_max.attr,
751
752 &dev_attr_auto_temp2_off.attr,
753 &dev_attr_auto_temp2_min.attr,
754 &dev_attr_auto_temp2_max.attr,
755
756 &dev_attr_auto_fan1_min_pwm.attr,
757
758 &dev_attr_alarms.attr,
759
760 NULL
761};
762
763static const struct attribute_group adm1031_group = {
764 .attrs = adm1031_attributes,
765};
766
767static struct attribute *adm1031_attributes_opt[] = {
768 &dev_attr_fan2_input.attr,
769 &dev_attr_fan2_div.attr,
770 &dev_attr_fan2_min.attr,
771 &dev_attr_pwm2.attr,
772 &dev_attr_auto_fan2_channel.attr,
773 &dev_attr_temp3_input.attr,
774 &dev_attr_temp3_min.attr,
775 &dev_attr_temp3_max.attr,
776 &dev_attr_temp3_crit.attr,
777 &dev_attr_auto_temp3_off.attr,
778 &dev_attr_auto_temp3_min.attr,
779 &dev_attr_auto_temp3_max.attr,
780 &dev_attr_auto_fan2_min_pwm.attr,
781 NULL
782};
783
784static const struct attribute_group adm1031_group_opt = {
785 .attrs = adm1031_attributes_opt,
786};
787
733/* This function is called by i2c_probe */ 788/* This function is called by i2c_probe */
734static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind) 789static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind)
735{ 790{
@@ -789,57 +844,26 @@ static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind)
789 adm1031_init_client(new_client); 844 adm1031_init_client(new_client);
790 845
791 /* Register sysfs hooks */ 846 /* Register sysfs hooks */
792 data->class_dev = hwmon_device_register(&new_client->dev); 847 if ((err = sysfs_create_group(&new_client->dev.kobj, &adm1031_group)))
793 if (IS_ERR(data->class_dev)) {
794 err = PTR_ERR(data->class_dev);
795 goto exit_detach; 848 goto exit_detach;
796 }
797
798 device_create_file(&new_client->dev, &dev_attr_fan1_input);
799 device_create_file(&new_client->dev, &dev_attr_fan1_div);
800 device_create_file(&new_client->dev, &dev_attr_fan1_min);
801 device_create_file(&new_client->dev, &dev_attr_pwm1);
802 device_create_file(&new_client->dev, &dev_attr_auto_fan1_channel);
803 device_create_file(&new_client->dev, &dev_attr_temp1_input);
804 device_create_file(&new_client->dev, &dev_attr_temp1_min);
805 device_create_file(&new_client->dev, &dev_attr_temp1_max);
806 device_create_file(&new_client->dev, &dev_attr_temp1_crit);
807 device_create_file(&new_client->dev, &dev_attr_temp2_input);
808 device_create_file(&new_client->dev, &dev_attr_temp2_min);
809 device_create_file(&new_client->dev, &dev_attr_temp2_max);
810 device_create_file(&new_client->dev, &dev_attr_temp2_crit);
811
812 device_create_file(&new_client->dev, &dev_attr_auto_temp1_off);
813 device_create_file(&new_client->dev, &dev_attr_auto_temp1_min);
814 device_create_file(&new_client->dev, &dev_attr_auto_temp1_max);
815
816 device_create_file(&new_client->dev, &dev_attr_auto_temp2_off);
817 device_create_file(&new_client->dev, &dev_attr_auto_temp2_min);
818 device_create_file(&new_client->dev, &dev_attr_auto_temp2_max);
819
820 device_create_file(&new_client->dev, &dev_attr_auto_fan1_min_pwm);
821
822 device_create_file(&new_client->dev, &dev_attr_alarms);
823 849
824 if (kind == adm1031) { 850 if (kind == adm1031) {
825 device_create_file(&new_client->dev, &dev_attr_fan2_input); 851 if ((err = sysfs_create_group(&new_client->dev.kobj,
826 device_create_file(&new_client->dev, &dev_attr_fan2_div); 852 &adm1031_group_opt)))
827 device_create_file(&new_client->dev, &dev_attr_fan2_min); 853 goto exit_remove;
828 device_create_file(&new_client->dev, &dev_attr_pwm2); 854 }
829 device_create_file(&new_client->dev, 855
830 &dev_attr_auto_fan2_channel); 856 data->class_dev = hwmon_device_register(&new_client->dev);
831 device_create_file(&new_client->dev, &dev_attr_temp3_input); 857 if (IS_ERR(data->class_dev)) {
832 device_create_file(&new_client->dev, &dev_attr_temp3_min); 858 err = PTR_ERR(data->class_dev);
833 device_create_file(&new_client->dev, &dev_attr_temp3_max); 859 goto exit_remove;
834 device_create_file(&new_client->dev, &dev_attr_temp3_crit);
835 device_create_file(&new_client->dev, &dev_attr_auto_temp3_off);
836 device_create_file(&new_client->dev, &dev_attr_auto_temp3_min);
837 device_create_file(&new_client->dev, &dev_attr_auto_temp3_max);
838 device_create_file(&new_client->dev, &dev_attr_auto_fan2_min_pwm);
839 } 860 }
840 861
841 return 0; 862 return 0;
842 863
864exit_remove:
865 sysfs_remove_group(&new_client->dev.kobj, &adm1031_group);
866 sysfs_remove_group(&new_client->dev.kobj, &adm1031_group_opt);
843exit_detach: 867exit_detach:
844 i2c_detach_client(new_client); 868 i2c_detach_client(new_client);
845exit_free: 869exit_free:
@@ -854,6 +878,8 @@ static int adm1031_detach_client(struct i2c_client *client)
854 int ret; 878 int ret;
855 879
856 hwmon_device_unregister(data->class_dev); 880 hwmon_device_unregister(data->class_dev);
881 sysfs_remove_group(&client->dev.kobj, &adm1031_group);
882 sysfs_remove_group(&client->dev.kobj, &adm1031_group_opt);
857 if ((ret = i2c_detach_client(client)) != 0) { 883 if ((ret = i2c_detach_client(client)) != 0) {
858 return ret; 884 return ret;
859 } 885 }
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
index 43f6991b588c..377961c4a41e 100644
--- a/drivers/hwmon/adm9240.c
+++ b/drivers/hwmon/adm9240.c
@@ -465,6 +465,45 @@ static ssize_t chassis_clear(struct device *dev,
465} 465}
466static DEVICE_ATTR(chassis_clear, S_IWUSR, NULL, chassis_clear); 466static DEVICE_ATTR(chassis_clear, S_IWUSR, NULL, chassis_clear);
467 467
468static struct attribute *adm9240_attributes[] = {
469 &sensor_dev_attr_in0_input.dev_attr.attr,
470 &sensor_dev_attr_in0_min.dev_attr.attr,
471 &sensor_dev_attr_in0_max.dev_attr.attr,
472 &sensor_dev_attr_in1_input.dev_attr.attr,
473 &sensor_dev_attr_in1_min.dev_attr.attr,
474 &sensor_dev_attr_in1_max.dev_attr.attr,
475 &sensor_dev_attr_in2_input.dev_attr.attr,
476 &sensor_dev_attr_in2_min.dev_attr.attr,
477 &sensor_dev_attr_in2_max.dev_attr.attr,
478 &sensor_dev_attr_in3_input.dev_attr.attr,
479 &sensor_dev_attr_in3_min.dev_attr.attr,
480 &sensor_dev_attr_in3_max.dev_attr.attr,
481 &sensor_dev_attr_in4_input.dev_attr.attr,
482 &sensor_dev_attr_in4_min.dev_attr.attr,
483 &sensor_dev_attr_in4_max.dev_attr.attr,
484 &sensor_dev_attr_in5_input.dev_attr.attr,
485 &sensor_dev_attr_in5_min.dev_attr.attr,
486 &sensor_dev_attr_in5_max.dev_attr.attr,
487 &dev_attr_temp1_input.attr,
488 &sensor_dev_attr_temp1_max.dev_attr.attr,
489 &sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
490 &sensor_dev_attr_fan1_input.dev_attr.attr,
491 &sensor_dev_attr_fan1_div.dev_attr.attr,
492 &sensor_dev_attr_fan1_min.dev_attr.attr,
493 &sensor_dev_attr_fan2_input.dev_attr.attr,
494 &sensor_dev_attr_fan2_div.dev_attr.attr,
495 &sensor_dev_attr_fan2_min.dev_attr.attr,
496 &dev_attr_alarms.attr,
497 &dev_attr_aout_output.attr,
498 &dev_attr_chassis_clear.attr,
499 &dev_attr_cpu0_vid.attr,
500 NULL
501};
502
503static const struct attribute_group adm9240_group = {
504 .attrs = adm9240_attributes,
505};
506
468 507
469/*** sensor chip detect and driver install ***/ 508/*** sensor chip detect and driver install ***/
470 509
@@ -548,72 +587,19 @@ static int adm9240_detect(struct i2c_adapter *adapter, int address, int kind)
548 adm9240_init_client(new_client); 587 adm9240_init_client(new_client);
549 588
550 /* populate sysfs filesystem */ 589 /* populate sysfs filesystem */
590 if ((err = sysfs_create_group(&new_client->dev.kobj, &adm9240_group)))
591 goto exit_detach;
592
551 data->class_dev = hwmon_device_register(&new_client->dev); 593 data->class_dev = hwmon_device_register(&new_client->dev);
552 if (IS_ERR(data->class_dev)) { 594 if (IS_ERR(data->class_dev)) {
553 err = PTR_ERR(data->class_dev); 595 err = PTR_ERR(data->class_dev);
554 goto exit_detach; 596 goto exit_remove;
555 } 597 }
556 598
557 device_create_file(&new_client->dev,
558 &sensor_dev_attr_in0_input.dev_attr);
559 device_create_file(&new_client->dev,
560 &sensor_dev_attr_in0_min.dev_attr);
561 device_create_file(&new_client->dev,
562 &sensor_dev_attr_in0_max.dev_attr);
563 device_create_file(&new_client->dev,
564 &sensor_dev_attr_in1_input.dev_attr);
565 device_create_file(&new_client->dev,
566 &sensor_dev_attr_in1_min.dev_attr);
567 device_create_file(&new_client->dev,
568 &sensor_dev_attr_in1_max.dev_attr);
569 device_create_file(&new_client->dev,
570 &sensor_dev_attr_in2_input.dev_attr);
571 device_create_file(&new_client->dev,
572 &sensor_dev_attr_in2_min.dev_attr);
573 device_create_file(&new_client->dev,
574 &sensor_dev_attr_in2_max.dev_attr);
575 device_create_file(&new_client->dev,
576 &sensor_dev_attr_in3_input.dev_attr);
577 device_create_file(&new_client->dev,
578 &sensor_dev_attr_in3_min.dev_attr);
579 device_create_file(&new_client->dev,
580 &sensor_dev_attr_in3_max.dev_attr);
581 device_create_file(&new_client->dev,
582 &sensor_dev_attr_in4_input.dev_attr);
583 device_create_file(&new_client->dev,
584 &sensor_dev_attr_in4_min.dev_attr);
585 device_create_file(&new_client->dev,
586 &sensor_dev_attr_in4_max.dev_attr);
587 device_create_file(&new_client->dev,
588 &sensor_dev_attr_in5_input.dev_attr);
589 device_create_file(&new_client->dev,
590 &sensor_dev_attr_in5_min.dev_attr);
591 device_create_file(&new_client->dev,
592 &sensor_dev_attr_in5_max.dev_attr);
593 device_create_file(&new_client->dev, &dev_attr_temp1_input);
594 device_create_file(&new_client->dev,
595 &sensor_dev_attr_temp1_max.dev_attr);
596 device_create_file(&new_client->dev,
597 &sensor_dev_attr_temp1_max_hyst.dev_attr);
598 device_create_file(&new_client->dev,
599 &sensor_dev_attr_fan1_input.dev_attr);
600 device_create_file(&new_client->dev,
601 &sensor_dev_attr_fan1_div.dev_attr);
602 device_create_file(&new_client->dev,
603 &sensor_dev_attr_fan1_min.dev_attr);
604 device_create_file(&new_client->dev,
605 &sensor_dev_attr_fan2_input.dev_attr);
606 device_create_file(&new_client->dev,
607 &sensor_dev_attr_fan2_div.dev_attr);
608 device_create_file(&new_client->dev,
609 &sensor_dev_attr_fan2_min.dev_attr);
610 device_create_file(&new_client->dev, &dev_attr_alarms);
611 device_create_file(&new_client->dev, &dev_attr_aout_output);
612 device_create_file(&new_client->dev, &dev_attr_chassis_clear);
613 device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
614
615 return 0; 599 return 0;
616 600
601exit_remove:
602 sysfs_remove_group(&new_client->dev.kobj, &adm9240_group);
617exit_detach: 603exit_detach:
618 i2c_detach_client(new_client); 604 i2c_detach_client(new_client);
619exit_free: 605exit_free:
@@ -635,6 +621,7 @@ static int adm9240_detach_client(struct i2c_client *client)
635 int err; 621 int err;
636 622
637 hwmon_device_unregister(data->class_dev); 623 hwmon_device_unregister(data->class_dev);
624 sysfs_remove_group(&client->dev.kobj, &adm9240_group);
638 625
639 if ((err = i2c_detach_client(client))) 626 if ((err = i2c_detach_client(client)))
640 return err; 627 return err;