summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/wmi.c
Commit message (Collapse)AuthorAgeFilesLines
* platform/x86: wmi: Break possible infinite loop when parsing GUIDAndy Shevchenko2023-07-231-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | [ Upstream commit 028e6e204ace1f080cfeacd72c50397eb8ae8883 ] The while-loop may break on one of the two conditions, either ID string is empty or GUID matches. The second one, may never be reached if the parsed string is not correct GUID. In such a case the loop will never advance to check the next ID. Break possible infinite loop by factoring out guid_parse_and_compare() helper which may be moved to the generic header for everyone later on and preventing from similar mistake in the future. Interestingly that firstly it appeared when WMI was turned into a bus driver, but later when duplicated GUIDs were checked, the while-loop has been replaced by for-loop and hence no mistake made again. Fixes: a48e23385fcf ("platform/x86: wmi: add context pointer field to struct wmi_device_id") Fixes: 844af950da94 ("platform/x86: wmi: Turn WMI into a bus driver") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230621151155.78279-1-andriy.shevchenko@linux.intel.com Tested-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
* platform/x86: wmi: Drop forward declaration of static functionsUwe Kleine-König2022-09-191-12/+9
| | | | | | | | | | | Usually it's not necessary to declare static functions if the symbols are in the right order. Moving the definition of acpi_wmi_driver down in the compilation unit allows to drop two such declarations. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220919122213.852322-1-u.kleine-koenig@pengutronix.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: Allow duplicate GUIDs for drivers that use struct wmi_driverMario Limonciello2022-09-031-9/+40
| | | | | | | | | | | | | | | | | | | | | The WMI subsystem in the kernel currently tracks WMI devices by a GUID string not by ACPI device. The GUID used by the `wmi-bmof` module however is available from many devices on nearly every machine. This originally was thought to be a bug, but as it happens on most machines it is a design mistake. It has been fixed by tying an ACPI device to the driver with struct wmi_driver. So drivers that have moved over to struct wmi_driver can actually support multiple instantiations of a GUID without any problem. Add an allow list into wmi.c for GUIDs that the drivers that are known to use struct wmi_driver. The list is populated with `wmi-bmof` right now. The additional instances of that in sysfs with be suffixed with -%d Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20220829201500.6341-1-mario.limonciello@amd.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: replace usage of found with dedicated list iterator variableJakob Koschel2022-04-131-7/+6
| | | | | | | | | | | | | | | | | | | To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body. To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable instead of a found boolean [1]. This removes the need to use a found variable and simply checking if the variable was set, can determine if the break/goto was hit. Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com> Link: https://lore.kernel.org/r/20220324072015.62063-1-jakobkoschel@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: Add no_notify_data flag to struct wmi_driverHans de Goede2021-12-061-4/+6
| | | | | | | | | | | | | | Some WMI implementations do notifies on WMI objects without a _WED method allow WMI drivers to indicate that _WED should not be called for notifies on the WMI objects the driver is bound to. Instead the driver's notify callback will simply be called with a NULL data argument. Reported-by: Yauhen Kharuzhy <jekhor@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20211128190031.405620-3-hdegoede@redhat.com
* platform/x86: wmi: Fix driver->notify() vs ->probe() raceHans de Goede2021-12-061-1/+5
| | | | | | | | | | | | | | | | | The driver core sets struct device->driver before calling out to the bus' probe() method, this leaves a window where an ACPI notify may happen on the WMI object before the driver's probe() method has completed running, causing e.g. the driver's notify() callback to get called with drvdata not yet being set leading to a NULL pointer deref. At a check for this to the WMI core, ensuring that the notify() callback is not called before the driver is ready. Fixes: 1686f5444546 ("platform/x86: wmi: Incorporate acpi_install_notify_handler") Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20211128190031.405620-2-hdegoede@redhat.com
* platform/x86: wmi: Replace read_takes_no_args with a flags fieldHans de Goede2021-12-061-4/+7
| | | | | | | | | | | | | Replace the wmi_block.read_takes_no_args bool field with an unsigned long flags field, used together with test_bit() and friends. This is a preparation patch for fixing a driver->notify() vs ->probe() race, which requires atomic flag handling. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20211128190031.405620-1-hdegoede@redhat.com
* platform/x86: wmi: change notification handler typeMikalai Ramanovich2021-10-221-3/+3
| | | | | | | | | | Since AML code on some Xiaomi laptops notifies the WMI hotkey with 0x20 event, we need ACPI_ALL_NOTIFY here to be able to handle it. Signed-off-by: Mikalai Ramanovich <nikolay.romanovich.00@gmail.com> Link: https://lore.kernel.org/r/20211015191322.73388-1-nikolay.romanovich.00@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: more detailed error reporting in find_guid()Barnabás Pőcze2021-09-141-16/+27
| | | | | | | | | | Make `find_guid()` return an acpi_status, and make it handle NULL pointer GUID strings; and adapt users accordingly. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-31-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: introduce helper to retrieve event dataBarnabás Pőcze2021-09-141-22/+20
| | | | | | | | | | | | | | Previously, `acpi_wmi_notify_handler()` and `wmi_get_event_data()` shared more or less the exact same code to query the data for a particular event. Introduce a function to get rid of the duplication, and use it from `acpi_wmi_notify_handler()` and `wmi_get_event_data()`. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-30-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: introduce helper to determine typeBarnabás Pőcze2021-09-141-11/+10
| | | | | | | | | | | | | Introduce helper function to determine the appropriate ACPI type for the input parameter. This also fixes the following checkpatch warning: "braces {} are not necessary for any arm of this statement". Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-29-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: introduce helper to generate method namesBarnabás Pőcze2021-09-141-15/+27
| | | | | | | | | | | | | Instead of "manually" constructing the ACPI method name and hard-coding sizes in WMI functions, introduce a helper method which generates the method name for an arbitrary WMI block. Furthermore, save the appropriate buffer size into a macro. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-28-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: introduce helper to convert driver to WMI driverBarnabás Pőcze2021-09-141-12/+10
| | | | | | | | | | | Introduce a helper function which wraps the appropriate `container_of()` macro invocation to convert a `struct device_driver` to `struct wmi_driver`. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-27-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: simplify error handling logicBarnabás Pőcze2021-09-141-4/+3
| | | | | | | | | | | | | | | | | | The current code carries out the following ACPI status mapping: AE_NOT_FOUND -> AE_OK AE_OK -> AE_OK AE_$X -> AE_$X That is, everything is mapped to itself, except AE_NOT_FOUND. The current code does not do it in the most straighforward way. Simplify the logic. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-26-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: do not fail if disabling failsBarnabás Pőcze2021-09-141-1/+8
| | | | | | | | | | | | | | | Previously, `__query_block()` would fail if the second WCxx method call failed. However, the WQxx method might have succeeded, and potentially allocated memory for the result. Instead of throwing away the result and potentially leaking memory, ignore the result of the second WCxx call. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-25-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: improve debug messagesBarnabás Pőcze2021-09-141-4/+4
| | | | | | | | | | | Print the event identifier number in addition to the already printed information, and use %u for printing unsigned values in `wmi_notify_debug()`. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-24-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: align arguments of functionsBarnabás Pőcze2021-09-141-9/+10
| | | | | | | | | | | | | | | Align the arguments of * wmi_evaluate_method() * wmi_install_notify_handler() * wmidev_evaluate_method() * find_guid_context() * acpi_wmi_ec_space_handler() * wmi_char_read() Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-23-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: move variablesBarnabás Pőcze2021-09-141-5/+4
| | | | | | | | | | Move some variables in order to keep them in the narrowest possible scope. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-22-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: remove variableBarnabás Pőcze2021-09-141-4/+1
| | | | | | | | | | The `block` variable is assigned and only used once, the code shorter and probably clearer without it; so remove it. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-21-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: use sizeof(*p) in allocationBarnabás Pőcze2021-09-141-1/+1
| | | | | | | | | | | As per the coding style guide, the preferred way to pass the size of objects to allocator functions is `sizeof(*p)`. Use that. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-20-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: use !p to check for NULLBarnabás Pőcze2021-09-141-2/+2
| | | | | | | | | | | Other parts of the code use the `!p` idiom to check for NULL pointers, convert `find_guid_context()` to do the same. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-19-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: use sysfs_emit()Barnabás Pőcze2021-09-141-9/+10
| | | | | | | | | Instead of `sprintf()` use the new `sysfs_emit()` function. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-17-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: make GUID block packedBarnabás Pőcze2021-09-141-1/+5
| | | | | | | | | | | | The `guid_block` struct is overlaid onto a buffer coming from the _WDG ACPI object of the device. For this reason mark the struct packed and add assertions about sizes. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-16-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: use guid_t and guid_equal()Barnabás Pőcze2021-09-141-17/+17
| | | | | | | | | | Instead of hard-coding a 16 long byte array, use the available `guid_t` type and related methods. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-15-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: use bool instead of intBarnabás Pőcze2021-09-141-8/+8
| | | | | | | | | | | The `bool` type is more expressive for a yes/no kind of value, so use that as the type of the `enable` parameter of `wmi_method_enable()`. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-13-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: use BIT() macroBarnabás Pőcze2021-09-141-4/+5
| | | | | | | | | | Instead of manually creating the bit masks, use the `BIT()` macro to do it. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-12-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: remove unnecessary checksBarnabás Pőcze2021-09-141-2/+0
| | | | | | | | | | | The `find_guid_context()` is only called from one place, and `wblock` and `wdriver` cannot be NULL there. So remove the currently redundant checks. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-11-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: remove stray empty lineBarnabás Pőcze2021-09-141-1/+0
| | | | | | | | | | | Remove an empty line after the last statement in `acpi_wmi_notify_handler()` which serves no purpose. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-10-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: remove unnecessary castsBarnabás Pőcze2021-09-141-7/+5
| | | | | | | | | | Void pointers are implictly cast to arbitrary pointer types, so remove superfluous casts. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-9-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: remove unnecessary argumentBarnabás Pőcze2021-09-141-5/+4
| | | | | | | | | | | | The GUID block is available for `wmi_create_device()` through `wblock->gblock`. Use that consistently in the function instead of using a mix of `gblock` and `wblock->gblock`. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-8-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: remove unnecessary variableBarnabás Pőcze2021-09-141-4/+1
| | | | | | | | | | | The `status` variable was assigned at the end, and then immediately returned. Remove it altogether, and return the previously assigned value directly. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-7-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: remove unnecessary initializationsBarnabás Pőcze2021-09-141-9/+9
| | | | | | | | | | | Some pointers are initialized when they are defined, but they are almost immediately reassigned in the following lines. Remove these superfluous assignments. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-6-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: remove unnecessary initializationBarnabás Pőcze2021-09-141-1/+1
| | | | | | | | | | | The empty initializer `{ }` is enough to properly initialize the terminating acpi_device_id entry in the device table, so use that. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-5-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: remove commasBarnabás Pőcze2021-09-141-4/+4
| | | | | | | | | Remove commas that are after terminating entries in arrays. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-4-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: fix checkpatch warningsBarnabás Pőcze2021-09-141-3/+2
| | | | | | | | | | | | Fix the following two checkpatch warnings: * "space required before the open parenthesis '('" * "that open brace { should be on the previous line" Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-3-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: fix kernel docBarnabás Pőcze2021-09-141-1/+1
| | | | | | | | | | The kernel doc erroneously specified `wmi_uninstall_notify_handler()` for the `wmi_remove_notify_handler()` function. Fix that. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20210904175450.156801-2-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* bus: Make remove callback return voidUwe Kleine-König2021-07-211-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver core ignores the return value of this callback because there is only little it can do when a device disappears. This is the final bit of a long lasting cleanup quest where several buses were converted to also return void from their remove callback. Additionally some resource leaks were fixed that were caused by drivers returning an error code in the expectation that the driver won't go away. With struct bus_type::remove returning void it's prevented that newly implemented buses return an ignored error code and so don't anticipate wrong expectations for driver authors. Reviewed-by: Tom Rix <trix@redhat.com> (For fpga) Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Cornelia Huck <cohuck@redhat.com> (For drivers/s390 and drivers/vfio) Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> (For ARM, Amba and related parts) Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Chen-Yu Tsai <wens@csie.org> (for sunxi-rsb) Acked-by: Pali Rohár <pali@kernel.org> Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org> (for media) Acked-by: Hans de Goede <hdegoede@redhat.com> (For drivers/platform) Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-By: Vinod Koul <vkoul@kernel.org> Acked-by: Juergen Gross <jgross@suse.com> (For xen) Acked-by: Lee Jones <lee.jones@linaro.org> (For mfd) Acked-by: Johannes Thumshirn <jth@kernel.org> (For mcb) Acked-by: Johan Hovold <johan@kernel.org> Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> (For slimbus) Acked-by: Kirti Wankhede <kwankhede@nvidia.com> (For vfio) Acked-by: Maximilian Luz <luzmaximilian@gmail.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> (For ulpi and typec) Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> (For ipack) Acked-by: Geoff Levand <geoff@infradead.org> (For ps3) Acked-by: Yehezkel Bernat <YehezkelShB@gmail.com> (For thunderbolt) Acked-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> (For intel_th) Acked-by: Dominik Brodowski <linux@dominikbrodowski.net> (For pcmcia) Acked-by: Rafael J. Wysocki <rafael@kernel.org> (For ACPI) Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> (rpmsg and apr) Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> (For intel-ish-hid) Acked-by: Dan Williams <dan.j.williams@intel.com> (For CXL, DAX, and NVDIMM) Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> (For isa) Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (For firewire) Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> (For hid) Acked-by: Thorsten Scherer <t.scherer@eckelmann.de> (For siox) Acked-by: Sven Van Asbroeck <TheSven73@gmail.com> (For anybuss) Acked-by: Ulf Hansson <ulf.hansson@linaro.org> (For MMC) Acked-by: Wolfram Sang <wsa@kernel.org> # for I2C Acked-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Finn Thain <fthain@linux-m68k.org> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20210713193522.1770306-6-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* platform/x86: wmi: Make remove callback return voidUwe Kleine-König2021-03-081-3/+2
| | | | | | | | | | | | | | | The driver core ignores the return value of struct bus_type::remove() (and so wmi_dev_remove()) because there is only little that can be done. To simplify the quest to make this function return void, let struct wmi_driver::remove() return void, too. All implementers of this callback return 0 already and this way it should be obvious to driver authors that returning an error code is a bad idea. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Pali Rohár <pali@kernel.org> Link: https://lore.kernel.org/r/20210301160404.1677064-1-u.kleine-koenig@pengutronix.de Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform: x86: ACPI: Get rid of ACPICA message printingRafael J. Wysocki2021-03-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | A few x86 platform drivers use ACPI_DEBUG_PRINT() or ACPI_EXCEPTION() for printing messages, but that is questionable, because those macros belong to ACPICA and they should not be used elsewhere. In addition, ACPI_DEBUG_PRINT() requires special enabling to allow it to actually print the message, which is a nuisance, and the _COMPONENT symbol generally needed for that is not defined in any of the files in question. For this reason, replace the ACPI_DEBUG_PRINT() in lg-laptop.c with pr_debug() and the one in xo15-ebook.c with acpi_handle_debug() (with the additional benefit that the source object can be identified more easily after this change). Also drop the ACPI_MODULE_NAME() definitions that are only used by the ACPICA message printing macros from those files and from wmi.c and surfacepro3_button.c (while at it). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/2074665.VPHYfYaQb6@kreacher [hdegoede@redhat.com: Drop acer-wmi.c chunk, a similar patch was already merged] Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: remove unneeded breakTom Rix2020-10-281-3/+0
| | | | | | | | A break is not needed if it is preceded by a return Signed-off-by: Tom Rix <trix@redhat.com> Link: https://lore.kernel.org/r/20201019133212.12671-1-trix@redhat.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Revert "platform/x86: wmi: Destroy on cleanup rather than unregister"Yongxin Liu2020-10-271-2/+2
| | | | | | | | | | | | | | | | | | | | This reverts commit 7b11e8989618581bc0226ad313264cdc05d48d86. Consider the following hardware setting. |-PNP0C14:00 | |-- device #1 |-PNP0C14:01 | |-- device #2 When unloading wmi driver module, device #2 will be first unregistered. But device_destroy() using MKDEV(0, 0) will locate PNP0C14:00 first and unregister it. This is incorrect. Should use device_unregister() to unregister the real parent device. Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> Link: https://lore.kernel.org/r/20191115052710.46880-1-yongxin.liu@windriver.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: wmi: Describe function parametersAndy Shevchenko2020-04-231-7/+9
| | | | | | | There are few parameters that are not described properly. Fill the gap by describing them properly in kernel doc format. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* platform/x86: wmi: Fix indentation in some casesAndy Shevchenko2020-04-231-6/+3
| | | | | | There is no need to split lines as they perfectly fit 80 character limit. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* platform/x86: wmi: Replace UUID redefinitions by their originalsAndy Shevchenko2020-04-231-10/+10
| | | | | | | There are types and helpers that are redefined with old names. Convert the WMI library to use those types and helpers directly. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* acpi: Remove header dependencyPeter Zijlstra2020-03-211-0/+1
| | | | | | | | | | | | In order to avoid future header hell, remove the inclusion of proc_fs.h from acpi_bus.h. All it needs is a forward declaration of a struct. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lkml.kernel.org/r/20200321113241.246190285@linutronix.de
* compat_ioctl: move more drivers to compat_ptr_ioctlArnd Bergmann2019-10-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The .ioctl and .compat_ioctl file operations have the same prototype so they can both point to the same function, which works great almost all the time when all the commands are compatible. One exception is the s390 architecture, where a compat pointer is only 31 bit wide, and converting it into a 64-bit pointer requires calling compat_ptr(). Most drivers here will never run in s390, but since we now have a generic helper for it, it's easy enough to use it consistently. I double-checked all these drivers to ensure that all ioctl arguments are used as pointers or are ignored, but are not interpreted as integer values. Acked-by: Jason Gunthorpe <jgg@mellanox.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: David Sterba <dsterba@suse.com> Acked-by: Darren Hart (VMware) <dvhart@infradead.org> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
* platform/x86: wmi: Remove acpi_has_method() callKelsey Skunberg2019-07-301-3/+1
| | | | | | | | | | | | acpi_has_method() is unnecessary within __query_block() and should be removed to avoid extra work. wc_status is initialized to AE_ERROR before the acpi_has_method() call. acpi_has_method() and acpi_execute_simple_method() failing due to the method not existing will result in the same outcome from __query_block(). Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* Merge tag 'platform-drivers-x86-v5.3-1' of ↵Linus Torvalds2019-07-141-1/+43
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.infradead.org/linux-platform-drivers-x86 Pull x86 platform driver updates from Andy Shevchenko: "Gathered a bunch of x86 platform driver changes. It's rather big, since includes two big refactors and completely new driver: - ASUS WMI driver got a big refactoring in order to support the TUF Gaming laptops. Besides that, the regression with backlight being permanently off on various EeePC laptops has been fixed. - Accelerometer on HP ProBook 450 G0 shows wrong measurements due to X axis being inverted. This has been fixed. - Intel PMC core driver has been extended to be ACPI enumerated if the DSDT provides device with _HID "INT33A1". This allows to convert the driver to be pure platform and support new hardware purely based on ACPI DSDT. - From now on the Intel Speed Select Technology is supported thru a corresponding driver. This driver provides an access to the features of the ISST, such as Performance Profile, Core Power, Base frequency and Turbo Frequency. - Mellanox platform drivers has been refactored and now extended to support more systems, including new coming ones. - The OLPC XO-1.75 platform is now supported. - CB4063 Beckhoff Automation board is using PMC clocks, provided via pmc_atom driver, for ethernet controllers in a way that they can't be managed by the clock driver. The quirk has been extended to cover this case. - Touchscreen on Chuwi Hi10 Plus tablet has been enabled. Meanwhile the information of Chuwi Hi10 Air has been fixed to cover more models based on the same platform. - Xiaomi notebooks have WMI interface enabled. Thus, the driver to support it has been provided. It required some extension of the generic WMI library, which allows to propagate opaque context to the ->probe() of the individual drivers. This release includes debugfs clean up from Greg KH for several drivers that drop return code check and make debugfs absence or failure non-fatal. Also miscellaneous fixes here and there, mostly for Acer WMI and various Intel drivers" * tag 'platform-drivers-x86-v5.3-1' of git://git.infradead.org/linux-platform-drivers-x86: (74 commits) platform/x86: Fix PCENGINES_APU2 Kconfig warning tools/power/x86/intel-speed-select: Add .gitignore file platform/x86: mlx-platform: Fix error handling in mlxplat_init() platform/x86: intel_pmc_core: Attach using APCI HID "INT33A1" platform/x86: intel_pmc_core: transform Pkg C-state residency from TSC ticks into microseconds platform/x86: asus-wmi: Use dev_get_drvdata() Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces platform/x86: mlx-platform: Add more reset cause attributes platform/x86: mlx-platform: Modify DMI matching order platform/x86: mlx-platform: Add regmap structure for the next generation systems platform/x86: mlx-platform: Change API for i2c-mlxcpld driver activation platform/x86: mlx-platform: Move regmap initialization before all drivers activation MAINTAINERS: Update for Intel Speed Select Technology tools/power/x86: A tool to validate Intel Speed Select commands platform/x86: ISST: Restore state on resume platform/x86: ISST: Add Intel Speed Select PUNIT MSR interface platform/x86: ISST: Add Intel Speed Select mailbox interface via MSRs platform/x86: ISST: Add Intel Speed Select mailbox interface via PCI platform/x86: ISST: Add Intel Speed Select mmio interface platform/x86: ISST: Add IOCTL to Translate Linux logical CPU to PUNIT CPU number ...
| * platform/x86: wmi: add context argument to the probe functionMattias Jacobsson2019-06-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | The struct wmi_device_id has a context pointer field, forward this pointer as an argument to the probe function in struct wmi_driver. Update existing users of the same probe function to accept this new context argument. Signed-off-by: Mattias Jacobsson <2pi@mok.nu> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: wmi: add context pointer field to struct wmi_device_idMattias Jacobsson2019-06-171-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | When using wmi_install_notify_handler() to initialize a WMI handler a data pointer can be supplied which will be passed on to the notification handler. No similar feature exist when handling WMI events via struct wmi_driver. Add a context field pointer to struct wmi_device_id and add a function find_guid_context() to retrieve that context pointer. Signed-off-by: Mattias Jacobsson <2pi@mok.nu> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>