Skip to content

Commit e57d58e

Browse files
pobrnjwrdegoede
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent 0b9a1dc commit e57d58e

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

drivers/platform/x86/huawei-wmi.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ struct huawei_wmi {
6363
bool fn_lock_available;
6464

6565
struct huawei_wmi_debug debug;
66-
struct input_dev *idev[2];
6766
struct led_classdev cdev;
6867
struct device *dev;
6968

@@ -756,31 +755,30 @@ static void huawei_wmi_input_notify(u32 value, void *context)
756755
kfree(response.pointer);
757756
}
758757

759-
static int huawei_wmi_input_setup(struct device *dev,
760-
const char *guid,
761-
struct input_dev **idev)
758+
static int huawei_wmi_input_setup(struct device *dev, const char *guid)
762759
{
760+
struct input_dev *idev;
763761
acpi_status status;
764762
int err;
765763

766-
*idev = devm_input_allocate_device(dev);
767-
if (!*idev)
764+
idev = devm_input_allocate_device(dev);
765+
if (!idev)
768766
return -ENOMEM;
769767

770-
(*idev)->name = "Huawei WMI hotkeys";
771-
(*idev)->phys = "wmi/input0";
772-
(*idev)->id.bustype = BUS_HOST;
773-
(*idev)->dev.parent = dev;
768+
idev->name = "Huawei WMI hotkeys";
769+
idev->phys = "wmi/input0";
770+
idev->id.bustype = BUS_HOST;
771+
idev->dev.parent = dev;
774772

775-
err = sparse_keymap_setup(*idev, huawei_wmi_keymap, NULL);
773+
err = sparse_keymap_setup(idev, huawei_wmi_keymap, NULL);
776774
if (err)
777775
return err;
778776

779-
err = input_register_device(*idev);
777+
err = input_register_device(idev);
780778
if (err)
781779
return err;
782780

783-
status = wmi_install_notify_handler(guid, huawei_wmi_input_notify, *idev);
781+
status = wmi_install_notify_handler(guid, huawei_wmi_input_notify, idev);
784782
if (ACPI_FAILURE(status))
785783
return -EIO;
786784

@@ -809,17 +807,14 @@ static int huawei_wmi_probe(struct platform_device *pdev)
809807
huawei_wmi->dev = &pdev->dev;
810808

811809
while (*guid->guid_string) {
812-
struct input_dev *idev = *huawei_wmi->idev;
813-
814810
if (wmi_has_guid(guid->guid_string)) {
815-
err = huawei_wmi_input_setup(&pdev->dev, guid->guid_string, &idev);
811+
err = huawei_wmi_input_setup(&pdev->dev, guid->guid_string);
816812
if (err) {
817813
dev_err(&pdev->dev, "Failed to setup input on %s\n", guid->guid_string);
818814
return err;
819815
}
820816
}
821817

822-
idev++;
823818
guid++;
824819
}
825820

0 commit comments

Comments
 (0)