diff options
author | Corentin Chary <corentin.chary@gmail.com> | 2011-07-01 05:34:26 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2011-08-05 14:45:47 -0400 |
commit | 49979d091d1847823c064301da1ec173619ddd92 (patch) | |
tree | f33e8965f229d17c9179d6da7cb7992f993e652c /drivers | |
parent | a4ecbb8ae7be16497db2f984ee7a3ffec0f164c3 (diff) |
asus-wmi: fix hwmon/pwm1
The code was completly broken, and should never had been sent
to the kernel. That's what happens when you write code without
hardware to test it.
Cc: stable@kernel.org
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 65b66aa44c78..bcb9fb41ddc4 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
@@ -797,8 +797,8 @@ exit: | |||
797 | * Hwmon device | 797 | * Hwmon device |
798 | */ | 798 | */ |
799 | static ssize_t asus_hwmon_pwm1(struct device *dev, | 799 | static ssize_t asus_hwmon_pwm1(struct device *dev, |
800 | struct device_attribute *attr, | 800 | struct device_attribute *attr, |
801 | char *buf) | 801 | char *buf) |
802 | { | 802 | { |
803 | struct asus_wmi *asus = dev_get_drvdata(dev); | 803 | struct asus_wmi *asus = dev_get_drvdata(dev); |
804 | u32 value; | 804 | u32 value; |
@@ -809,7 +809,7 @@ static ssize_t asus_hwmon_pwm1(struct device *dev, | |||
809 | if (err < 0) | 809 | if (err < 0) |
810 | return err; | 810 | return err; |
811 | 811 | ||
812 | value |= 0xFF; | 812 | value &= 0xFF; |
813 | 813 | ||
814 | if (value == 1) /* Low Speed */ | 814 | if (value == 1) /* Low Speed */ |
815 | value = 85; | 815 | value = 85; |
@@ -869,7 +869,7 @@ static mode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj, | |||
869 | * - reverved bits are non-zero | 869 | * - reverved bits are non-zero |
870 | * - sfun and presence bit are not set | 870 | * - sfun and presence bit are not set |
871 | */ | 871 | */ |
872 | if (value != ASUS_WMI_UNSUPPORTED_METHOD || value & 0xFFF80000 | 872 | if (value == ASUS_WMI_UNSUPPORTED_METHOD || value & 0xFFF80000 |
873 | || (!asus->sfun && !(value & ASUS_WMI_DSTS_PRESENCE_BIT))) | 873 | || (!asus->sfun && !(value & ASUS_WMI_DSTS_PRESENCE_BIT))) |
874 | ok = false; | 874 | ok = false; |
875 | } | 875 | } |
@@ -904,6 +904,7 @@ static int asus_wmi_hwmon_init(struct asus_wmi *asus) | |||
904 | pr_err("Could not register asus hwmon device\n"); | 904 | pr_err("Could not register asus hwmon device\n"); |
905 | return PTR_ERR(hwmon); | 905 | return PTR_ERR(hwmon); |
906 | } | 906 | } |
907 | dev_set_drvdata(hwmon, asus); | ||
907 | asus->hwmon_device = hwmon; | 908 | asus->hwmon_device = hwmon; |
908 | result = sysfs_create_group(&hwmon->kobj, &hwmon_attribute_group); | 909 | result = sysfs_create_group(&hwmon->kobj, &hwmon_attribute_group); |
909 | if (result) | 910 | if (result) |