aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/hid-core.c3
-rw-r--r--drivers/hid/hid-debug.c15
-rw-r--r--drivers/hid/hid-steelseries.c9
-rw-r--r--include/linux/hid.h2
4 files changed, 18 insertions, 11 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 6961bbeab3ed..264f55099940 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1685,6 +1685,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1685 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) }, 1685 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) },
1686 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1686 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1687 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, 1687 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
1688 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) },
1688 { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) }, 1689 { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) },
1689 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, 1690 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
1690 { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) }, 1691 { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) },
@@ -2341,7 +2342,7 @@ struct hid_device *hid_allocate_device(void)
2341 2342
2342 init_waitqueue_head(&hdev->debug_wait); 2343 init_waitqueue_head(&hdev->debug_wait);
2343 INIT_LIST_HEAD(&hdev->debug_list); 2344 INIT_LIST_HEAD(&hdev->debug_list);
2344 mutex_init(&hdev->debug_list_lock); 2345 spin_lock_init(&hdev->debug_list_lock);
2345 sema_init(&hdev->driver_lock, 1); 2346 sema_init(&hdev->driver_lock, 1);
2346 sema_init(&hdev->driver_input_lock, 1); 2347 sema_init(&hdev->driver_input_lock, 1);
2347 2348
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 7e56cb3855e3..8453214ec376 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -579,15 +579,16 @@ void hid_debug_event(struct hid_device *hdev, char *buf)
579{ 579{
580 int i; 580 int i;
581 struct hid_debug_list *list; 581 struct hid_debug_list *list;
582 unsigned long flags;
582 583
583 mutex_lock(&hdev->debug_list_lock); 584 spin_lock_irqsave(&hdev->debug_list_lock, flags);
584 list_for_each_entry(list, &hdev->debug_list, node) { 585 list_for_each_entry(list, &hdev->debug_list, node) {
585 for (i = 0; i < strlen(buf); i++) 586 for (i = 0; i < strlen(buf); i++)
586 list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] = 587 list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] =
587 buf[i]; 588 buf[i];
588 list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE; 589 list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE;
589 } 590 }
590 mutex_unlock(&hdev->debug_list_lock); 591 spin_unlock_irqrestore(&hdev->debug_list_lock, flags);
591 592
592 wake_up_interruptible(&hdev->debug_wait); 593 wake_up_interruptible(&hdev->debug_wait);
593} 594}
@@ -977,6 +978,7 @@ static int hid_debug_events_open(struct inode *inode, struct file *file)
977{ 978{
978 int err = 0; 979 int err = 0;
979 struct hid_debug_list *list; 980 struct hid_debug_list *list;
981 unsigned long flags;
980 982
981 if (!(list = kzalloc(sizeof(struct hid_debug_list), GFP_KERNEL))) { 983 if (!(list = kzalloc(sizeof(struct hid_debug_list), GFP_KERNEL))) {
982 err = -ENOMEM; 984 err = -ENOMEM;
@@ -992,9 +994,9 @@ static int hid_debug_events_open(struct inode *inode, struct file *file)
992 file->private_data = list; 994 file->private_data = list;
993 mutex_init(&list->read_mutex); 995 mutex_init(&list->read_mutex);
994 996
995 mutex_lock(&list->hdev->debug_list_lock); 997 spin_lock_irqsave(&list->hdev->debug_list_lock, flags);
996 list_add_tail(&list->node, &list->hdev->debug_list); 998 list_add_tail(&list->node, &list->hdev->debug_list);
997 mutex_unlock(&list->hdev->debug_list_lock); 999 spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags);
998 1000
999out: 1001out:
1000 return err; 1002 return err;
@@ -1088,10 +1090,11 @@ static unsigned int hid_debug_events_poll(struct file *file, poll_table *wait)
1088static int hid_debug_events_release(struct inode *inode, struct file *file) 1090static int hid_debug_events_release(struct inode *inode, struct file *file)
1089{ 1091{
1090 struct hid_debug_list *list = file->private_data; 1092 struct hid_debug_list *list = file->private_data;
1093 unsigned long flags;
1091 1094
1092 mutex_lock(&list->hdev->debug_list_lock); 1095 spin_lock_irqsave(&list->hdev->debug_list_lock, flags);
1093 list_del(&list->node); 1096 list_del(&list->node);
1094 mutex_unlock(&list->hdev->debug_list_lock); 1097 spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags);
1095 kfree(list->hid_debug_buf); 1098 kfree(list->hid_debug_buf);
1096 kfree(list); 1099 kfree(list);
1097 1100
diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
index 9b0efb0083fe..d16491192112 100644
--- a/drivers/hid/hid-steelseries.c
+++ b/drivers/hid/hid-steelseries.c
@@ -18,7 +18,8 @@
18 18
19#include "hid-ids.h" 19#include "hid-ids.h"
20 20
21#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 21#if IS_BUILTIN(CONFIG_LEDS_CLASS) || \
22 (IS_MODULE(CONFIG_LEDS_CLASS) && IS_MODULE(CONFIG_HID_STEELSERIES))
22#define SRWS1_NUMBER_LEDS 15 23#define SRWS1_NUMBER_LEDS 15
23struct steelseries_srws1_data { 24struct steelseries_srws1_data {
24 __u16 led_state; 25 __u16 led_state;
@@ -107,7 +108,8 @@ static __u8 steelseries_srws1_rdesc_fixed[] = {
1070xC0 /* End Collection */ 1080xC0 /* End Collection */
108}; 109};
109 110
110#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 111#if IS_BUILTIN(CONFIG_LEDS_CLASS) || \
112 (IS_MODULE(CONFIG_LEDS_CLASS) && IS_MODULE(CONFIG_HID_STEELSERIES))
111static void steelseries_srws1_set_leds(struct hid_device *hdev, __u16 leds) 113static void steelseries_srws1_set_leds(struct hid_device *hdev, __u16 leds)
112{ 114{
113 struct list_head *report_list = &hdev->report_enum[HID_OUTPUT_REPORT].report_list; 115 struct list_head *report_list = &hdev->report_enum[HID_OUTPUT_REPORT].report_list;
@@ -370,7 +372,8 @@ MODULE_DEVICE_TABLE(hid, steelseries_srws1_devices);
370static struct hid_driver steelseries_srws1_driver = { 372static struct hid_driver steelseries_srws1_driver = {
371 .name = "steelseries_srws1", 373 .name = "steelseries_srws1",
372 .id_table = steelseries_srws1_devices, 374 .id_table = steelseries_srws1_devices,
373#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 375#if IS_BUILTIN(CONFIG_LEDS_CLASS) || \
376 (IS_MODULE(CONFIG_LEDS_CLASS) && IS_MODULE(CONFIG_HID_STEELSERIES))
374 .probe = steelseries_srws1_probe, 377 .probe = steelseries_srws1_probe,
375 .remove = steelseries_srws1_remove, 378 .remove = steelseries_srws1_remove,
376#endif 379#endif
diff --git a/include/linux/hid.h b/include/linux/hid.h
index af1b86d46f6e..0c48991b0402 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -515,7 +515,7 @@ struct hid_device { /* device report descriptor */
515 struct dentry *debug_rdesc; 515 struct dentry *debug_rdesc;
516 struct dentry *debug_events; 516 struct dentry *debug_events;
517 struct list_head debug_list; 517 struct list_head debug_list;
518 struct mutex debug_list_lock; 518 spinlock_t debug_list_lock;
519 wait_queue_head_t debug_wait; 519 wait_queue_head_t debug_wait;
520}; 520};
521 521