summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarnabás Pőcze <pobrn@protonmail.com>2022-10-05 18:00:51 +0300
committerHans de Goede <hdegoede@redhat.com>2022-11-16 10:48:19 +0300
commite57d58ee1868b1ad3e8040335a2941506feb52e4 (patch)
tree3cbe2529c2f836ad99dd9867be70edb14ebabf5b
parent0b9a1dcdb6a2c841899389bf2dd7a3e0e2aa0e99 (diff)
downloadlinux-e57d58ee1868b1ad3e8040335a2941506feb52e4.tar.xz
platform/x86: huawei-wmi: remove unnecessary member
The `huawei_wmi::idev` array is not actually used by the driver, so remove it. The piece of code that - I believe - was supposed to fill the array is flawed, it did not actually set any of the values inside the array. This was most likely masked by the fact that the input devices are devm managed and that the only function that needs a reference to the input devices is `huawei_wmi_input_notify()`, however, that does not access the appropriate input device via the `huawei_wmi` object. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20221005150032.173198-3-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--drivers/platform/x86/huawei-wmi.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c
index 981420f7f5d7..2df1b2d5e3ea 100644
--- a/drivers/platform/x86/huawei-wmi.c
+++ b/drivers/platform/x86/huawei-wmi.c
@@ -63,7 +63,6 @@ struct huawei_wmi {
bool fn_lock_available;
struct huawei_wmi_debug debug;
- struct input_dev *idev[2];
struct led_classdev cdev;
struct device *dev;
@@ -756,31 +755,30 @@ static void huawei_wmi_input_notify(u32 value, void *context)
kfree(response.pointer);
}
-static int huawei_wmi_input_setup(struct device *dev,
- const char *guid,
- struct input_dev **idev)
+static int huawei_wmi_input_setup(struct device *dev, const char *guid)
{
+ struct input_dev *idev;
acpi_status status;
int err;
- *idev = devm_input_allocate_device(dev);
- if (!*idev)
+ idev = devm_input_allocate_device(dev);
+ if (!idev)
return -ENOMEM;
- (*idev)->name = "Huawei WMI hotkeys";
- (*idev)->phys = "wmi/input0";
- (*idev)->id.bustype = BUS_HOST;
- (*idev)->dev.parent = dev;
+ idev->name = "Huawei WMI hotkeys";
+ idev->phys = "wmi/input0";
+ idev->id.bustype = BUS_HOST;
+ idev->dev.parent = dev;
- err = sparse_keymap_setup(*idev, huawei_wmi_keymap, NULL);
+ err = sparse_keymap_setup(idev, huawei_wmi_keymap, NULL);
if (err)
return err;
- err = input_register_device(*idev);
+ err = input_register_device(idev);
if (err)
return err;
- status = wmi_install_notify_handler(guid, huawei_wmi_input_notify, *idev);
+ status = wmi_install_notify_handler(guid, huawei_wmi_input_notify, idev);
if (ACPI_FAILURE(status))
return -EIO;
@@ -809,17 +807,14 @@ static int huawei_wmi_probe(struct platform_device *pdev)
huawei_wmi->dev = &pdev->dev;
while (*guid->guid_string) {
- struct input_dev *idev = *huawei_wmi->idev;
-
if (wmi_has_guid(guid->guid_string)) {
- err = huawei_wmi_input_setup(&pdev->dev, guid->guid_string, &idev);
+ err = huawei_wmi_input_setup(&pdev->dev, guid->guid_string);
if (err) {
dev_err(&pdev->dev, "Failed to setup input on %s\n", guid->guid_string);
return err;
}
}
- idev++;
guid++;
}