Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 190797
b: refs/heads/master
c: 0559a53
h: refs/heads/master
i:
  190795: e513b64
v: v3
  • Loading branch information
Henrik Rydberg authored and Jean Delvare committed May 11, 2010
1 parent 727cdc0 commit e27b54a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 37 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d1bf8cf6b911001d50f2079c158cb5dd9782e187
refs/heads/master: 0559a538899d48e7d730affb9df2abb13a7d9008
61 changes: 25 additions & 36 deletions trunk/drivers/hwmon/applesmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ static unsigned int applesmc_accelerometer;
/* Indicates whether this computer has light sensors and keyboard backlight. */
static unsigned int applesmc_light;

/* The number of fans handled by the driver */
static unsigned int fans_handled;

/* Indicates which temperature sensors set to use. */
static unsigned int applesmc_temperature_set;

Expand Down Expand Up @@ -1492,39 +1495,24 @@ static int __init applesmc_init(void)

/* create fan files */
count = applesmc_get_fan_count();
if (count < 0) {
if (count < 0)
printk(KERN_ERR "applesmc: Cannot get the number of fans.\n");
} else {
else
printk(KERN_INFO "applesmc: %d fans found.\n", count);

switch (count) {
default:
printk(KERN_WARNING "applesmc: More than 4 fans found,"
" but at most 4 fans are supported"
" by the driver.\n");
case 4:
ret = sysfs_create_group(&pdev->dev.kobj,
&fan_attribute_groups[3]);
if (ret)
goto out_key_enumeration;
case 3:
ret = sysfs_create_group(&pdev->dev.kobj,
&fan_attribute_groups[2]);
if (ret)
goto out_key_enumeration;
case 2:
ret = sysfs_create_group(&pdev->dev.kobj,
&fan_attribute_groups[1]);
if (ret)
goto out_key_enumeration;
case 1:
ret = sysfs_create_group(&pdev->dev.kobj,
&fan_attribute_groups[0]);
if (ret)
goto out_fan_1;
case 0:
;
}
if (count > 4) {
count = 4;
printk(KERN_WARNING "applesmc: More than 4 fans found,"
" but at most 4 fans are supported"
" by the driver.\n");
}

while (fans_handled < count) {
ret = sysfs_create_group(&pdev->dev.kobj,
&fan_attribute_groups[fans_handled]);
if (ret)
goto out_fans;
fans_handled++;
}

for (i = 0;
Expand Down Expand Up @@ -1593,10 +1581,10 @@ static int __init applesmc_init(void)
applesmc_release_accelerometer();
out_temperature:
sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group);
sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]);
out_fan_1:
sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]);
out_key_enumeration:
out_fans:
while (fans_handled)
sysfs_remove_group(&pdev->dev.kobj,
&fan_attribute_groups[--fans_handled]);
sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
out_name:
sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
Expand All @@ -1622,8 +1610,9 @@ static void __exit applesmc_exit(void)
if (applesmc_accelerometer)
applesmc_release_accelerometer();
sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group);
sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]);
sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]);
while (fans_handled)
sysfs_remove_group(&pdev->dev.kobj,
&fan_attribute_groups[--fans_handled]);
sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
platform_device_unregister(pdev);
Expand Down

0 comments on commit e27b54a

Please sign in to comment.