diff options
author | Armin Wolf <W_Armin@gmx.de> | 2023-12-18 20:24:18 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-12-19 16:32:46 +0100 |
commit | 095fa72a19f13b15629611d52447cb17ce223bcd (patch) | |
tree | 32e2b05d9ca0deac1a154e9eeff0346a44ea9cbe /drivers/platform/x86/wmi.c | |
parent | platform/x86: wmi: Use devres for resource handling (diff) | |
download | linux-095fa72a19f13b15629611d52447cb17ce223bcd.tar.xz linux-095fa72a19f13b15629611d52447cb17ce223bcd.zip |
platform/x86: wmi: Create WMI bus device first
Create the WMI bus device first so that it can be used
by the ACPI handlers.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20231218192420.305411-5-W_Armin@gmx.de
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/wmi.c')
-rw-r--r-- | drivers/platform/x86/wmi.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 4bc5da70c1b0..e2bfdc61c4ce 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -1276,6 +1276,17 @@ static int acpi_wmi_probe(struct platform_device *device) return -ENODEV; } + wmi_bus_dev = device_create(&wmi_bus_class, &device->dev, MKDEV(0, 0), NULL, "wmi_bus-%s", + dev_name(&device->dev)); + if (IS_ERR(wmi_bus_dev)) + return PTR_ERR(wmi_bus_dev); + + error = devm_add_action_or_reset(&device->dev, acpi_wmi_remove_bus_device, wmi_bus_dev); + if (error < 0) + return error; + + dev_set_drvdata(&device->dev, wmi_bus_dev); + status = acpi_install_address_space_handler(acpi_device->handle, ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler, @@ -1302,17 +1313,6 @@ static int acpi_wmi_probe(struct platform_device *device) if (error < 0) return error; - wmi_bus_dev = device_create(&wmi_bus_class, &device->dev, MKDEV(0, 0), - NULL, "wmi_bus-%s", dev_name(&device->dev)); - if (IS_ERR(wmi_bus_dev)) - return PTR_ERR(wmi_bus_dev); - - error = devm_add_action_or_reset(&device->dev, acpi_wmi_remove_bus_device, wmi_bus_dev); - if (error < 0) - return error; - - dev_set_drvdata(&device->dev, wmi_bus_dev); - error = parse_wdg(wmi_bus_dev, device); if (error) { pr_err("Failed to parse WDG method\n"); |