- 15 Jul, 2017 1 commit
-
-
Guenter Roeck authored
gcc 7.1 complains that the driver uses sprintf() and thus does not validate the length of output buffers. drivers/hwmon/applesmc.c: In function 'applesmc_show_fan_position': drivers/hwmon/applesmc.c:82:21: warning: '%d' directive writing between 1 and 5 bytes into a region of size 4 Fix the problem by using scnprintf() instead of sprintf() throughout the driver. Also explicitly limit the number of supported fans to avoid actual buffer overruns and thus invalid keys. Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
- 16 Nov, 2015 1 commit
-
-
Shuah Khan authored
Fix the following "maybe used uninitialized" warnings by initializing the variables to keep the compiler quiet. There is no "used uninitialized" in this case. CC [M] drivers/hwmon/applesmc.o drivers/hwmon/applesmc.c: In function ‘applesmc_init_smcreg’: drivers/hwmon/applesmc.c:595:43: warning: ‘right_light_sensor’ may be used uninitialized in this function [-Wmaybe-uninitialized] s->num_light_sensors = left_light_sensor + right_light_sensor; ^ drivers/hwmon/applesmc.c:540:26: note: ‘right_light_sensor’ was declared here bool left_light_sensor, right_light_sensor; ^ drivers/hwmon/applesmc.c:595:43: warning: ‘left_light_sensor’ may be used uninitialized in this function [-Wmaybe-uninitialized] s->num_light_sensors = left_light_sensor + right_light_sensor; ^ drivers/hwmon/applesmc.c:540:7: note: ‘left_light_sensor’ was declared here bool left_light_sensor, right_light_sensor; ^ Signed-off-by:
Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
- 29 Sep, 2015 1 commit
-
-
Bastien Nocera authored
s/ressources/resources/ Signed-off-by:
Bastien Nocera <hadess@hadess.net> Signed-off-by:
Jiri Kosina <jkosina@suse.cz>
-
- 20 Oct, 2014 1 commit
-
-
Wolfram Sang authored
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- 09 Oct, 2013 1 commit
-
-
Henrik Rydberg authored
The crash reported and investigated in commit 5f4513 turned out to be caused by a change to the read interface on newer (2012) SMCs. Tests by Chris show that simply reading the data valid line is enough for the problem to go away. Additional tests show that the newer SMCs no longer wait for the number of requested bytes, but start sending data right away. Apparently the number of bytes to read is no longer specified as before, but instead found out by reading until end of data. Failure to read until end of data confuses the state machine, which eventually causes the crash. As a remedy, assuming bit0 is the read valid line, make sure there is nothing more to read before leaving the read function. Tested to resolve the original problem, and runtested on MBA3,1, MBP4,1, MBP8,2, MBP10,1, MBP10,2. The patch seems to have no effect on machines before 2012. Tested-by:
Chris Murphy <chris@cmurf.com> Cc: stable@vger.kernel.org Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
- 26 Sep, 2013 1 commit
-
-
Henrik Rydberg authored
After reports from Chris and Josh Boyer of a rare crash in applesmc, Guenter pointed at the initialization problem fixed below. The patch has not been verified to fix the crash, but should be applied regardless. Reported-by: <jwboyer@fedoraproject.org> Suggested-by:
Guenter Roeck <linux@roeck-us.net> Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Cc: stable@vger.kernel.org Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
- 08 Apr, 2013 1 commit
-
-
Guenter Roeck authored
Cc: Hans de Goede <hdegoede@redhat.com> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Henrik Rydberg <rydberg@euromail.se> Acked-by:
Alistair John Strachan <alistair@devzero.co.uk> Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
- 10 Oct, 2012 1 commit
-
-
Jean Delvare authored
These drivers use IS_ERR so they should include <linux/err.h>. Signed-off-by:
Jean Delvare <khali@linux-fr.org> Acked-by:
Guenter Roeck <linux@roeck-us.net> Acked-by:
Luca Tettamanti <kronos.it@gmail.com> Cc: Henrik Rydberg <rydberg@euromail.se>
-
- 18 Sep, 2012 1 commit
-
-
Parag Warudkar authored
A heavy-load test on a MacBookPro6,1 is still showing a substantial amount of read errors. Increasing the maximum wait time to 128 ms resolves the issue. Signed-off-by:
Parag Warudkar <parag.lkml@gmail.com> Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
- 27 Jul, 2012 1 commit
-
-
Henrik Rydberg authored
The behavior of the SMC has changed several times over the years, causing read failures in the driver. It seems the problem can be explained by a shift in SMC speed combined with improper action on status codes. We should first wait for the SMC to settle, which was the most frequent response on the old slow machines. Then, if the SMC is busy, we need to try again later by resending the command. This was the most likely response until 2012. Now, with a shorter wait time, we are again most likely to poll while the SMC is settling, and as a result we see high failure rates on many old and new models. With the distinction between busy and failure, we can also wait longer before retrying, without sacrificing speed. This seems to bring failures down to virtually zero on all models. Tested on: MBA1,1 MBA3,1 MBA5,1 MBA5,2 MBP9,2 Tested-by:
Adam Somerville <adamsomerville@gmail.com> Tested-by:
Hubert Eichner <hubert.georg.eichner@gmail.com> Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
- 22 Jul, 2012 4 commits
-
-
Henrik Rydberg authored
Not all sensors in the T range are useful temperatures. This patch creates a subset of sensors to be exported to userland, excluding the unknown types. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
Henrik Rydberg authored
There are many userland reports of sensors with unreasonably small and large temperatures. There seem to be several reasons for this: Firstly, the major sensor type (sp78) is actually a signed number. This explains why some sensors show very small or large values - they are in fact all small, but of different sign. Secondly, the other sensor type (1-hex) is not properly understood; it may be that it is not a temperature after all. Thirdly, some sensors are differential in nature, showing changes over time rather than absolute numbers. This explains why those values are small and of varying sign. This patch interprets the sp78 type as signed short, but keeps the original scaling. For other types, -EINVAL is returned, since the nature of those sensors is unknown. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
Henrik Rydberg authored
The 2012 series of MacBooks have a faster SMC, and the current driver timings do not work at all. Tests show that decreasing the minimum wait time, from 64 us to 16 us, works well. Since this is still larger than the original minimum of 10 us used before 2008, there is nothing inherently problematic with changing it. The fail frequency on older machines seems to increase slightly, but not enough to be noticeable. Tested on MBA11, MBA31, MBA5,2, MBP9,2. The patch was originally written by adamski99 (ubuntuforums.org) and later tested by janhouse (bbs.archlinux.org). Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
Henrik Rydberg authored
The special motion sensor mapping is unnecessary; remove it. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
- 25 Jun, 2012 1 commit
-
-
Jesper Juhl authored
I've not had a gmail address for years. This commit updates the address to my actual working one. Signed-off-by:
Jesper Juhl <jj@chaosbits.net> Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
- 18 Jun, 2012 1 commit
-
-
Henrik Rydberg authored
Key lookups may call read_smc() with a fixed-length key string, and if the lookup fails, trailing stack content may appear in the kernel log. Fixed with this patch. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Cc: stable@vger.kernel.org Signed-off-by:
Guenter Roeck <linux@roeck-us.net>
-
- 19 Mar, 2012 2 commits
-
-
Henrik Rydberg authored
Some error paths do not set a result, leading to the (false) assumption that the value may be used uninitialized. Set results for those paths as well. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
Guenter Roeck authored
Cc: Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <linux@roeck-us.net> Acked-by:
Henrik Rydberg <rydberg@euromail.se>
-
- 05 Jan, 2012 1 commit
-
-
Frans Meulenbroeks authored
replaced strict_strtol with kstrtol and replaced strict_strtuol with kstrtuol This satisfies checkpatch -f Compile tested only: no warnings or errors given Signed-off-by:
Frans Meulenbroeks <fransmeulenbroeks@gmail.com> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
- 23 Jan, 2011 1 commit
-
-
Henrik Rydberg authored
The switch to dynamically allocated sysfs attributes left the internal lockdep members uninitialized, causing a formal bug. This patch adds sysfs_attr_init() to the node creation function, remedying the problem. Reported-and-tested-by:
Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
- 08 Jan, 2011 12 commits
-
-
Guenter Roeck authored
This patch fixes all checkpatch errors and most of the checkpatch warnings. It also fixes the range check in applesmc_store_fan_speed(). Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com> Acked-by:
Henrik Rydberg <rydberg@euromail.se>
-
Henrik Rydberg authored
With the preceding patches, git blame assigns about half of the file to the present author. Add a line to the copyright to reflect this. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
Henrik Rydberg authored
Make the driver report a single line on success. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
Henrik Rydberg authored
Given the dynamic node construction method, the setup of the accelerometer, light sensor and keyboard backlight sysfs nodes can be simplified. This patch does not contain any logic changes. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
Henrik Rydberg authored
With the dynamic temperature group in place, the setup of fans can be simplified. This patch sets up the fans dynamically, removing a hundred lines of code. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
Henrik Rydberg authored
With temperature keys being determined automatically, the dmi match data is only used to assign features that can easily be detected from the smc. This patch removes the dmi match data altogether, and reduces the match table to the main machine models. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
Henrik Rydberg authored
The recent Macbooks have temperature registers of a new type. This patch adds the logic to handle them. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
Henrik Rydberg authored
The current driver creates temperature files based on a list of temperature keys given per device. Apart from slow adaption to new machine models, the number of sensors also depends on the number of processors. This patch looks up the temperature keys dynamically, thereby supporting all models. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
Henrik Rydberg authored
One main problem with the current driver is the inability to quickly search for supported keys, resulting in detailed feature maps per machine model which are cumbersome to maintain. This patch adds a register lookup table, which enables binary search for supported keys. The lookup also reduces the io frequency, so the original mutex is replaced by locks around the actual io. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> [guenter.roeck@ericsson.com: Added value range check to key_at_index_store()] Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
Joe Perches authored
Added #define pr_fmt KBUILD_MODNAME ": " fmt Converted printks to pr_<level> Coalesced any long formats Removed prefixes from formats Signed-off-by:
Joe Perches <joe@perches.com> Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
Henrik Rydberg authored
The device init is used to reset the accelerometer. Failure to reset is not severe enough to stop loading the module or to resume from hibernation. This patch relaxes failure to a warning and drops output in case of success. Cc: stable@kernel.org Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
Edgar Hucek authored
This patch add support for the MacBookAir3,1 and MacBookAir3,2 to the applesmc driver. [rydberg@euromail.se: minor cleanup] Cc: stable@kernel.org Signed-off-by:
Edgar Hucek <gimli@dark-green.com> Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Guenter Roeck <guenter.roeck@ericsson.com>
-
- 27 May, 2010 4 commits
-
-
Alex Murray authored
The Apple SMC uses a systematic labeling scheme for the hardware temperature sensors. This scheme is currently hidden from userland. Since the sensor set, and consequently the numbering, differs between models, an extensive database of configurations is required for an application such as fan control. This patch adds the SMC labels to the hwmon sysfs interface, allowing applications to use the sensors more intelligibly. [rydberg@euromail.se: fixed error handling] Signed-off-by:
Alex Murray <murray.alex@gmail.com> Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Jean Delvare <khali@linux-fr.org>
-
Henrik Rydberg authored
This patch adds generic support for the MacBook Pro 7 family based on the 7,1 model. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Jean Delvare <khali@linux-fr.org>
-
Bernhard Froemel authored
This patch adds generic support for the MacBook Pro 6 family based on the 6,2 model. [rydberg@euromail.se: patch cleanup] Signed-off-by:
Bernhard Froemel <froemel@vmars.tuwien.ac.at> Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Jean Delvare <khali@linux-fr.org>
-
Henrik Rydberg authored
The MacBookPro 5,3 model has two fans, whereas the 5,4 model has only one. This patch adds explicit support for the 5,3 and 5,4 models. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Jean Delvare <khali@linux-fr.org>
-
- 11 May, 2010 1 commit
-
-
Henrik Rydberg authored
The current code will not remove the sysfs files for fan numbers three and up. Also, upon exit, fans one and two are removed regardless of their existence. This patch cleans up the sysfs error handling for the fans. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Signed-off-by:
Jean Delvare <khali@linux-fr.org>
-
- 14 Apr, 2010 1 commit
-
-
Justin P. Mattock authored
Add the iMac9,1 and the MacBookPro2,2 temperature sensors to hwmon driver applesmc to fix kernel bug #14429: https://bugzilla.kernel.org/show_bug.cgi?id=14429 Signed-off-by:
Justin P. Mattock <justinmattock@gmail.com> Acked-by:
Nicolas Boichat <nicolas@boichat.ch> Signed-off-by:
Jean Delvare <khali@linux-fr.org>
-
- 15 Dec, 2009 1 commit
-
-
Alexey Dobriyan authored
Signed-off-by:
Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- 22 Sep, 2009 1 commit
-
-
Henrik Rydberg authored
On resume from suspend, the driver currently resets the logical state as if it was brought up from halt. This patch uses the dev_pm_ops.resume/restore methods to synchronize the hardware with the memorized logical state, in effect bringing back the accelerometer and backlight to the state prior to suspend. Works for both suspend to ram and hibernation. The patch has zero effect on the running state. Signed-off-by:
Henrik Rydberg <rydberg@euromail.se> Cc: Nicolas Boichat <nicolas@boichat.ch> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-