]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
HID: sony: use input_dev from sc struct in sony_init_ff()
authorRosalie Wanders <rosalie@mailbox.org>
Sat, 11 Apr 2026 15:53:47 +0000 (17:53 +0200)
committerJiri Kosina <jkosina@suse.com>
Tue, 12 May 2026 15:34:03 +0000 (17:34 +0200)
This commit makes sony_init_ff() use the input_dev from the sc struct,
this simplifies the sony_init_ff() function.

Signed-off-by: Rosalie Wanders <rosalie@mailbox.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hid-sony.c

index b5e724676c1dea604214e8a4e6c07f5140fccc49..a66d1755654c317297c2b8182ff56c761c1dd815 100644 (file)
@@ -1856,18 +1856,8 @@ static int sony_play_effect(struct input_dev *dev, void *data,
 
 static int sony_init_ff(struct sony_sc *sc)
 {
-       struct hid_input *hidinput;
-       struct input_dev *input_dev;
-
-       if (list_empty(&sc->hdev->inputs)) {
-               hid_err(sc->hdev, "no inputs found\n");
-               return -ENODEV;
-       }
-       hidinput = list_entry(sc->hdev->inputs.next, struct hid_input, list);
-       input_dev = hidinput->input;
-
-       input_set_capability(input_dev, EV_FF, FF_RUMBLE);
-       return input_ff_create_memless(input_dev, NULL, sony_play_effect);
+       input_set_capability(sc->input_dev, EV_FF, FF_RUMBLE);
+       return input_ff_create_memless(sc->input_dev, NULL, sony_play_effect);
 }
 
 #else
@@ -2154,6 +2144,8 @@ static int sony_input_configured(struct hid_device *hdev,
        int append_dev_id;
        int ret;
 
+       sc->input_dev = hidinput->input;
+
        ret = sony_set_device_id(sc);
        if (ret < 0) {
                hid_err(hdev, "failed to allocate the device id\n");
@@ -2314,7 +2306,6 @@ static int sony_input_configured(struct hid_device *hdev,
                        goto err_close;
        }
 
-       sc->input_dev = hidinput->input;
        return 0;
 err_close:
        hid_hw_close(hdev);