summaryrefslogtreecommitdiffstats
path: root/drivers/platform
Commit message (Collapse)AuthorAgeFilesLines
...
| * toshiba_acpi: Move hotkey enabling code to its own functionAzael Avalos2014-12-031-13/+27
| | | | | | | | | | | | | | | | | | | | | | The hotkey enabling code is being used by *_setup_keyboard and also by *_resume. This patch creates a new function called toshiba_acpi_enable_hotkeys to be used by these two functions to avoid duplicating code. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * dell-wmi: Don't report keypresses on keybord illumination changeGabriele Mazzotta2014-12-031-3/+8
| | | | | | | | | | | | | | | | Keyboard illumination level changes are performed by the BIOS, so no events should be reported on keypress. This is already done on systems using the legacy keymap, do it also for systems that don't use it. Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
| * dell-wmi: Don't report keypresses for radio state changesGabriele Mazzotta2014-12-031-4/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | The WMI events associated to KEY_WLAN are for all the radio devices available. Use KEY_RFKILL instead since it's more appropriate. The state of radio devices is changed directly by the BIOS when hotkeys are pressed, so no events should be reported. Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Merged two patches modifying this one line Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * hp_wireless: Inform the user if hp_wireless_input_setup()/add() failsGiedrius Statkevicius2014-12-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | In hpwl_add() there is a unused variable err to which we assign the result of hp_wireless_input_setup() but we don't do anything depending on the result so print out a message that informs the user if add() (hp_wireless_input_setup()) fails since acpi_device_probe() doesn't print anything in this case. Signed-off-by: Giedrius Statkevicius <giedriuswork@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * toshiba-acpi: Add missing ID (TOS6207)Ondrej Zary2014-12-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | toshiba-acpi was always missing TOS6207 ID so it did not load automatically on some laptops (such as Portege R100). But it worked fine if loaded manually. Commit 135740de7764 ("toshiba_acpi: Convert to use acpi_driver") broke that and the driver does not work even when loaded manually since then. Add TOS6207 ID to fix it. Tested on Toshiba Portege R100. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * Sony-laptop: Deletion of an unnecessary check before the function call ↵Markus Elfring2014-12-031-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | "pci_dev_put" The pci_dev_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * platform: x86: Deletion of checks before backlight_device_unregister()Markus Elfring2014-12-039-20/+10Star
| | | | | | | | | | | | | | | | | | | | | | | | The backlight_device_unregister() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> For msi-wmi.c: Acked-by: Anisse Astier <anisse@astier.eu> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * toshiba_acpi: Fix regression caused by backlight extra check codeAzael Avalos2014-12-031-17/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | Bug 86521 uncovered that some TOS6208 devices also return non zero values on a write call to the backlight method, thus getting caught and bailed out by the extra check code. This patch changes the set_lcd_brightness function to its "original" state by just adapting it to the new function format. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * asus-nb-wmi: Add another wapf=4 quirkHans de Goede2014-12-031-0/+9
| | | | | | | | | | | | | | | | | | | | Wifi on this laptop does not work unless asus-nb-wmi.wapf=4 is specified on the kerne commandline, add a quirk for this. Cc: stable@vger.kernel.org BugLink: https://bugs.launchpad.net/bugs/1173681 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * hp_accel: Add support for HP ZBook 15Dominique Leuenberger2014-12-031-0/+1
| | | | | | | | | | | | | | | | | | | | HP ZBook 15 laptop needs a non-standard mapping (x_inverted). BugLink: http://bugzilla.opensuse.org/show_bug.cgi?id=905329 Signed-off-by: Dominique Leuenberger <dimstar@opensuse.org> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * dell-wmi: Update code for processing WMI eventsPali Rohár2014-11-191-31/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The WMI buffer can contain multiple events. First value in buffer is length of event followed by data of specified length. After that is next length and next data. When length is zero then there is no more events in bufffer. This patch adds support for processing all events in buffer (not only first) and parse more event types (not only hotkey events). Because of variable length of events sometimes BIOS fills more hotkeys (or other values) into single WMI event. In this case this patch also processes these multiple hotkeys (and not only first one). Some event types are just ignored because kernel is not interested in them (e.g. NIC Link status, battery unplug, ...). This patch is based on DSDT table from Dell Latitude E6440. Code should be backward compatible so will process other events of old types same as before this patch. This patch also fixes a problem with unknown WMI event messages being written to the log. Now all known events are parsed and those which are not interesting to the kernel are dropped without an unknown WMI event message. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: clean up control flow in eeepc_acpi_notifyFrans Klaver2014-11-191-27/+26Star
| | | | | | | | | | | | | | | | | | | | | | eeepc_acpi_notify increases the indentation level to a whopping four. If we revise the conditions a bit, we can reduce that to a more soothing two and satisfy the indentation guidelines in Documentation/CodingStyle. Remove an unwanted space while we're in the neighbourhood. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * intel_ips: fix a comment typoChen Hanxiao2014-11-191-1/+1
| | | | | | | | | | | | | | s/tempurature/temperature/ Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: don't assume get_acpi succeedsFrans Klaver2014-11-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | In eeepc_hotk_thaw, we assume that get_acpi() will effectively return a bool. However, it is possible that get_acpi() returns an error instead. We should not be writing error values to the ACPI device, even though it's quite possible that we couldn't contact the ACPI device in the first place. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: document fan_pwm conversionsFrans Klaver2014-11-191-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | eeepc_get_fan_pwm and eeepc_set_fan_pwm convert the PWM value read from the fan to a range lmsensors understands. Unfortunately this is only clear if you are familiar with how lmsensors handles duty cycles. Introduce two conversion functions that document the goal of these conversions. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: replace magic numbers with definesFrans Klaver2014-11-191-6/+10
| | | | | | | | | | | | | | | | | | eeepc_[gs]et_fan_ctrl uses some magic numbers. These numbers mean something more than just the number. Describe them with macros instead of comments in one of the functions. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: define rfkill notifier nodes only onceFrans Klaver2014-11-191-9/+13
| | | | | | | | | | | | | | | | | | The rfkill notifier node names are used in three different places. As a matter of style, it is better to store them somewhere and have the compiler warn us about typos in the function arguments. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: don't break user visible stringsFrans Klaver2014-11-191-10/+7Star
| | | | | | | | | | | | | | | | As per Documentation/CodingStyle ch. 2, it is preferred that we don't break user visible strings, in order to allow users to grep for them. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: flatten control flowFrans Klaver2014-11-191-44/+45
| | | | | | | | | | | | | | | | | | | | | | In eeepc_rfkill_hotplug there's an if statement with a big tail that ends right before the out_unlock label. We might as well invert the condition and jump to out_unlock in that case, pretty much like the rest of the code does. This removes an indentation level for a large chunk of code and also stops suggesting there might be an else clause. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * drivers: platform: change 0x20 to I8042_STR_AUXDATA in i8042 filtersGiedrius Statkevičius2014-11-193-3/+3
| | | | | | | | | | | | | | | | | | | | | | Instead of using a magic constant 0x20 in some drivers to get data only from the KBC port we should use the constant defined in i8042.h with the same value. Also, this makes these drivers uniform with what constant the only other filter function uses in drivers/input/misc/ideapad_slidebar.c. Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* | Merge tag 'driver-core-3.19-rc1' of ↵Linus Torvalds2014-12-1523-24/+0Star
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core update from Greg KH: "Here's the set of driver core patches for 3.19-rc1. They are dominated by the removal of the .owner field in platform drivers. They touch a lot of files, but they are "simple" changes, just removing a line in a structure. Other than that, a few minor driver core and debugfs changes. There are some ath9k patches coming in through this tree that have been acked by the wireless maintainers as they relied on the debugfs changes. Everything has been in linux-next for a while" * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits) Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries" fs: debugfs: add forward declaration for struct device type firmware class: Deletion of an unnecessary check before the function call "vunmap" firmware loader: fix hung task warning dump devcoredump: provide a one-way disable function device: Add dev_<level>_once variants ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries ath: use seq_file api for ath9k debugfs files debugfs: add helper function to create device related seq_file drivers/base: cacheinfo: remove noisy error boot message Revert "core: platform: add warning if driver has no owner" drivers: base: support cpu cache information interface to userspace via sysfs drivers: base: add cpu_device_create to support per-cpu devices topology: replace custom attribute macros with standard DEVICE_ATTR* cpumask: factor out show_cpumap into separate helper function driver core: Fix unbalanced device reference in drivers_probe driver core: fix race with userland in device_add() sysfs/kernfs: make read requests on pre-alloc files use the buffer. sysfs/kernfs: allow attributes to request write buffer be pre-allocated. fs: sysfs: return EGBIG on write if offset is larger than file size ...
| * | platform: x86: drop owner assignment from platform_driversWolfram Sang2014-10-2022-23/+0Star
| | | | | | | | | | | | | | | | | | | | | 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>
| * | platform: chrome: drop owner assignment from platform_driversWolfram Sang2014-10-201-1/+0Star
| | | | | | | | | | | | | | | | | | | | | 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>
* | | intel_ips: fix a type in error messageMasatake YAMATO2014-11-201-1/+1
| |/ |/| | | | | | | Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | platform: hp_accel: Add SERIO_I8042 as a dependency since it now includes ↵Giedrius Statkevicius2014-11-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | i8042.h/serio.h Make hp_accel dependent on SERIO_I8042 in the Kconfig because since commit a4c724d0723b078e4ab4670e557cda1795036a7a ('platform: hp_accel: add a i8042 filter to remove HPQ6000 data from kb bus stream') hp_accel includes i8042.h and serio.h. Reported-by: Jim Davis <jim.epost@gmail.com> Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* | platform: hp_accel: add a i8042 filter to remove HPQ6000 data from kb bus streamGiedrius Statkevicius2014-11-071-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a i8042 filter to hp_accel to remove accelerometer's data with acpi id HPQ6000 from keyboard bus stream. The codes sent by accelerometer are e0 25, e0 26, e0 27 and e0 28. The relevant information is already passed through /dev/freefall so no need to send these undocumented weird signals through the keyboard bus. Also, unclogs `dmesg` because atkbd complained about weird scan codes, saves processing power and disk space. Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Éric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* | quirk for Lenovo Yoga 3: no rfkill switchStephan Mueller2014-10-281-0/+7
| | | | | | | | | | | | | | | | The Yoga 3 does not contain any physical rfkill switch. Therefore disable the rfkill switch identically to the Yoga 2 approach. Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* | acer-wmi: Add acpi_backlight=video quirk for the Acer KAV80Hans de Goede2014-10-281-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The acpi-video backlight interface on the Acer KAV80 is broken, and worse it causes the entire machine to slow down significantly after a suspend/resume. Blacklist it, and use the acer-wmi backlight interface instead. Note that the KAV80 is somewhat unique in that it is the only Acer model where we fall back to acer-wmi after blacklisting, rather then using the native (e.g. intel) backlight driver. This is done because there is no native backlight interface on this model. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1128309 Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* | samsung-laptop: Add broken-acpi-video quirk for NC210/NC110Hans de Goede2014-10-281-0/+10
| | | | | | | | | | | | | | | | | | | | The acpi-video backlight interface on the NC210 does not work, blacklist it and use the samsung-laptop interface instead. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=861573 Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* | asus-nb-wmi: Add wapf4 quirk for the X550VBStanislaw Gruszka2014-10-281-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | X550VB as many others Asus laptops need wapf4 quirk to make RFKILL switch be functional. Otherwise system boots with wireless card disabled and is only possible to enable it by suspend/resume. Bug report: http://bugzilla.redhat.com/show_bug.cgi?id=1089731#c23 Reported-and-tested-by: Vratislav Podzimek <vpodzime@redhat.com> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* | toshiba_acpi: Add Toshiba TECRA A50-A to the alt keymap dmi listAaron Lu2014-10-281-0/+6
|/ | | | | | | | | | | | As bug #72551, the Toshiba TECRA A50-A series models also come with the new keymap layout as found out by Azael Avalos, so add it to the dmi table. Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=76971 Reported-and-tested-by: Blindekinder <rafael.raccuia@blindekinder.com> Cc: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* thinkpad_acpi: replace strnicmp with strncasecmpRasmus Villemoes2014-10-141-2/+2
| | | | | | | | | | | | | | | | | | The kernel used to contain two functions for length-delimited, case-insensitive string comparison, strnicmp with correct semantics and a slightly buggy strncasecmp. The latter is the POSIX name, so strnicmp was renamed to strncasecmp, and strnicmp made into a wrapper for the new strncasecmp to avoid breaking existing users. To allow the compat wrapper strnicmp to be removed at some point in the future, and to avoid the extra indirection cost, do s/strnicmp/strncasecmp/g. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br> Cc: Darren Hart <dvhart@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge tag 'platform-drivers-x86-v3.18-1' of ↵Linus Torvalds2014-10-125-369/+522
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.infradead.org/users/dvhart/linux-platform-drivers-x86 Pull x86 platform driver updates from Darren Hart: "The following have all spent at least a few days in linux-next, most for more than a week. These are mostly cleanups and error handling improvements with a few updates to extend existing support to newer hardware. Details: - dell-wmi: fix access out of memory - eeepc-laptop: cleanups, refactoring, sysfs perms, and improved error handling - intel-rst: ACPI and error handling cleanups - thinkpad-acpi: whitespace cleanup - toshiba_acpi: HCI/SCI interface update, keyboard backlight type 2 support, new scancodes, cleanups" * tag 'platform-drivers-x86-v3.18-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86: (23 commits) toshiba_acpi: Adapt kbd_bl_timeout_store to the new kbd type toshiba_acpi: Change HCI/SCI functions return code type toshiba_acpi: Unify return codes prefix from HCI/SCI to TOS toshiba_acpi: Rename hci_raw to tci_raw dell-wmi: Fix access out of memory eeepc-laptop: clean up control flow in *_rfkill_notifier eeepc-laptop: store_cpufv: return error if set_acpi fails eeepc-laptop: check proper return values in get_cpufv eeepc-laptop: make fan1_input really read-only eeepc-laptop: pull out SENSOR_STORE_FUNC and SENSOR_SHOW_FUNC macros eeepc-laptop: tell sysfs that the disp attribute is write-only eeepc-laptop: pull out ACPI_STORE_FUNC and ACPI_SHOW_FUNC macros eeepc-laptop: use DEVICE_ATTR* to instantiate device_attributes eeepc-laptop: change sysfs function names to API expectations eeepc-laptop: clean up coding style eeepc-laptop: simplify parse_arg() intel-rst: Clean up ACPI add function intel-rst: Use ACPI_FAILURE() macro instead !ACPI_SUCCESS() for error checking x86: thinkpad_acpi.c: fixed spacing coding style issue toshiba_acpi: Support new keyboard backlight type ...
| * toshiba_acpi: Adapt kbd_bl_timeout_store to the new kbd typeAzael Avalos2014-10-071-9/+29
| | | | | | | | | | | | | | | | | | | | | | | | With the introduction of the new keyboard backlight implementation, the *_timeout_store function is broken, as it only supports the first kbd_type. This patch adapts such function for the new kbd_type, as well as converts from using sscanf to kstrtoint. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * toshiba_acpi: Change HCI/SCI functions return code typeAzael Avalos2014-09-301-67/+62Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the HCI/SCI read/write functions are returning the status of the ACPI call and also assigning the returned value of the HCI/SCI function, however, only the HCI/SCI status is being checked. This patch changes such functions, returning the value of the HCI/SCI function instead of the ACPI call status, eliminating one parameter, and returning something useful that indeed is being checked. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * toshiba_acpi: Unify return codes prefix from HCI/SCI to TOSAzael Avalos2014-09-301-71/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The return codes are split in between HCI/SCI prefixes, but they are shared (used) by both interfaces, mixing hci_read/write calls with SCI_* return codes, and sci_read/write calls with HCI_* ones. This patch changes the prefix of the return codes definitions, dropping the HCI/SCI naming and instead replacing it with TOS (for TOShiba). Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * toshiba_acpi: Rename hci_raw to tci_rawAzael Avalos2014-09-301-59/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function name hci_raw was used before to reflect a raw (read/write) call to Toshiba's Hardware Configuration Interface (HCI), however, since the introduction of the System Configuration Interface (SCI), that "name" no longer applies. This patch changes the name of that function to tci_raw (for Toshiba Configuration Interface), and change the comments about it. Also, the HCI_WORDS definition was changed to TCI_RAW, to better reflect that we're no longer using pure HCI calls, but a combination of HCI and SCI, which form part of the Toshiba Configuration Interface. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * dell-wmi: Fix access out of memoryPali Rohár2014-09-291-3/+9
| | | | | | | | | | | | | | | | | | | | Without this patch, dell-wmi is trying to access elements of dynamically allocated array without checking the array size. This can lead to memory corruption or a kernel panic. This patch adds the missing checks for array size. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: clean up control flow in *_rfkill_notifierFrans Klaver2014-09-221-29/+28Star
| | | | | | | | | | | | | | | | | | Handle errors immediately in eeepc_register_rfkill_notifier and eeepc_unregister_rfkill_notifier. This clears up the control flow for the reader. It also removes unnecessary indentation. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: store_cpufv: return error if set_acpi failsFrans Klaver2014-09-191-1/+3
| | | | | | | | | | | | | | | | | | The result of set_acpi is left unchecked, but it may return errors. If one occurs, send the error to the caller. There's no reason to lie about it, if set_acpi fails. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: check proper return values in get_cpufvFrans Klaver2014-09-191-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In get_cpufv the return value of get_acpi is stored in the cpufv struct. Right before this value is checked for errors, it is and'ed with 0xff. This means c->cur can never be less than zero. Besides that, the actual error value is ignored. c->num is also and'ed with 0xff, which means we can ignore values below zero. Check the result of get_acpi() right away. While at it, propagate the error if we got one. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: make fan1_input really read-onlyFrans Klaver2014-09-191-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the instantiation of the fan1_input device attribute, NULL is passed as set function to store_sys_hwmon. The function pointer is never checked before dereferencing it. This is fine if we can guarantee that it will never be called with an invalid pointer, but we can't. If someone from user space decides to change the permissions on this attribute and write to it, kernel will crash. Introduce EEEPC_CREATE_SENSOR_ATTR_RO() to instantiate a read-only attribute, and declare fan1_input with it. This ensures store_sys_hwmon is never called with NULL parameters. If someone tries to write the attribute, the system will at least keep its sanity. This also causes EEEPC_CREATE_SENSOR_ATTR() to be only used for R/W attributes.This enables us to drop the _mode argument from the macro and use DEVICE_ATTR_RW() internally while we're at it. Append _RW to the name for readability. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: pull out SENSOR_STORE_FUNC and SENSOR_SHOW_FUNC macrosFrans Klaver2014-09-191-3/+9
| | | | | | | | | | | | | | | | | | Pull out EEEPC_SENSOR_STORE_FUNC and EEEPC_SENSOR_SHOW_FUNC. These macros define functions that call store_sys_hwmon() and show_sys_hwmon() respectively. This helps prevent duplication later on. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: tell sysfs that the disp attribute is write-onlyFrans Klaver2014-09-191-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The disp attribute is write-only, but sysfs doesn't know this. Currently show_sys_acpi() is mimicking sysfs behavior, if the underlying acpi call should fail. This was introduced in 6dff29b63a5bf2eaf3 "eeepc-laptop: disp attribute should be write-only". This is not ideal; behaving like sysfs is better left to sysfs. Introduce EEEPC_CREATE_DEVICE_ATTR_WO() to instantiate a write-only attribute, and declare the disp attribute with it. Sysfs makes sure userspace can only write to disp at all times. This removes the need for mimicking the sysfs behavior in show_sys_acpi() and store_sys_acpi(), but we'll stick with -EIO, as changing sysfs return values should not be taken lightly. This change also causes EEEPC_CREATE_DEVICE_ATTR() to be used only for R/W attributes. This enables us to drop the _mode argument from the macro and use DEVICE_ATTR_RW() internally while we're at it. Append _RW to the name for readability. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: pull out ACPI_STORE_FUNC and ACPI_SHOW_FUNC macrosFrans Klaver2014-09-191-3/+9
| | | | | | | | | | | | | | | | | | Pull out macros EEEPC_ACPI_STORE_FUNC and EEEPC_ACPI_SHOW_FUNC. These macros define functions that call store_sys_acpi() and show_sys_acpi() respectively. This helps prevent duplication later on. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: use DEVICE_ATTR* to instantiate device_attributesFrans Klaver2014-09-191-30/+4Star
| | | | | | | | | | | | | | | | Device attributes are instantiated manually, while we have DEVICE_ATTR* macros available to do much of the work for us. Let's use them. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: change sysfs function names to API expectationsFrans Klaver2014-09-191-14/+14
| | | | | | | | | | | | | | | | | | | | | | The eeepc-laptop driver follows the function naming convention <action>_<attrname>(), while the sysfs macros are built around the convention <attrname>_<action>(). Rename the sysfs functions to the convention used by sysfs. This makes it easier to use the available API later on. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: clean up coding styleFrans Klaver2014-09-191-3/+5
| | | | | | | | | | | | | | | | Correct indentation and brace usage to comply with Documentation/CodingStyle. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * eeepc-laptop: simplify parse_arg()Paul Bolle2014-09-181-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parse_arg() has three possible return values: -EINVAL if sscanf(), in short, fails; zero if "count" is zero; and "count" in all other cases But "count" will never be zero. See, parse_arg() is called by the various store functions. And the callchain of these functions starts with sysfs_kf_write(). And that function checks for a zero "count". So we can stop checking for a zero "count", drop the "count" argument entirely, and transform parse_arg() into a function that returns zero on success or a negative error. That, in turn, allows to make those store functions just return "count" on success. The net effect is that the code becomes a bit easier to understand. A nice side effect is that this GCC warning is silenced too: drivers/platform/x86/eeepc-laptop.c: In function ‘store_sys_acpi’: drivers/platform/x86/eeepc-laptop.c:279:10: warning: ‘value’ may be used uninitialized in this function [-Wmaybe-uninitialized] int rv, value; Which is, of course, the reason to have a look at parse_arg(). Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| * intel-rst: Clean up ACPI add functionPeter Ujfalusi2014-09-171-10/+5Star
| | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to initialize the error since it is going to be assigned with the return status of at least on of the device_create_file() call. We can return directly in case the first file creation fails. All the labels for goto can be removed (along with the gotos) as well. Tell the compiler that the failures are unlikely so it can create better binaries. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>