Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
HID: add quirk entry for no-name keyboard (0x13ba/0x0017)
HID: fix hid_device_id for cross compiling
HID: sync on deleted io_retry timer in usbhid driver
HID: fix oops during suspend of unbound HID devices

+51 -18
+1
drivers/hid/hid-core.c
··· 1263 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, 1264 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, 1265 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1266 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, 1267 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, 1268 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
··· 1263 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, 1264 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, 1265 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1266 + { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) }, 1267 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, 1268 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, 1269 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
+1
drivers/hid/hid-dell.c
··· 48 static const struct hid_device_id dell_devices[] = { 49 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, 50 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, 51 { } 52 }; 53 MODULE_DEVICE_TABLE(hid, dell_devices);
··· 48 static const struct hid_device_id dell_devices[] = { 49 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) }, 50 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) }, 51 + { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) }, 52 { } 53 }; 54 MODULE_DEVICE_TABLE(hid, dell_devices);
+3
drivers/hid/hid-ids.h
··· 163 164 #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc 165 166 #define USB_VENDOR_ID_GLAB 0x06c2 167 #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 168 #define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039
··· 163 164 #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc 165 166 + #define USB_VENDOR_ID_GENERIC_13BA 0x13ba 167 + #define USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE 0x0017 168 + 169 #define USB_VENDOR_ID_GLAB 0x06c2 170 #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 171 #define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039
+42 -18
drivers/hid/usbhid/hid-core.c
··· 20 #include <linux/kernel.h> 21 #include <linux/list.h> 22 #include <linux/mm.h> 23 #include <linux/smp_lock.h> 24 #include <linux/spinlock.h> 25 #include <asm/unaligned.h> ··· 777 struct usb_interface *intf = to_usb_interface(hid->dev.parent); 778 struct usb_host_interface *interface = intf->cur_altsetting; 779 struct usb_device *dev = interface_to_usbdev(intf); 780 - struct usbhid_device *usbhid; 781 unsigned int n, insize = 0; 782 int ret; 783 - 784 - WARN_ON(hid->driver_data); 785 - 786 - usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL); 787 - if (usbhid == NULL) { 788 - ret = -ENOMEM; 789 - goto err; 790 - } 791 - 792 - hid->driver_data = usbhid; 793 - usbhid->hid = hid; 794 795 usbhid->bufsize = HID_MIN_BUFFER_SIZE; 796 hid_find_max_report(hid, HID_INPUT_REPORT, &usbhid->bufsize); ··· 794 if (insize > HID_MAX_BUFFER_SIZE) 795 insize = HID_MAX_BUFFER_SIZE; 796 797 if (hid_alloc_buffers(dev, hid)) { 798 ret = -ENOMEM; 799 goto fail; ··· 879 usbhid_init_reports(hid); 880 hid_dump_device(hid); 881 882 return 0; 883 884 fail: ··· 889 usb_free_urb(usbhid->urbout); 890 usb_free_urb(usbhid->urbctrl); 891 hid_free_buffers(dev, hid); 892 - kfree(usbhid); 893 - err: 894 return ret; 895 } 896 ··· 900 if (WARN_ON(!usbhid)) 901 return; 902 903 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ 904 set_bit(HID_DISCONNECTED, &usbhid->iofl); 905 spin_unlock_irq(&usbhid->inlock); ··· 926 usb_free_urb(usbhid->urbout); 927 928 hid_free_buffers(hid_to_usb_dev(hid), hid); 929 - kfree(usbhid); 930 - hid->driver_data = NULL; 931 } 932 933 static struct hid_ll_driver usb_hid_driver = { ··· 941 static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) 942 { 943 struct usb_device *dev = interface_to_usbdev(intf); 944 struct hid_device *hid; 945 size_t len; 946 int ret; ··· 995 if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0) 996 hid->uniq[0] = 0; 997 998 ret = hid_add_device(hid); 999 if (ret) { 1000 if (ret != -ENODEV) 1001 dev_err(&intf->dev, "can't add hid device: %d\n", ret); 1002 - goto err; 1003 } 1004 1005 return 0; 1006 err: 1007 hid_destroy_device(hid); 1008 return ret; ··· 1023 static void hid_disconnect(struct usb_interface *intf) 1024 { 1025 struct hid_device *hid = usb_get_intfdata(intf); 1026 1027 if (WARN_ON(!hid)) 1028 return; 1029 1030 hid_destroy_device(hid); 1031 } 1032 1033 static int hid_suspend(struct usb_interface *intf, pm_message_t message) ··· 1038 struct hid_device *hid = usb_get_intfdata (intf); 1039 struct usbhid_device *usbhid = hid->driver_data; 1040 1041 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ 1042 set_bit(HID_SUSPENDED, &usbhid->iofl); 1043 spin_unlock_irq(&usbhid->inlock); 1044 - del_timer(&usbhid->io_retry); 1045 usb_kill_urb(usbhid->urbin); 1046 dev_dbg(&intf->dev, "suspend\n"); 1047 return 0; 1048 } ··· 1060 struct usbhid_device *usbhid = hid->driver_data; 1061 int status; 1062 1063 clear_bit(HID_SUSPENDED, &usbhid->iofl); 1064 usbhid->retry_delay = 0; 1065 status = hid_start_in(hid); 1066 dev_dbg(&intf->dev, "resume status %d\n", status); 1067 return status; 1068 }
··· 20 #include <linux/kernel.h> 21 #include <linux/list.h> 22 #include <linux/mm.h> 23 + #include <linux/mutex.h> 24 #include <linux/smp_lock.h> 25 #include <linux/spinlock.h> 26 #include <asm/unaligned.h> ··· 776 struct usb_interface *intf = to_usb_interface(hid->dev.parent); 777 struct usb_host_interface *interface = intf->cur_altsetting; 778 struct usb_device *dev = interface_to_usbdev(intf); 779 + struct usbhid_device *usbhid = hid->driver_data; 780 unsigned int n, insize = 0; 781 int ret; 782 783 usbhid->bufsize = HID_MIN_BUFFER_SIZE; 784 hid_find_max_report(hid, HID_INPUT_REPORT, &usbhid->bufsize); ··· 804 if (insize > HID_MAX_BUFFER_SIZE) 805 insize = HID_MAX_BUFFER_SIZE; 806 807 + mutex_lock(&usbhid->setup); 808 if (hid_alloc_buffers(dev, hid)) { 809 ret = -ENOMEM; 810 goto fail; ··· 888 usbhid_init_reports(hid); 889 hid_dump_device(hid); 890 891 + set_bit(HID_STARTED, &usbhid->iofl); 892 + mutex_unlock(&usbhid->setup); 893 + 894 return 0; 895 896 fail: ··· 895 usb_free_urb(usbhid->urbout); 896 usb_free_urb(usbhid->urbctrl); 897 hid_free_buffers(dev, hid); 898 + mutex_unlock(&usbhid->setup); 899 return ret; 900 } 901 ··· 907 if (WARN_ON(!usbhid)) 908 return; 909 910 + mutex_lock(&usbhid->setup); 911 + clear_bit(HID_STARTED, &usbhid->iofl); 912 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ 913 set_bit(HID_DISCONNECTED, &usbhid->iofl); 914 spin_unlock_irq(&usbhid->inlock); ··· 931 usb_free_urb(usbhid->urbout); 932 933 hid_free_buffers(hid_to_usb_dev(hid), hid); 934 + mutex_unlock(&usbhid->setup); 935 } 936 937 static struct hid_ll_driver usb_hid_driver = { ··· 947 static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) 948 { 949 struct usb_device *dev = interface_to_usbdev(intf); 950 + struct usbhid_device *usbhid; 951 struct hid_device *hid; 952 size_t len; 953 int ret; ··· 1000 if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0) 1001 hid->uniq[0] = 0; 1002 1003 + usbhid = kzalloc(sizeof(*usbhid), GFP_KERNEL); 1004 + if (usbhid == NULL) { 1005 + ret = -ENOMEM; 1006 + goto err; 1007 + } 1008 + 1009 + hid->driver_data = usbhid; 1010 + usbhid->hid = hid; 1011 + mutex_init(&usbhid->setup); /* needed on suspend/resume */ 1012 + 1013 ret = hid_add_device(hid); 1014 if (ret) { 1015 if (ret != -ENODEV) 1016 dev_err(&intf->dev, "can't add hid device: %d\n", ret); 1017 + goto err_free; 1018 } 1019 1020 return 0; 1021 + err_free: 1022 + kfree(usbhid); 1023 err: 1024 hid_destroy_device(hid); 1025 return ret; ··· 1016 static void hid_disconnect(struct usb_interface *intf) 1017 { 1018 struct hid_device *hid = usb_get_intfdata(intf); 1019 + struct usbhid_device *usbhid; 1020 1021 if (WARN_ON(!hid)) 1022 return; 1023 1024 + usbhid = hid->driver_data; 1025 hid_destroy_device(hid); 1026 + kfree(usbhid); 1027 } 1028 1029 static int hid_suspend(struct usb_interface *intf, pm_message_t message) ··· 1028 struct hid_device *hid = usb_get_intfdata (intf); 1029 struct usbhid_device *usbhid = hid->driver_data; 1030 1031 + mutex_lock(&usbhid->setup); 1032 + if (!test_bit(HID_STARTED, &usbhid->iofl)) { 1033 + mutex_unlock(&usbhid->setup); 1034 + return 0; 1035 + } 1036 + 1037 spin_lock_irq(&usbhid->inlock); /* Sync with error handler */ 1038 set_bit(HID_SUSPENDED, &usbhid->iofl); 1039 spin_unlock_irq(&usbhid->inlock); 1040 + del_timer_sync(&usbhid->io_retry); 1041 usb_kill_urb(usbhid->urbin); 1042 + mutex_unlock(&usbhid->setup); 1043 dev_dbg(&intf->dev, "suspend\n"); 1044 return 0; 1045 } ··· 1043 struct usbhid_device *usbhid = hid->driver_data; 1044 int status; 1045 1046 + mutex_lock(&usbhid->setup); 1047 + if (!test_bit(HID_STARTED, &usbhid->iofl)) { 1048 + mutex_unlock(&usbhid->setup); 1049 + return 0; 1050 + } 1051 + 1052 clear_bit(HID_SUSPENDED, &usbhid->iofl); 1053 usbhid->retry_delay = 0; 1054 status = hid_start_in(hid); 1055 + mutex_unlock(&usbhid->setup); 1056 dev_dbg(&intf->dev, "resume status %d\n", status); 1057 return status; 1058 }
+2
drivers/hid/usbhid/usbhid.h
··· 27 #include <linux/types.h> 28 #include <linux/slab.h> 29 #include <linux/list.h> 30 #include <linux/timer.h> 31 #include <linux/wait.h> 32 #include <linux/workqueue.h> ··· 74 dma_addr_t outbuf_dma; /* Output buffer dma */ 75 spinlock_t outlock; /* Output fifo spinlock */ 76 77 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ 78 struct timer_list io_retry; /* Retry timer */ 79 unsigned long stop_retry; /* Time to give up, in jiffies */
··· 27 #include <linux/types.h> 28 #include <linux/slab.h> 29 #include <linux/list.h> 30 + #include <linux/mutex.h> 31 #include <linux/timer.h> 32 #include <linux/wait.h> 33 #include <linux/workqueue.h> ··· 73 dma_addr_t outbuf_dma; /* Output buffer dma */ 74 spinlock_t outlock; /* Output fifo spinlock */ 75 76 + struct mutex setup; 77 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ 78 struct timer_list io_retry; /* Retry timer */ 79 unsigned long stop_retry; /* Time to give up, in jiffies */
+1
include/linux/hid.h
··· 410 #define HID_SUSPENDED 5 411 #define HID_CLEAR_HALT 6 412 #define HID_DISCONNECTED 7 413 414 struct hid_input { 415 struct list_head list;
··· 410 #define HID_SUSPENDED 5 411 #define HID_CLEAR_HALT 6 412 #define HID_DISCONNECTED 7 413 + #define HID_STARTED 8 414 415 struct hid_input { 416 struct list_head list;
+1
include/linux/mod_devicetable.h
··· 135 136 struct hid_device_id { 137 __u16 bus; 138 __u32 vendor; 139 __u32 product; 140 kernel_ulong_t driver_data
··· 135 136 struct hid_device_id { 137 __u16 bus; 138 + __u16 pad1; 139 __u32 vendor; 140 __u32 product; 141 kernel_ulong_t driver_data