summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/wmi.c
Commit message (Collapse)AuthorAgeFilesLines
* platform/x86: wmi: release mutex on module acquistion failureMario Limonciello2017-11-081-2/+4
| | | | | | | This failure mode should have also released the mutex. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: create userspace interface for driversMario Limonciello2017-11-031-2/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For WMI operations that are only Set or Query readable and writable sysfs attributes created by WMI vendor drivers or the bus driver makes sense. For other WMI operations that are run on Method, there needs to be a way to guarantee to userspace that the results from the method call belong to the data request to the method call. Sysfs attributes don't work well in this scenario because two userspace processes may be competing at reading/writing an attribute and step on each other's data. When a WMI vendor driver declares a callback method in the wmi_driver the WMI bus driver will create a character device that maps to that function. This callback method will be responsible for filtering invalid requests and performing the actual call. That character device will correspond to this path: /dev/wmi/$driver Performing read() on this character device will provide the size of the buffer that the character device needs to perform calls. This buffer size can be set by vendor drivers through a new symbol or when MOF parsing is available by the MOF. Performing ioctl() on this character device will be interpretd by the WMI bus driver. It will perform sanity tests for size of data, test them for a valid instance, copy the data from userspace and pass iton to the vendor driver to further process and run. This creates an implicit policy that each driver will only be allowed a single character device. If a module matches multiple GUID's, the wmi_devices will need to be all handled by the same wmi_driver. The WMI vendor drivers will be responsible for managing inappropriate access to this character device and proper locking on data used by it. When a WMI vendor driver is unloaded the WMI bus driver will clean up the character device and any memory allocated for the call. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Edward O'Callaghan <quasisec@google.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Don't allow drivers to get each other's GUIDsMario Limonciello2017-11-031-17/+0
| | | | | | | | | | | | | | The only driver using this was dell-wmi, and it really was a hack. The driver was getting a data attribute from another driver and this type of action should not be encouraged. Rather drivers that need to interact with one another should pass data back and forth via exported functions. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Edward O'Callaghan <quasisec@google.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Add new method wmidev_evaluate_methodMario Limonciello2017-11-031-4/+24
| | | | | | | | | | | | | | | Drivers properly using the wmibus can pass their wmi_device pointer rather than the GUID back to the WMI bus to evaluate the proper methods. Any "new" drivers added that use the WMI bus should use this rather than the old wmi_evaluate_method that would take the GUID. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Edward O'Callaghan <quasisec@google.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Destroy on cleanup rather than unregisterMario Limonciello2017-09-271-2/+2
| | | | | | | device_create documentation says to cleanup using device_destroy Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Cleanup exit routine in reverse order of initMario Limonciello2017-09-271-1/+1
| | | | | | | | | | | | | | The initialize routine is: * class -> bus -> platform The exit routine is: * platform -> class -> bus Fix the exit routine to be: * platform -> bus -> class Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Sort include listMario Limonciello2017-09-271-6/+6
| | | | | | | | The include list is randomly assembled right now. Sort in alphabetical order. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Fix check for method instance numberPali Rohár2017-08-181-3/+3
| | | | | | | | | | instance_count defines number of instances of data block and instance itself is indexed from zero, which means first instance has number 0. Therefore check for invalid instance should be non-strict inequality. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* platform/x86: wmi: Fix error handling in acpi_wmi_init()Alexey Khoroshilov2017-07-211-3/+3
| | | | | | | | | | The order of resource deallocations is messed up in acpi_wmi_init(). It should be vice versa. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Fix printing info about WDG structurePali Rohár2017-06-131-3/+4
| | | | | | | | | | | | | | object_id and notify_id are in one union structure and their meaning is defined by flags. Therefore do not print notify_id for non-event block and do not print object_id for event block. Remove also reserved member as it does not have any defined meaning or type yet. As object_id and notify_id union members overlaps and have different types, it caused that kernel print to dmesg binary data. This patch eliminates it. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi*: Add recent copyright statementsDarren Hart (VMware)2017-06-131-0/+4
| | | | | | | | | Add copyright statements for Andy Lutomirski and Darren Hart (VMware) for their contributions to the WMI bus infrastructure and the creation of the wmi-bmof driver. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Cc: Andy Lutomirski <luto@kernel.org>
* platform/x86: wmi: Require query for data blocks, rename writable to setableDarren Hart (VMware)2017-06-061-56/+61
| | | | | | | | | | | | | | | | | | | | | | | The Microsoft WMI documentation requires all data blocks to implement the Query Control Method (WQxx). If we encounter a data block not implementing this control method, issue a warning, and ignore the data block. Remove the "readable" attribute as all data blocks must be readable (query-able). Be consistent with the language in the documentation, replace the "writable" attribute with "setable". Simplify (flatten) the control flow of wmi_create_device a bit while we are updating it for the above changes. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* platform/x86: wmi: Add an interface for subdrivers to access sibling devicesAndy Lutomirski2017-06-061-0/+17
| | | | | | | | | | | | | | | Some subdrivers need to access sibling devices. This gives them a clean way to do so. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Bind the platform device, not the ACPI nodeAndy Lutomirski2017-06-061-24/+33
| | | | | | | | | | | | | | | | We already have the PNP glue to instantiate platform devices for the ACPI devices that WMI drives. WMI should therefore attach to the platform device, not the ACPI node. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Add a new interface to read block dataAndy Lutomirski2017-06-061-16/+38
| | | | | | | | | | | | | | | wmi_query_block is unnecessarily indirect. Add a straightforward method for wmi bus drivers to use to read block data. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Incorporate acpi_install_notify_handlerAndy Lutomirski2017-06-061-17/+72
| | | | | | | | | | | | | | | | | | | | | | As a platform driver, acpi_driver.notify will not be available, so use acpi_install_notify_handler as we will be converting to a platform driver. This gives event drivers a simple way to handle events. It also seems closer to what the Windows docs suggest that Windows does: it sounds like, in Windows, the mapper is responsible for called _WED before dispatching to the subdriver. Signed-off-by: Andy Lutomirski <luto@kernel.org> [dvhart: merge two development commits and update commit message] Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Instantiate all devices before adding themDarren Hart (VMware)2017-06-061-20/+29
| | | | | | | | | | | | | | | | | | | | | | At some point, we will want sub-drivers to get references to other devices on the same WMI bus. This change is needed to avoid races. This ends up simplifying the setup code and fixing some leaks, too. This is based on the original work of Andy Lutomirski <luto@kernel.org>, but includes several modifications, many in response to review from Michał Kępień <kernel@kempniu.pl>: https://www.spinics.net/lists/platform-driver-x86/msg08201.html Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* platform/x86: wmi: Probe data objects for read and write capabilitiesAndy Lutomirski2017-06-061-4/+97
| | | | | | | | | | | | | | | | | | | | The Dell XPS 13 9350 has one RW data object, one RO data object, and one totally inaccessible data object. Check for the existence of the accessor methods and report in sysfs. The docs also permit WQxx getters for single-instance objects to take no parameters. Probe for that as well to avoid ACPICA warnings about mismatched signatures. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Split devices into types and add basic sysfs attributesAndy Lutomirski2017-06-061-1/+77
| | | | | | | | | | | | | | | | Divide the "data", "method" and "event" types. All devices get "instance_count" and "expensive" attributes, data and method devices get "object_id" attributes, and event devices get "notify_id" attributes. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Fix error handling when creating devicesAndy Lutomirski2017-06-061-13/+15
| | | | | | | | | | | | | | | | | We have two memory leaks. If guid_already_parsed returned true, we leak the wmi_block. If wmi_create_device failed, we leak the device. Simplify the logic and fix both of them. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Turn WMI into a bus driverAndy Lutomirski2017-06-061-43/+154
| | | | | | | | | | | | | | | | | | | | | | WMI is logically a bus: the WMI driver binds to an ACPI node (or more than one), and each instance of the WMI driver enumerates its children and hopes that drivers will attach to the children that are useful. This patch gives WMI a driver model bus type and the ability to match to drivers. The bus itself is a device in the new "wmi_bus" class, and all of the individual WMI devices are slotted into the device hierarchy correctly. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Track wmi devices per ACPI deviceAndy Lutomirski2017-06-061-22/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently we free all devices when we detach from any ACPI node. Instead, keep track of which node WMI devices are attached to and free them only as needed. While we are at it, match up notifications with the device they came from correctly. This will make our behavior more straightforward on systems with more than one WMI node in the ACPI tables (e.g. the Dell XPS 13 9350). This also adds a warning when GUIDs are not unique. NB: The guid_string parameter in guid_already_parsed was a little-endian binary GUID, not a string. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Clean up acpi_wmi_addAndy Lutomirski2017-06-061-5/+9
| | | | | | | | | | | | | | Rearrange acpi_wmi_add to use Linux's error handling conventions. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Pass the acpi_device through to parse_wdgAndy Lutomirski2017-06-061-6/+7
| | | | | | | | | | | | | | | We will need the device to convert to a bus architecture and bind WMI to the platform device. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: wmi: Drop "Mapper (un)loaded" messagesAndy Lutomirski2017-06-061-3/+0
| | | | | | | | | | | | | | WMI is just a driver. There is no need to announce when it is loaded. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* drivers/platform/x86/wmi.c: use generic UUID libraryAndy Shevchenko2016-05-201-91/+13
| | | | | | | | | Instead of opencoding let's use generic UUID library functions here. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* wmi: Remove private %pUL implementationRasmus Villemoes2015-09-101-45/+6
| | | | | | | | | | | | | | | | The work performed by wmi_gtoa is equivalent to simply sprintf(out, "%pUL", in), so one could replace its body by this. However, most users feed the result directly as a %s argument to some other function which also understands the %p extensions (they all ultimately use vsnprintf), so we can eliminate some stack buffers and quite a bit of code by just using %pUL directly. In wmi_dev_uevent I'm not sure whether there's room for a nul-terminator in env->buf, so I've just replaced wmi_gtoa with the equivalent sprintf call. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* wmi: Use bool function return values of true/false not 1/0Joe Perches2015-04-071-2/+2
| | | | | | | Use the normal return values for bool functions Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* x86/wmi: delete unused wmi_data_lock mutex causing gcc warningPaul Gortmaker2015-03-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | In commit bff431e49ff531a343fbb2b4426e313000844f32 ("ACPI: WMI: Add ACPI-WMI mapping driver") this mutex was added, but the rest of the final commit never actually made use of it, resulting in: In file included from include/linux/mutex.h:29:0, from include/linux/kernfs.h:13, from include/linux/sysfs.h:15, from include/linux/kobject.h:21, from include/linux/device.h:17, from drivers/platform/x86/wmi.c:35: drivers/platform/x86/wmi.c:48:21: warning: ‘wmi_data_lock’ defined but not used [-Wunused-variable] static DEFINE_MUTEX(wmi_data_lock); ^ A git grep shows no other instances/references to the wmi_data_lock. Delete it, assuming that the mutex addition was just a leftover from an earlier work in progress version of the change, since the original dates from 2008. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* WMI: Remove unnecessary null testHimangi Saraogi2014-08-161-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the null test on block. block is initialized at the beginning of the function to &wblock->gblock. Since wblock is dereferenced prior to the null test, wblock must be a valid pointer, and &wblock->gblock cannot be null. The following Coccinelle script is used for detecting the change: @r@ expression e,f; identifier g,y; statement S1,S2; @@ *e = &f->g <+... f->y ...+> *if (e != NULL || ...) S1 else S2 Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
* Merge branch 'acpi-cleanup'Rafael J. Wysocki2014-01-121-2/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * acpi-cleanup: (22 commits) ACPI / tables: Return proper error codes from acpi_table_parse() and fix comment. ACPI / tables: Check if id is NULL in acpi_table_parse() ACPI / proc: Include appropriate header file in proc.c ACPI / EC: Remove unused functions and add prototype declaration in internal.h ACPI / dock: Include appropriate header file in dock.c ACPI / PCI: Include appropriate header file in pci_link.c ACPI / PCI: Include appropriate header file in pci_slot.c ACPI / EC: Mark the function acpi_ec_add_debugfs() as static in ec_sys.c ACPI / NVS: Include appropriate header file in nvs.c ACPI / OSL: Mark the function acpi_table_checksum() as static ACPI / processor: initialize a variable to silence compiler warning ACPI / processor: use ACPI_COMPANION() to get ACPI device ACPI: correct minor typos ACPI / sleep: Drop redundant acpi_disabled check ACPI / dock: Drop redundant acpi_disabled check ACPI / table: Replace '1' with specific error return values ACPI: remove trailing whitespace ACPI / IBFT: Fix incorrect <acpi/acpi.h> inclusion in iSCSI boot firmware module ACPI / i915: Fix incorrect <acpi/acpi.h> inclusions via <linux/acpi_io.h> SFI / ACPI: Fix warnings reported during builds with W=1 ... Conflicts: drivers/acpi/nvs.c drivers/hwmon/asus_atk0110.c
| * ACPI: Clean up inclusions of ACPI header filesLv Zheng2013-12-071-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace direct inclusions of <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h>, which are incorrect, with <linux/acpi.h> inclusions and remove some inclusions of those files that aren't necessary. First of all, <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h> should not be included directly from any files that are built for CONFIG_ACPI unset, because that generally leads to build warnings about undefined symbols in !CONFIG_ACPI builds. For CONFIG_ACPI set, <linux/acpi.h> includes those files and for CONFIG_ACPI unset it provides stub ACPI symbols to be used in that case. Second, there are ordering dependencies between those files that always have to be met. Namely, it is required that <acpi/acpi_bus.h> be included prior to <acpi/acpi_drivers.h> so that the acpi_pci_root declarations the latter depends on are always there. And <acpi/acpi.h> which provides basic ACPICA type declarations should always be included prior to any other ACPI headers in CONFIG_ACPI builds. That also is taken care of including <linux/acpi.h> as appropriate. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: Tony Luck <tony.luck@intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci stuff) Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> (Xen stuff) Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | x86, wmi fix modalias_show return valuesPrarit Bhargava2013-11-201-2/+4
|/ | | | | | | | | | | I just fixed this same bug in arch/powerpc/kernel/vio.c and took a quick look for other similar errors in the kernel. modalias_show() should return an empty string on error, not errno. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Cc: Matthew Garrett <matthew.garrett@nebula.com> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
* wmi: convert acpi_get_handle() to acpi_has_method()Zhang Rui2013-09-241-3/+2
| | | | | | | | | | | | | | | | | acpi_has_method() is a new ACPI API introduced to check the existence of an ACPI control method. It can be used to replace acpi_get_handle() in the case that 1. the calling function doesn't need the ACPI handle of the control method. and 2. the calling function doesn't care the reason why the method is unavailable. Convert acpi_get_handle() to acpi_has_method() in drivers/platform/x86/wmi.c in this patch. Signed-off-by: Zhang Rui <rui.zhang@intel.com> CC: Matthew Garrett <matthew.garrett@nebula.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* wmi: convert acpi_evaluate_object() to acpi_execute_simple_method()Zhang Rui2013-09-241-19/+6
| | | | | | | | | | | | acpi_execute_simple_method() is a new ACPI API introduced to invoke an ACPI control method that has single integer parameter and no return value. Convert acpi_evaluate_object() to acpi_execute_simple_method() in drivers/platform/x86/wmi.c Signed-off-by: Zhang Rui <rui.zhang@intel.com> CC: Matthew Garrett <matthew.garrett@nebula.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* wmi: parse_wdg() should return kernel error codesDan Carpenter2013-09-051-2/+2
| | | | | | | | | | The current code returns a mix of acpi_status and kernel error codes. It should just return kernel error codes. There are already error paths in this function which return -ENOMEM and that's what the caller expects. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
* x86: wmi: convert class code to use dev_groupsGreg Kroah-Hartman2013-08-191-4/+6
| | | | | | | | | The dev_attrs field of struct class is going away soon, dev_groups should be used instead. This converts the wmi class code to use the correct field. Cc: Matthew Garrett <matthew.garrett@nebula.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* drivers: avoid format string in dev_set_nameKees Cook2013-07-031-1/+1
| | | | | | | | | | | Calling dev_set_name with a single paramter causes it to be handled as a format string. Many callers are passing potentially dynamic string content, so use "%s" in those cases to avoid any potential accidents, including wrappers like device_create*() and bdi_register(). Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* ACPI: Remove useless type argument of driver .remove() operationRafael J. Wysocki2013-01-261-2/+2
| | | | | | | | | | | | | The second argument of ACPI driver .remove() operation is only used by the ACPI processor driver and the value passed to that driver through it is always available from the given struct acpi_device object's removal_type field. For this reason, the second ACPI driver .remove() argument is in fact useless, so drop it. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Jiang Liu <jiang.liu@huawei.com> Acked-by: Toshi Kani <toshi.kani@hp.com> Acked-by: Yinghai Lu <yinghai@kernel.org>
* module_param: make bool parameters really bool (drivers & misc)Rusty Russell2012-01-131-2/+2
| | | | | | | | | | | | module_param(bool) used to counter-intuitively take an int. In fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy trick. It's time to remove the int/unsigned int option. For this version it'll simply give a warning, but it'll break next kernel version. Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* Merge branch 'modsplit-Oct31_2011' of ↵Linus Torvalds2011-11-061-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux * 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits) Revert "tracing: Include module.h in define_trace.h" irq: don't put module.h into irq.h for tracking irqgen modules. bluetooth: macroize two small inlines to avoid module.h ip_vs.h: fix implicit use of module_get/module_put from module.h nf_conntrack.h: fix up fallout from implicit moduleparam.h presence include: replace linux/module.h with "struct module" wherever possible include: convert various register fcns to macros to avoid include chaining crypto.h: remove unused crypto_tfm_alg_modname() inline uwb.h: fix implicit use of asm/page.h for PAGE_SIZE pm_runtime.h: explicitly requires notifier.h linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h miscdevice.h: fix up implicit use of lists and types stop_machine.h: fix implicit use of smp.h for smp_processor_id of: fix implicit use of errno.h in include/linux/of.h of_platform.h: delete needless include <linux/module.h> acpi: remove module.h include from platform/aclinux.h miscdevice.h: delete unnecessary inclusion of module.h device_cgroup.h: delete needless include <linux/module.h> net: sch_generic remove redundant use of <linux/module.h> net: inet_timewait_sock doesnt need <linux/module.h> ... Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in - drivers/media/dvb/frontends/dibx000_common.c - drivers/media/video/{mt9m111.c,ov6650.c} - drivers/mfd/ab3550-core.c - include/linux/dmaengine.h
| * x86: fix up files really needing to include module.hPaul Gortmaker2011-10-311-0/+1
| | | | | | | | | | | | | | These files aren't just exporting symbols -- they are also defining a MODULE_LICENSE etc. so give them the full module.h file. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
* | WMI: properly cleanup devices to avoid crashesDmitry Torokhov2011-10-241-1/+5
|/ | | | | | | | | | | | | We need to remove devices that we destroy from the list, otherwise we'll crash if there are more than one "_WDG" methods in DSDT. This fixes https://bugzilla.kernel.org/show_bug.cgi?id=32052 Tested-by: Ilya Tumaykin <librarian_rus@yahoo.com> Cc: stable@kernel.org Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Acked-by: Carlos Corbacho <carlos@strangeworlds.co.uk> Signed-off-by: Matthew Garrett <mjg@redhat.com>
* wmi: Removed trailing whitespace from logging message.Joe Perches2011-05-271-5/+5
| | | | | | | Just neatening. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
* WMI: return error if wmi_create_device() failsDan Carpenter2011-01-071-1/+1
| | | | | | | | | | The break resets the retval to 0 but we want to return an error code. This was introduced in c64eefd48c4 "WMI: embed struct device directly into wmi_block" Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Matthew Garrett <mjg@redhat.com> Acked-by: Dmitry Torokhov <dtor@mail.ru>
* WMI: Cater for multiple events with same GUIDColin King2011-01-071-61/+72
| | | | | | | | | | | | | | | WMI data blocks can contain WMI events with the same GUID but with different notifiy_ids, for example volume up/down hotkeys. This patch enables a single event handler to be registered and unregistered against all events with same GUID but different notify_ids. Since an event handler is passed the notify_id of an event it can can differentiate between the different events. The patch also ensures we only register and unregister a device per unique GUID. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
* wmi: use memcmp instead of strncmp to compare GUIDsThadeu Lima de Souza Cascardo2010-12-061-1/+1
| | | | | | | | | | | | | | | While looking for the duplicates in /sys/class/wmi/, I couldn't find them. The code that looks for duplicates uses strncmp in a binary GUID, which may contain zero bytes. The right function is memcmp, which is also used in another section of wmi code. It was finding 49142400-C6A3-40FA-BADB-8A2652834100 as a duplicate of 39142400-C6A3-40FA-BADB-8A2652834100. Since the first byte is the fourth printed, they were found as equal by strncmp. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Signed-off-by: Matthew Garrett <mjg@redhat.com> Cc: stable@kernel.org
* WMI: embed struct device directly into wmi_blockDmitry Torokhov2010-10-211-111/+65
| | | | | | | | | | Instead of creating wmi_blocks and then register corresponding devices on a separate pass do it all in one shot, since lifetime rules for both objects are the same. This also takes care of leaking devices when device_create fails for one of them. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Matthew Garrett <mjg@redhat.com>
* WMI: make use of class device's attributresDmitry Torokhov2010-10-211-8/+7
| | | | | | | | Instead of adding modalias attribute manually set it up as class's device attribute so driver core will create and remove it for us. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Matthew Garrett <mjg@redhat.com>
* WMI: use pr_err() and friendsDmitry Torokhov2010-10-211-35/+29
| | | | | | | This makes source more concise and easier to read. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Matthew Garrett <mjg@redhat.com>
OpenPOWER on IntegriCloud