From 9cf0f8e5b28d3c9b53eea70a8ed7aede6500c4d6 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Tue, 4 May 2010 22:08:20 +0200 Subject: Update applesmc to kernel version 2.6.34-rc6+pending This patch makes applesmc.c equal to the 2.6.34-rc6 tree plus bugfixes and pending changes for SMC labels added. Signed-off-by: Henrik Rydberg --- Makefile | 2 +- debian/changelog | 6 ++++ debian/postinst | 2 +- debian/postrm | 2 +- debian/prerm | 2 +- debian/rules | 2 +- usr/src/dkms_source_tree/applesmc.c | 68 ++++++++++++++++--------------------- usr/src/dkms_source_tree/dkms.conf | 2 +- 8 files changed, 42 insertions(+), 44 deletions(-) diff --git a/Makefile b/Makefile index 04eed92..510f89f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ NAME = applesmc -VERSION = 0.16.0 +VERSION = 0.16.1 SRC = usr/src TARBALL = $(NAME)-$(VERSION).dkms.tar.gz diff --git a/debian/changelog b/debian/changelog index 6354545..6d5aa9a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +applesmc-dkms (0.16.1) unstable; urgency=low + + * Update applesmc to kernel version 2.6.34-rc6+pending + + -- Henrik Rydberg Tue, 04 May 2010 15:34:25 +0200 + applesmc-dkms (0.16.0) unstable; urgency=low * Add names for temperature sensors to sysfs diff --git a/debian/postinst b/debian/postinst index 284cb05..518057c 100644 --- a/debian/postinst +++ b/debian/postinst @@ -3,7 +3,7 @@ set -e NAME=applesmc -VERSION=0.16.0 +VERSION=0.16.1 case "$1" in configure) diff --git a/debian/postrm b/debian/postrm index f3fdfa8..b4c3194 100644 --- a/debian/postrm +++ b/debian/postrm @@ -1,7 +1,7 @@ #!/bin/sh NAME=applesmc -VERSION=0.16.0 +VERSION=0.16.1 set -e diff --git a/debian/prerm b/debian/prerm index 289774d..1015550 100644 --- a/debian/prerm +++ b/debian/prerm @@ -1,7 +1,7 @@ #!/bin/sh NAME=applesmc -VERSION=0.16.0 +VERSION=0.16.1 set -e diff --git a/debian/rules b/debian/rules index cb78873..eab2f2e 100755 --- a/debian/rules +++ b/debian/rules @@ -5,7 +5,7 @@ #export DH_VERBOSE=1 NAME=applesmc -VERSION=0.16.0 +VERSION=0.16.1 configure: configure-stamp configure-stamp: diff --git a/usr/src/dkms_source_tree/applesmc.c b/usr/src/dkms_source_tree/applesmc.c index 7af6fe0..b6598aa 100644 --- a/usr/src/dkms_source_tree/applesmc.c +++ b/usr/src/dkms_source_tree/applesmc.c @@ -209,6 +209,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; @@ -1387,8 +1390,9 @@ static struct attribute *temperature_attributes[] = { static const struct attribute_group temperature_attributes_group = { .attrs = temperature_attributes }; -static const struct attribute_group label_attributes_group = - { .attrs = label_attributes }; +static const struct attribute_group label_attributes_group = { + .attrs = label_attributes +}; /* Module stuff */ @@ -1668,39 +1672,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; @@ -1717,6 +1706,8 @@ static int __init applesmc_init(void) } ret = sysfs_create_file(&pdev->dev.kobj, temperature_attributes[i]); + if (ret) + goto out_temperature; ret = sysfs_create_file(&pdev->dev.kobj, label_attributes[i]); if (ret) @@ -1773,10 +1764,10 @@ out_accelerometer: out_temperature: sysfs_remove_group(&pdev->dev.kobj, &label_attributes_group); 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); @@ -1803,8 +1794,9 @@ static void __exit applesmc_exit(void) applesmc_release_accelerometer(); sysfs_remove_group(&pdev->dev.kobj, &label_attributes_group); 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); diff --git a/usr/src/dkms_source_tree/dkms.conf b/usr/src/dkms_source_tree/dkms.conf index 141298a..0e3b9fe 100644 --- a/usr/src/dkms_source_tree/dkms.conf +++ b/usr/src/dkms_source_tree/dkms.conf @@ -1,5 +1,5 @@ NAME=applesmc -VERSION=0.16.0 +VERSION=0.16.1 PACKAGE_NAME="$NAME" PACKAGE_VERSION="$VERSION" MAKE[0]="make -C ${kernel_source_dir} -- cgit v1.2.3