From fa59530267e1006b7180e9ce1dee4136907b2b65 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Tue, 29 Sep 2009 03:24:55 +0200 Subject: HID: add __init/__exit macros to twinhan.c Trivial patch which adds the __init/__exit macros to the module_init/ module_exit functions of the twinhan driver in hid. Signed-off-by: Peter Huewe Signed-off-by: Jiri Kosina --- drivers/hid/hid-twinhan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-twinhan.c b/drivers/hid/hid-twinhan.c index b05f602c051..c40afc57fc8 100644 --- a/drivers/hid/hid-twinhan.c +++ b/drivers/hid/hid-twinhan.c @@ -132,12 +132,12 @@ static struct hid_driver twinhan_driver = { .input_mapping = twinhan_input_mapping, }; -static int twinhan_init(void) +static int __init twinhan_init(void) { return hid_register_driver(&twinhan_driver); } -static void twinhan_exit(void) +static void __exit twinhan_exit(void) { hid_unregister_driver(&twinhan_driver); } -- cgit v1.2.3 From ff9b00a226ccea66e6ce70e9083c42f5b6001f73 Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Thu, 1 Oct 2009 16:03:13 +0200 Subject: HID: fix kerneldoc comment for hid_input_report() The kerneldoc comment for 'interrupt' has already confused a lot of people, as it is simply wrong. It doesn't carry the information about the context, but is used to distinguish between two fundamental types of low-level transport transfers -- interrupt vs. control. Make this clear in the comment. Signed-off-by: Jiri Kosina --- drivers/hid/hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index be34d32906b..7d05c4bb201 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1066,7 +1066,7 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event); * @type: HID report type (HID_*_REPORT) * @data: report contents * @size: size of data parameter - * @interrupt: called from atomic? + * @interrupt: distinguish between interrupt and control transfers * * This is data entry for lower layers. */ -- cgit v1.2.3 From b0e14951ee0f6c29abc64b92ec7075a159ede37c Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Mon, 12 Oct 2009 11:25:56 +0200 Subject: HID: fix possible deadlock in hidraw_read If the loop in hidraw_read() loops more than once, then we might end up trying to acquire already locked mutex, casuing a deadlock. Reported-by: iceberg Signed-off-by: Jiri Kosina --- drivers/hid/hidraw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 0c6639ea03d..b079a9c5995 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -47,10 +47,9 @@ static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, char *report; DECLARE_WAITQUEUE(wait, current); - while (ret == 0) { - - mutex_lock(&list->read_mutex); + mutex_lock(&list->read_mutex); + while (ret == 0) { if (list->head == list->tail) { add_wait_queue(&list->hidraw->wait, &wait); set_current_state(TASK_INTERRUPTIBLE); -- cgit v1.2.3