Merge branch 'for-5.4/apple' into for-linus
authorJiri Kosina <jkosina@suse.cz>
Sun, 22 Sep 2019 20:29:00 +0000 (22:29 +0200)
committerJiri Kosina <jkosina@suse.cz>
Sun, 22 Sep 2019 20:29:00 +0000 (22:29 +0200)
- stuck 'fn' key fix for hid-apple from Joao Moreno

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-lg.c
drivers/hid/hid-lg4ff.c
drivers/hid/hid-logitech-dj.c
drivers/hid/hid-prodikeys.c
drivers/hid/hid-sony.c
drivers/hid/hidraw.c
drivers/hid/i2c-hid/i2c-hid-core.c

index 5008a3dc28f454a89803f361c35673b97f0f9119..0dc7cdfc56f77470b8a8c853ebd0077b4955853c 100644 (file)
@@ -818,7 +818,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
 
                if (!buf) {
                        ret = -ENOMEM;
-                       goto err_free;
+                       goto err_stop;
                }
 
                ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf),
@@ -850,9 +850,12 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
                ret = lg4ff_init(hdev);
 
        if (ret)
-               goto err_free;
+               goto err_stop;
 
        return 0;
+
+err_stop:
+       hid_hw_stop(hdev);
 err_free:
        kfree(drv_data);
        return ret;
@@ -863,8 +866,7 @@ static void lg_remove(struct hid_device *hdev)
        struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
        if (drv_data->quirks & LG_FF4)
                lg4ff_deinit(hdev);
-       else
-               hid_hw_stop(hdev);
+       hid_hw_stop(hdev);
        kfree(drv_data);
 }
 
index cefba038520ceb4d7901b640c09277708192488f..03f0220062cab641a725eddc2e4d51c1bedca141 100644 (file)
@@ -1477,7 +1477,6 @@ int lg4ff_deinit(struct hid_device *hid)
                }
        }
 #endif
-       hid_hw_stop(hid);
        drv_data->device_props = NULL;
 
        kfree(entry);
index cc47f948c1d0c54632e683a0d094cc1ae4902b32..7badbaa188789c115971f5aa20a618119813ad19 100644 (file)
@@ -1734,14 +1734,14 @@ static int logi_dj_probe(struct hid_device *hdev,
                if (retval < 0) {
                        hid_err(hdev, "%s: logi_dj_recv_query_paired_devices error:%d\n",
                                __func__, retval);
-                       goto logi_dj_recv_query_paired_devices_failed;
+                       /*
+                        * This can happen with a KVM, let the probe succeed,
+                        * logi_dj_recv_queue_unknown_work will retry later.
+                        */
                }
        }
 
-       return retval;
-
-logi_dj_recv_query_paired_devices_failed:
-       hid_hw_close(hdev);
+       return 0;
 
 llopen_failed:
 switch_to_dj_mode_fail:
index 21544ebff85545b5349e88b512d9e82f69484e9b..5a3b3d974d849c28503f6f6390312384d6e1868f 100644 (file)
@@ -551,10 +551,14 @@ static void pcmidi_setup_extra_keys(
 
 static int pcmidi_set_operational(struct pcmidi_snd *pm)
 {
+       int rc;
+
        if (pm->ifnum != 1)
                return 0; /* only set up ONCE for interace 1 */
 
-       pcmidi_get_output_report(pm);
+       rc = pcmidi_get_output_report(pm);
+       if (rc < 0)
+               return rc;
        pcmidi_submit_output_report(pm, 0xc1);
        return 0;
 }
@@ -683,7 +687,11 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm)
        spin_lock_init(&pm->rawmidi_in_lock);
 
        init_sustain_timers(pm);
-       pcmidi_set_operational(pm);
+       err = pcmidi_set_operational(pm);
+       if (err < 0) {
+               pk_error("failed to find output report\n");
+               goto fail_register;
+       }
 
        /* register it */
        err = snd_card_register(card);
index 49dd2d905c7f6b7f799e9de24c484a901808eddb..73c0f7a95e2dcea13d10b37176c9d7678074af1c 100644 (file)
@@ -2811,7 +2811,6 @@ err_stop:
        sony_cancel_work_sync(sc);
        sony_remove_dev_list(sc);
        sony_release_device_id(sc);
-       hid_hw_stop(hdev);
        return ret;
 }
 
@@ -2876,6 +2875,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
         */
        if (!(hdev->claimed & HID_CLAIMED_INPUT)) {
                hid_err(hdev, "failed to claim input\n");
+               hid_hw_stop(hdev);
                return -ENODEV;
        }
 
index 006bd6f4f653f00a013efdb8cba2abbd34c01457..62ef47a730b06fdeebdb0b9ba11631802d95dc89 100644 (file)
@@ -370,7 +370,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
 
        mutex_lock(&minors_lock);
        dev = hidraw_table[minor];
-       if (!dev) {
+       if (!dev || !dev->exist) {
                ret = -ENODEV;
                goto out;
        }
index 90164fed08d35eca2c34250c8b7cb3814ea99f53..2a7c6e33bb1c4322b6851e42988f593e69ae527f 100644 (file)
@@ -169,9 +169,7 @@ static const struct i2c_hid_quirks {
        __u16 idProduct;
        __u32 quirks;
 } i2c_hid_quirks[] = {
-       { USB_VENDOR_ID_WEIDA, USB_DEVICE_ID_WEIDA_8752,
-               I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
-       { USB_VENDOR_ID_WEIDA, USB_DEVICE_ID_WEIDA_8755,
+       { USB_VENDOR_ID_WEIDA, HID_ANY_ID,
                I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
        { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
                I2C_HID_QUIRK_NO_IRQ_AFTER_RESET |