aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/Kconfig10
-rw-r--r--drivers/hid/Makefile13
-rw-r--r--drivers/hid/hid-3m-pct.c2
-rw-r--r--drivers/hid/hid-a4tech.c6
-rw-r--r--drivers/hid/hid-apple.c63
-rw-r--r--drivers/hid/hid-axff.c14
-rw-r--r--drivers/hid/hid-belkin.c4
-rw-r--r--drivers/hid/hid-cando.c2
-rw-r--r--drivers/hid/hid-cherry.c3
-rw-r--r--drivers/hid/hid-core.c118
-rw-r--r--drivers/hid/hid-cypress.c4
-rw-r--r--drivers/hid/hid-debug.c4
-rw-r--r--drivers/hid/hid-drff.c14
-rw-r--r--drivers/hid/hid-egalax.c2
-rw-r--r--drivers/hid/hid-elecom.c3
-rw-r--r--drivers/hid/hid-emsff.c161
-rw-r--r--drivers/hid/hid-gaff.c13
-rw-r--r--drivers/hid/hid-ids.h10
-rw-r--r--drivers/hid/hid-input.c6
-rw-r--r--drivers/hid/hid-kye.c4
-rw-r--r--drivers/hid/hid-lg.c15
-rw-r--r--drivers/hid/hid-lg2ff.c9
-rw-r--r--drivers/hid/hid-lg3ff.c9
-rw-r--r--drivers/hid/hid-lg4ff.c9
-rw-r--r--drivers/hid/hid-lgff.c8
-rw-r--r--drivers/hid/hid-magicmouse.c15
-rw-r--r--drivers/hid/hid-microsoft.c7
-rw-r--r--drivers/hid/hid-monterey.c3
-rw-r--r--drivers/hid/hid-mosart.c2
-rw-r--r--drivers/hid/hid-ntrig.c9
-rw-r--r--drivers/hid/hid-ortek.c3
-rw-r--r--drivers/hid/hid-petalynx.c7
-rw-r--r--drivers/hid/hid-picolcd.c51
-rw-r--r--drivers/hid/hid-pl.c16
-rw-r--r--drivers/hid/hid-prodikeys.c27
-rw-r--r--drivers/hid/hid-quanta.c2
-rw-r--r--drivers/hid/hid-roccat-kone.c22
-rw-r--r--drivers/hid/hid-roccat-pyra.c20
-rw-r--r--drivers/hid/hid-roccat.c36
-rw-r--r--drivers/hid/hid-samsung.c8
-rw-r--r--drivers/hid/hid-sjoy.c16
-rw-r--r--drivers/hid/hid-sony.c11
-rw-r--r--drivers/hid/hid-stantum.c2
-rw-r--r--drivers/hid/hid-sunplus.c3
-rw-r--r--drivers/hid/hid-tmff.c27
-rw-r--r--drivers/hid/hid-topseed.c1
-rw-r--r--drivers/hid/hid-wacom.c28
-rw-r--r--drivers/hid/hid-zpff.c11
-rw-r--r--drivers/hid/hid-zydacron.c11
-rw-r--r--drivers/hid/hidraw.c33
-rw-r--r--drivers/hid/usbhid/Makefile6
-rw-r--r--drivers/hid/usbhid/hid-core.c48
-rw-r--r--drivers/hid/usbhid/hid-pidff.c164
-rw-r--r--drivers/hid/usbhid/hid-quirks.c2
-rw-r--r--drivers/hid/usbhid/hiddev.c241
-rw-r--r--drivers/hid/usbhid/usbkbd.c24
56 files changed, 796 insertions, 566 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 3052e2969ad0..3d9a95f28aea 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -150,6 +150,16 @@ config DRAGONRISE_FF
150 Say Y here if you want to enable force feedback support for DragonRise Inc. 150 Say Y here if you want to enable force feedback support for DragonRise Inc.
151 game controllers. 151 game controllers.
152 152
153config HID_EMS_FF
154 tristate "EMS Production Inc. force feedback support"
155 depends on USB_HID
156 select INPUT_FF_MEMLESS
157 ---help---
158 Say Y here if you want to enable force feedback support for devices by
159 EMS Production Ltd.
160 Currently the following devices are known to be supported:
161 - Trio Linker Plus II
162
153config HID_EGALAX 163config HID_EGALAX
154 tristate "eGalax multi-touch panel" 164 tristate "eGalax multi-touch panel"
155 depends on USB_HID 165 depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index c335605b9200..b406269d1bcb 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for the HID driver 2# Makefile for the HID driver
3# 3#
4hid-objs := hid-core.o hid-input.o 4hid-y := hid-core.o hid-input.o
5 5
6ifdef CONFIG_DEBUG_FS 6ifdef CONFIG_DEBUG_FS
7 hid-objs += hid-debug.o 7 hid-objs += hid-debug.o
@@ -11,18 +11,18 @@ obj-$(CONFIG_HID) += hid.o
11 11
12hid-$(CONFIG_HIDRAW) += hidraw.o 12hid-$(CONFIG_HIDRAW) += hidraw.o
13 13
14hid-logitech-objs := hid-lg.o 14hid-logitech-y := hid-lg.o
15ifdef CONFIG_LOGITECH_FF 15ifdef CONFIG_LOGITECH_FF
16 hid-logitech-objs += hid-lgff.o 16 hid-logitech-y += hid-lgff.o
17endif 17endif
18ifdef CONFIG_LOGIRUMBLEPAD2_FF 18ifdef CONFIG_LOGIRUMBLEPAD2_FF
19 hid-logitech-objs += hid-lg2ff.o 19 hid-logitech-y += hid-lg2ff.o
20endif 20endif
21ifdef CONFIG_LOGIG940_FF 21ifdef CONFIG_LOGIG940_FF
22 hid-logitech-objs += hid-lg3ff.o 22 hid-logitech-y += hid-lg3ff.o
23endif 23endif
24ifdef CONFIG_LOGIWII_FF 24ifdef CONFIG_LOGIWII_FF
25 hid-logitech-objs += hid-lg4ff.o 25 hid-logitech-y += hid-lg4ff.o
26endif 26endif
27 27
28obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o 28obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o
@@ -35,6 +35,7 @@ obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
35obj-$(CONFIG_HID_CHICONY) += hid-chicony.o 35obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
36obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 36obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
37obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o 37obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o
38obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o
38obj-$(CONFIG_HID_EGALAX) += hid-egalax.o 39obj-$(CONFIG_HID_EGALAX) += hid-egalax.o
39obj-$(CONFIG_HID_ELECOM) += hid-elecom.o 40obj-$(CONFIG_HID_ELECOM) += hid-elecom.o
40obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 41obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
diff --git a/drivers/hid/hid-3m-pct.c b/drivers/hid/hid-3m-pct.c
index 02d8cd3b1b1b..4546c123eb77 100644
--- a/drivers/hid/hid-3m-pct.c
+++ b/drivers/hid/hid-3m-pct.c
@@ -274,7 +274,7 @@ static int mmm_probe(struct hid_device *hdev, const struct hid_device_id *id)
274 274
275 md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL); 275 md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL);
276 if (!md) { 276 if (!md) {
277 dev_err(&hdev->dev, "cannot allocate 3M data\n"); 277 hid_err(hdev, "cannot allocate 3M data\n");
278 return -ENOMEM; 278 return -ENOMEM;
279 } 279 }
280 hid_set_drvdata(hdev, md); 280 hid_set_drvdata(hdev, md);
diff --git a/drivers/hid/hid-a4tech.c b/drivers/hid/hid-a4tech.c
index 1666c1684e79..902d1dfeb1b5 100644
--- a/drivers/hid/hid-a4tech.c
+++ b/drivers/hid/hid-a4tech.c
@@ -93,7 +93,7 @@ static int a4_probe(struct hid_device *hdev, const struct hid_device_id *id)
93 93
94 a4 = kzalloc(sizeof(*a4), GFP_KERNEL); 94 a4 = kzalloc(sizeof(*a4), GFP_KERNEL);
95 if (a4 == NULL) { 95 if (a4 == NULL) {
96 dev_err(&hdev->dev, "can't alloc device descriptor\n"); 96 hid_err(hdev, "can't alloc device descriptor\n");
97 ret = -ENOMEM; 97 ret = -ENOMEM;
98 goto err_free; 98 goto err_free;
99 } 99 }
@@ -104,13 +104,13 @@ static int a4_probe(struct hid_device *hdev, const struct hid_device_id *id)
104 104
105 ret = hid_parse(hdev); 105 ret = hid_parse(hdev);
106 if (ret) { 106 if (ret) {
107 dev_err(&hdev->dev, "parse failed\n"); 107 hid_err(hdev, "parse failed\n");
108 goto err_free; 108 goto err_free;
109 } 109 }
110 110
111 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 111 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
112 if (ret) { 112 if (ret) {
113 dev_err(&hdev->dev, "hw start failed\n"); 113 hid_err(hdev, "hw start failed\n");
114 goto err_free; 114 goto err_free;
115 } 115 }
116 116
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index eaeca564a8d3..61aa71233392 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -16,6 +16,8 @@
16 * any later version. 16 * any later version.
17 */ 17 */
18 18
19#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20
19#include <linux/device.h> 21#include <linux/device.h>
20#include <linux/hid.h> 22#include <linux/hid.h>
21#include <linux/module.h> 23#include <linux/module.h>
@@ -59,6 +61,27 @@ struct apple_key_translation {
59 u8 flags; 61 u8 flags;
60}; 62};
61 63
64static const struct apple_key_translation macbookair_fn_keys[] = {
65 { KEY_BACKSPACE, KEY_DELETE },
66 { KEY_ENTER, KEY_INSERT },
67 { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
68 { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
69 { KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY },
70 { KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY },
71 { KEY_F6, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY },
72 { KEY_F7, KEY_PLAYPAUSE, APPLE_FLAG_FKEY },
73 { KEY_F8, KEY_NEXTSONG, APPLE_FLAG_FKEY },
74 { KEY_F9, KEY_MUTE, APPLE_FLAG_FKEY },
75 { KEY_F10, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
76 { KEY_F11, KEY_VOLUMEUP, APPLE_FLAG_FKEY },
77 { KEY_F12, KEY_EJECTCD, APPLE_FLAG_FKEY },
78 { KEY_UP, KEY_PAGEUP },
79 { KEY_DOWN, KEY_PAGEDOWN },
80 { KEY_LEFT, KEY_HOME },
81 { KEY_RIGHT, KEY_END },
82 { }
83};
84
62static const struct apple_key_translation apple_fn_keys[] = { 85static const struct apple_key_translation apple_fn_keys[] = {
63 { KEY_BACKSPACE, KEY_DELETE }, 86 { KEY_BACKSPACE, KEY_DELETE },
64 { KEY_ENTER, KEY_INSERT }, 87 { KEY_ENTER, KEY_INSERT },
@@ -146,7 +169,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
146 struct hid_usage *usage, __s32 value) 169 struct hid_usage *usage, __s32 value)
147{ 170{
148 struct apple_sc *asc = hid_get_drvdata(hid); 171 struct apple_sc *asc = hid_get_drvdata(hid);
149 const struct apple_key_translation *trans; 172 const struct apple_key_translation *trans, *table;
150 173
151 if (usage->code == KEY_FN) { 174 if (usage->code == KEY_FN) {
152 asc->fn_on = !!value; 175 asc->fn_on = !!value;
@@ -157,10 +180,16 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
157 if (fnmode) { 180 if (fnmode) {
158 int do_translate; 181 int do_translate;
159 182
160 trans = apple_find_translation((hid->product < 0x21d || 183 if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
161 hid->product >= 0x300) ? 184 hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
162 powerbook_fn_keys : apple_fn_keys, 185 table = macbookair_fn_keys;
163 usage->code); 186 else if (hid->product < 0x21d || hid->product >= 0x300)
187 table = powerbook_fn_keys;
188 else
189 table = apple_fn_keys;
190
191 trans = apple_find_translation (table, usage->code);
192
164 if (trans) { 193 if (trans) {
165 if (test_bit(usage->code, asc->pressed_fn)) 194 if (test_bit(usage->code, asc->pressed_fn))
166 do_translate = 1; 195 do_translate = 1;
@@ -253,8 +282,8 @@ static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
253 282
254 if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 && 283 if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 &&
255 rdesc[53] == 0x65 && rdesc[59] == 0x65) { 284 rdesc[53] == 0x65 && rdesc[59] == 0x65) {
256 dev_info(&hdev->dev, "fixing up MacBook JIS keyboard report " 285 hid_info(hdev,
257 "descriptor\n"); 286 "fixing up MacBook JIS keyboard report descriptor\n");
258 rdesc[53] = rdesc[59] = 0xe7; 287 rdesc[53] = rdesc[59] = 0xe7;
259 } 288 }
260 return rdesc; 289 return rdesc;
@@ -324,7 +353,7 @@ static int apple_probe(struct hid_device *hdev,
324 353
325 asc = kzalloc(sizeof(*asc), GFP_KERNEL); 354 asc = kzalloc(sizeof(*asc), GFP_KERNEL);
326 if (asc == NULL) { 355 if (asc == NULL) {
327 dev_err(&hdev->dev, "can't alloc apple descriptor\n"); 356 hid_err(hdev, "can't alloc apple descriptor\n");
328 return -ENOMEM; 357 return -ENOMEM;
329 } 358 }
330 359
@@ -334,7 +363,7 @@ static int apple_probe(struct hid_device *hdev,
334 363
335 ret = hid_parse(hdev); 364 ret = hid_parse(hdev);
336 if (ret) { 365 if (ret) {
337 dev_err(&hdev->dev, "parse failed\n"); 366 hid_err(hdev, "parse failed\n");
338 goto err_free; 367 goto err_free;
339 } 368 }
340 369
@@ -345,7 +374,7 @@ static int apple_probe(struct hid_device *hdev,
345 374
346 ret = hid_hw_start(hdev, connect_mask); 375 ret = hid_hw_start(hdev, connect_mask);
347 if (ret) { 376 if (ret) {
348 dev_err(&hdev->dev, "hw start failed\n"); 377 hid_err(hdev, "hw start failed\n");
349 goto err_free; 378 goto err_free;
350 } 379 }
351 380
@@ -440,6 +469,18 @@ static const struct hid_device_id apple_devices[] = {
440 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, 469 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
441 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), 470 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
442 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, 471 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
472 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI),
473 .driver_data = APPLE_HAS_FN },
474 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO),
475 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
476 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS),
477 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
478 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI),
479 .driver_data = APPLE_HAS_FN },
480 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO),
481 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
482 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
483 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
443 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), 484 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
444 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, 485 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
445 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), 486 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
@@ -473,7 +514,7 @@ static int __init apple_init(void)
473 514
474 ret = hid_register_driver(&apple_driver); 515 ret = hid_register_driver(&apple_driver);
475 if (ret) 516 if (ret)
476 printk(KERN_ERR "can't register apple driver\n"); 517 pr_err("can't register apple driver\n");
477 518
478 return ret; 519 return ret;
479} 520}
diff --git a/drivers/hid/hid-axff.c b/drivers/hid/hid-axff.c
index f42ee140738a..e5b961d6ff22 100644
--- a/drivers/hid/hid-axff.c
+++ b/drivers/hid/hid-axff.c
@@ -73,14 +73,14 @@ static int axff_init(struct hid_device *hid)
73 int error; 73 int error;
74 74
75 if (list_empty(report_list)) { 75 if (list_empty(report_list)) {
76 dev_err(&hid->dev, "no output reports found\n"); 76 hid_err(hid, "no output reports found\n");
77 return -ENODEV; 77 return -ENODEV;
78 } 78 }
79 79
80 report = list_first_entry(report_list, struct hid_report, list); 80 report = list_first_entry(report_list, struct hid_report, list);
81 81
82 if (report->maxfield < 4) { 82 if (report->maxfield < 4) {
83 dev_err(&hid->dev, "no fields in the report: %d\n", report->maxfield); 83 hid_err(hid, "no fields in the report: %d\n", report->maxfield);
84 return -ENODEV; 84 return -ENODEV;
85 } 85 }
86 86
@@ -101,7 +101,7 @@ static int axff_init(struct hid_device *hid)
101 axff->report->field[3]->value[0] = 0x00; 101 axff->report->field[3]->value[0] = 0x00;
102 usbhid_submit_report(hid, axff->report, USB_DIR_OUT); 102 usbhid_submit_report(hid, axff->report, USB_DIR_OUT);
103 103
104 dev_info(&hid->dev, "Force Feedback for ACRUX game controllers by Sergei Kolzun<x0r@dv-life.ru>\n"); 104 hid_info(hid, "Force Feedback for ACRUX game controllers by Sergei Kolzun<x0r@dv-life.ru>\n");
105 105
106 return 0; 106 return 0;
107 107
@@ -114,17 +114,17 @@ static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id)
114{ 114{
115 int error; 115 int error;
116 116
117 dev_dbg(&hdev->dev, "ACRUX HID hardware probe..."); 117 dev_dbg(&hdev->dev, "ACRUX HID hardware probe...\n");
118 118
119 error = hid_parse(hdev); 119 error = hid_parse(hdev);
120 if (error) { 120 if (error) {
121 dev_err(&hdev->dev, "parse failed\n"); 121 hid_err(hdev, "parse failed\n");
122 return error; 122 return error;
123 } 123 }
124 124
125 error = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 125 error = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
126 if (error) { 126 if (error) {
127 dev_err(&hdev->dev, "hw start failed\n"); 127 hid_err(hdev, "hw start failed\n");
128 return error; 128 return error;
129 } 129 }
130 130
@@ -134,7 +134,7 @@ static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id)
134 * Do not fail device initialization completely as device 134 * Do not fail device initialization completely as device
135 * may still be partially operable, just warn. 135 * may still be partially operable, just warn.
136 */ 136 */
137 dev_warn(&hdev->dev, 137 hid_warn(hdev,
138 "Failed to enable force feedback support, error: %d\n", 138 "Failed to enable force feedback support, error: %d\n",
139 error); 139 error);
140 } 140 }
diff --git a/drivers/hid/hid-belkin.c b/drivers/hid/hid-belkin.c
index 4ce7aa3a519f..a1a765a5b08a 100644
--- a/drivers/hid/hid-belkin.c
+++ b/drivers/hid/hid-belkin.c
@@ -56,14 +56,14 @@ static int belkin_probe(struct hid_device *hdev, const struct hid_device_id *id)
56 56
57 ret = hid_parse(hdev); 57 ret = hid_parse(hdev);
58 if (ret) { 58 if (ret) {
59 dev_err(&hdev->dev, "parse failed\n"); 59 hid_err(hdev, "parse failed\n");
60 goto err_free; 60 goto err_free;
61 } 61 }
62 62
63 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | 63 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT |
64 ((quirks & BELKIN_HIDDEV) ? HID_CONNECT_HIDDEV_FORCE : 0)); 64 ((quirks & BELKIN_HIDDEV) ? HID_CONNECT_HIDDEV_FORCE : 0));
65 if (ret) { 65 if (ret) {
66 dev_err(&hdev->dev, "hw start failed\n"); 66 hid_err(hdev, "hw start failed\n");
67 goto err_free; 67 goto err_free;
68 } 68 }
69 69
diff --git a/drivers/hid/hid-cando.c b/drivers/hid/hid-cando.c
index 5925bdcd417d..375b50929a50 100644
--- a/drivers/hid/hid-cando.c
+++ b/drivers/hid/hid-cando.c
@@ -207,7 +207,7 @@ static int cando_probe(struct hid_device *hdev, const struct hid_device_id *id)
207 207
208 td = kmalloc(sizeof(struct cando_data), GFP_KERNEL); 208 td = kmalloc(sizeof(struct cando_data), GFP_KERNEL);
209 if (!td) { 209 if (!td) {
210 dev_err(&hdev->dev, "cannot allocate Cando Touch data\n"); 210 hid_err(hdev, "cannot allocate Cando Touch data\n");
211 return -ENOMEM; 211 return -ENOMEM;
212 } 212 }
213 hid_set_drvdata(hdev, td); 213 hid_set_drvdata(hdev, td);
diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c
index e880086c2311..888ece68a47c 100644
--- a/drivers/hid/hid-cherry.c
+++ b/drivers/hid/hid-cherry.c
@@ -30,8 +30,7 @@ static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
30 unsigned int *rsize) 30 unsigned int *rsize)
31{ 31{
32 if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { 32 if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {
33 dev_info(&hdev->dev, "fixing up Cherry Cymotion report " 33 hid_info(hdev, "fixing up Cherry Cymotion report descriptor\n");
34 "descriptor\n");
35 rdesc[11] = rdesc[16] = 0xff; 34 rdesc[11] = rdesc[16] = 0xff;
36 rdesc[12] = rdesc[17] = 0x03; 35 rdesc[12] = rdesc[17] = 0x03;
37 } 36 }
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 88cb04e7962b..c4d47e635f95 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -14,6 +14,8 @@
14 * any later version. 14 * any later version.
15 */ 15 */
16 16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
17#include <linux/module.h> 19#include <linux/module.h>
18#include <linux/slab.h> 20#include <linux/slab.h>
19#include <linux/init.h> 21#include <linux/init.h>
@@ -59,7 +61,8 @@ struct hid_report *hid_register_report(struct hid_device *device, unsigned type,
59 if (report_enum->report_id_hash[id]) 61 if (report_enum->report_id_hash[id])
60 return report_enum->report_id_hash[id]; 62 return report_enum->report_id_hash[id];
61 63
62 if (!(report = kzalloc(sizeof(struct hid_report), GFP_KERNEL))) 64 report = kzalloc(sizeof(struct hid_report), GFP_KERNEL);
65 if (!report)
63 return NULL; 66 return NULL;
64 67
65 if (id != 0) 68 if (id != 0)
@@ -90,8 +93,11 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned
90 return NULL; 93 return NULL;
91 } 94 }
92 95
93 if (!(field = kzalloc(sizeof(struct hid_field) + usages * sizeof(struct hid_usage) 96 field = kzalloc((sizeof(struct hid_field) +
94 + values * sizeof(unsigned), GFP_KERNEL))) return NULL; 97 usages * sizeof(struct hid_usage) +
98 values * sizeof(unsigned)), GFP_KERNEL);
99 if (!field)
100 return NULL;
95 101
96 field->index = report->maxfield++; 102 field->index = report->maxfield++;
97 report->field[field->index] = field; 103 report->field[field->index] = field;
@@ -172,10 +178,14 @@ static int close_collection(struct hid_parser *parser)
172 178
173static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) 179static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type)
174{ 180{
181 struct hid_collection *collection = parser->device->collection;
175 int n; 182 int n;
176 for (n = parser->collection_stack_ptr - 1; n >= 0; n--) 183
177 if (parser->device->collection[parser->collection_stack[n]].type == type) 184 for (n = parser->collection_stack_ptr - 1; n >= 0; n--) {
178 return parser->device->collection[parser->collection_stack[n]].usage; 185 unsigned index = parser->collection_stack[n];
186 if (collection[index].type == type)
187 return collection[index].usage;
188 }
179 return 0; /* we know nothing about this usage type */ 189 return 0; /* we know nothing about this usage type */
180} 190}
181 191
@@ -209,7 +219,8 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
209 unsigned offset; 219 unsigned offset;
210 int i; 220 int i;
211 221
212 if (!(report = hid_register_report(parser->device, report_type, parser->global.report_id))) { 222 report = hid_register_report(parser->device, report_type, parser->global.report_id);
223 if (!report) {
213 dbg_hid("hid_register_report failed\n"); 224 dbg_hid("hid_register_report failed\n");
214 return -1; 225 return -1;
215 } 226 }
@@ -227,7 +238,8 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
227 238
228 usages = max_t(int, parser->local.usage_index, parser->global.report_count); 239 usages = max_t(int, parser->local.usage_index, parser->global.report_count);
229 240
230 if ((field = hid_register_field(report, usages, parser->global.report_count)) == NULL) 241 field = hid_register_field(report, usages, parser->global.report_count);
242 if (!field)
231 return 0; 243 return 0;
232 244
233 field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL); 245 field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL);
@@ -652,13 +664,12 @@ int hid_parse_report(struct hid_device *device, __u8 *start,
652 return -ENOMEM; 664 return -ENOMEM;
653 device->rsize = size; 665 device->rsize = size;
654 666
655 parser = vmalloc(sizeof(struct hid_parser)); 667 parser = vzalloc(sizeof(struct hid_parser));
656 if (!parser) { 668 if (!parser) {
657 ret = -ENOMEM; 669 ret = -ENOMEM;
658 goto err; 670 goto err;
659 } 671 }
660 672
661 memset(parser, 0, sizeof(struct hid_parser));
662 parser->device = device; 673 parser->device = device;
663 674
664 end = start + size; 675 end = start + size;
@@ -672,7 +683,8 @@ int hid_parse_report(struct hid_device *device, __u8 *start,
672 683
673 if (dispatch_type[item.type](parser, &item)) { 684 if (dispatch_type[item.type](parser, &item)) {
674 dbg_hid("item %u %u %u %u parsing failed\n", 685 dbg_hid("item %u %u %u %u parsing failed\n",
675 item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); 686 item.format, (unsigned)item.size,
687 (unsigned)item.type, (unsigned)item.tag);
676 goto err; 688 goto err;
677 } 689 }
678 690
@@ -737,13 +749,14 @@ static u32 s32ton(__s32 value, unsigned n)
737 * Search linux-kernel and linux-usb-devel archives for "hid-core extract". 749 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
738 */ 750 */
739 751
740static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) 752static __u32 extract(const struct hid_device *hid, __u8 *report,
753 unsigned offset, unsigned n)
741{ 754{
742 u64 x; 755 u64 x;
743 756
744 if (n > 32) 757 if (n > 32)
745 printk(KERN_WARNING "HID: extract() called with n (%d) > 32! (%s)\n", 758 hid_warn(hid, "extract() called with n (%d) > 32! (%s)\n",
746 n, current->comm); 759 n, current->comm);
747 760
748 report += offset >> 3; /* adjust byte index */ 761 report += offset >> 3; /* adjust byte index */
749 offset &= 7; /* now only need bit offset into one byte */ 762 offset &= 7; /* now only need bit offset into one byte */
@@ -760,18 +773,19 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
760 * endianness of register values by considering a register 773 * endianness of register values by considering a register
761 * a "cached" copy of the little endiad bit stream. 774 * a "cached" copy of the little endiad bit stream.
762 */ 775 */
763static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value) 776static void implement(const struct hid_device *hid, __u8 *report,
777 unsigned offset, unsigned n, __u32 value)
764{ 778{
765 u64 x; 779 u64 x;
766 u64 m = (1ULL << n) - 1; 780 u64 m = (1ULL << n) - 1;
767 781
768 if (n > 32) 782 if (n > 32)
769 printk(KERN_WARNING "HID: implement() called with n (%d) > 32! (%s)\n", 783 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n",
770 n, current->comm); 784 __func__, n, current->comm);
771 785
772 if (value > m) 786 if (value > m)
773 printk(KERN_WARNING "HID: implement() called with too large value %d! (%s)\n", 787 hid_warn(hid, "%s() called with too large value %d! (%s)\n",
774 value, current->comm); 788 __func__, value, current->comm);
775 WARN_ON(value > m); 789 WARN_ON(value > m);
776 value &= m; 790 value &= m;
777 791
@@ -788,7 +802,7 @@ static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u3
788 * Search an array for a value. 802 * Search an array for a value.
789 */ 803 */
790 804
791static __inline__ int search(__s32 *array, __s32 value, unsigned n) 805static int search(__s32 *array, __s32 value, unsigned n)
792{ 806{
793 while (n--) { 807 while (n--) {
794 if (*array++ == value) 808 if (*array++ == value)
@@ -887,18 +901,22 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field,
887 __s32 max = field->logical_maximum; 901 __s32 max = field->logical_maximum;
888 __s32 *value; 902 __s32 *value;
889 903
890 if (!(value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC))) 904 value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC);
905 if (!value)
891 return; 906 return;
892 907
893 for (n = 0; n < count; n++) { 908 for (n = 0; n < count; n++) {
894 909
895 value[n] = min < 0 ? snto32(extract(data, offset + n * size, size), size) : 910 value[n] = min < 0 ?
896 extract(data, offset + n * size, size); 911 snto32(extract(hid, data, offset + n * size, size),
912 size) :
913 extract(hid, data, offset + n * size, size);
897 914
898 if (!(field->flags & HID_MAIN_ITEM_VARIABLE) /* Ignore report if ErrorRollOver */ 915 /* Ignore report if ErrorRollOver */
899 && value[n] >= min && value[n] <= max 916 if (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&
900 && field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) 917 value[n] >= min && value[n] <= max &&
901 goto exit; 918 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
919 goto exit;
902 } 920 }
903 921
904 for (n = 0; n < count; n++) { 922 for (n = 0; n < count; n++) {
@@ -928,7 +946,8 @@ exit:
928 * Output the field into the report. 946 * Output the field into the report.
929 */ 947 */
930 948
931static void hid_output_field(struct hid_field *field, __u8 *data) 949static void hid_output_field(const struct hid_device *hid,
950 struct hid_field *field, __u8 *data)
932{ 951{
933 unsigned count = field->report_count; 952 unsigned count = field->report_count;
934 unsigned offset = field->report_offset; 953 unsigned offset = field->report_offset;
@@ -937,9 +956,11 @@ static void hid_output_field(struct hid_field *field, __u8 *data)
937 956
938 for (n = 0; n < count; n++) { 957 for (n = 0; n < count; n++) {
939 if (field->logical_minimum < 0) /* signed values */ 958 if (field->logical_minimum < 0) /* signed values */
940 implement(data, offset + n * size, size, s32ton(field->value[n], size)); 959 implement(hid, data, offset + n * size, size,
960 s32ton(field->value[n], size));
941 else /* unsigned values */ 961 else /* unsigned values */
942 implement(data, offset + n * size, size, field->value[n]); 962 implement(hid, data, offset + n * size, size,
963 field->value[n]);
943 } 964 }
944} 965}
945 966
@@ -956,7 +977,7 @@ void hid_output_report(struct hid_report *report, __u8 *data)
956 977
957 memset(data, 0, ((report->size - 1) >> 3) + 1); 978 memset(data, 0, ((report->size - 1) >> 3) + 1);
958 for (n = 0; n < report->maxfield; n++) 979 for (n = 0; n < report->maxfield; n++)
959 hid_output_field(report->field[n], data); 980 hid_output_field(report->device, report->field[n], data);
960} 981}
961EXPORT_SYMBOL_GPL(hid_output_report); 982EXPORT_SYMBOL_GPL(hid_output_report);
962 983
@@ -1169,8 +1190,7 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
1169 hdev->claimed |= HID_CLAIMED_HIDRAW; 1190 hdev->claimed |= HID_CLAIMED_HIDRAW;
1170 1191
1171 if (!hdev->claimed) { 1192 if (!hdev->claimed) {
1172 dev_err(&hdev->dev, "claimed by neither input, hiddev nor " 1193 hid_err(hdev, "claimed by neither input, hiddev nor hidraw\n");
1173 "hidraw\n");
1174 return -ENODEV; 1194 return -ENODEV;
1175 } 1195 }
1176 1196
@@ -1210,9 +1230,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
1210 bus = "<UNKNOWN>"; 1230 bus = "<UNKNOWN>";
1211 } 1231 }
1212 1232
1213 dev_info(&hdev->dev, "%s: %s HID v%x.%02x %s [%s] on %s\n", 1233 hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n",
1214 buf, bus, hdev->version >> 8, hdev->version & 0xff, 1234 buf, bus, hdev->version >> 8, hdev->version & 0xff,
1215 type, hdev->name, hdev->phys); 1235 type, hdev->name, hdev->phys);
1216 1236
1217 return 0; 1237 return 0;
1218} 1238}
@@ -1230,7 +1250,7 @@ void hid_disconnect(struct hid_device *hdev)
1230EXPORT_SYMBOL_GPL(hid_disconnect); 1250EXPORT_SYMBOL_GPL(hid_disconnect);
1231 1251
1232/* a list of devices for which there is a specialized driver on HID bus */ 1252/* a list of devices for which there is a specialized driver on HID bus */
1233static const struct hid_device_id hid_blacklist[] = { 1253static const struct hid_device_id hid_have_special_driver[] = {
1234 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) }, 1254 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) },
1235 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) }, 1255 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) },
1236 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 1256 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
@@ -1276,6 +1296,12 @@ static const struct hid_device_id hid_blacklist[] = {
1276 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, 1296 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
1277 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, 1297 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
1278 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, 1298 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
1299 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) },
1300 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) },
1301 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) },
1302 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
1303 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
1304 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
1279 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, 1305 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
1280 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, 1306 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
1281 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, 1307 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
@@ -1292,6 +1318,7 @@ static const struct hid_device_id hid_blacklist[] = {
1292 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 1318 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
1293 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, 1319 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) },
1294 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, 1320 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
1321 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
1295 { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, 1322 { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) },
1296 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 1323 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
1297 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1324 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
@@ -1301,6 +1328,7 @@ static const struct hid_device_id hid_blacklist[] = {
1301 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, 1328 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
1302 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) }, 1329 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
1303 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, 1330 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
1331 { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) },
1304 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1332 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1305 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1333 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
1306 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, 1334 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
@@ -1496,9 +1524,9 @@ static int hid_bus_match(struct device *dev, struct device_driver *drv)
1496 if (!hid_match_device(hdev, hdrv)) 1524 if (!hid_match_device(hdev, hdrv))
1497 return 0; 1525 return 0;
1498 1526
1499 /* generic wants all non-blacklisted */ 1527 /* generic wants all that don't have specialized driver */
1500 if (!strncmp(hdrv->name, "generic-", 8)) 1528 if (!strncmp(hdrv->name, "generic-", 8))
1501 return !hid_match_id(hdev, hid_blacklist); 1529 return !hid_match_id(hdev, hid_have_special_driver);
1502 1530
1503 return 1; 1531 return 1;
1504} 1532}
@@ -1757,6 +1785,12 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
1757 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, 1785 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
1758 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, 1786 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
1759 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, 1787 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
1788 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) },
1789 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) },
1790 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) },
1791 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
1792 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
1793 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
1760 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1794 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1761 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1795 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1762 { } 1796 { }
@@ -1948,12 +1982,12 @@ static int __init hid_init(void)
1948 int ret; 1982 int ret;
1949 1983
1950 if (hid_debug) 1984 if (hid_debug)
1951 printk(KERN_WARNING "HID: hid_debug is now used solely for parser and driver debugging.\n" 1985 pr_warn("hid_debug is now used solely for parser and driver debugging.\n"
1952 "HID: debugfs is now used for inspecting the device (report descriptor, reports)\n"); 1986 "debugfs is now used for inspecting the device (report descriptor, reports)\n");
1953 1987
1954 ret = bus_register(&hid_bus_type); 1988 ret = bus_register(&hid_bus_type);
1955 if (ret) { 1989 if (ret) {
1956 printk(KERN_ERR "HID: can't register hid bus\n"); 1990 pr_err("can't register hid bus\n");
1957 goto err; 1991 goto err;
1958 } 1992 }
1959 1993
diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c
index 4cd0e2345991..2f0be4c66af7 100644
--- a/drivers/hid/hid-cypress.c
+++ b/drivers/hid/hid-cypress.c
@@ -107,13 +107,13 @@ static int cp_probe(struct hid_device *hdev, const struct hid_device_id *id)
107 107
108 ret = hid_parse(hdev); 108 ret = hid_parse(hdev);
109 if (ret) { 109 if (ret) {
110 dev_err(&hdev->dev, "parse failed\n"); 110 hid_err(hdev, "parse failed\n");
111 goto err_free; 111 goto err_free;
112 } 112 }
113 113
114 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 114 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
115 if (ret) { 115 if (ret) {
116 dev_err(&hdev->dev, "hw start failed\n"); 116 hid_err(hdev, "hw start failed\n");
117 goto err_free; 117 goto err_free;
118 } 118 }
119 119
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 75c5e23d09d2..555382fc7417 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -26,6 +26,8 @@
26 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic 26 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
27 */ 27 */
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30
29#include <linux/debugfs.h> 31#include <linux/debugfs.h>
30#include <linux/seq_file.h> 32#include <linux/seq_file.h>
31#include <linux/sched.h> 33#include <linux/sched.h>
@@ -393,7 +395,7 @@ char *hid_resolv_usage(unsigned usage, struct seq_file *f) {
393 395
394 buf = resolv_usage_page(usage >> 16, f); 396 buf = resolv_usage_page(usage >> 16, f);
395 if (IS_ERR(buf)) { 397 if (IS_ERR(buf)) {
396 printk(KERN_ERR "error allocating HID debug buffer\n"); 398 pr_err("error allocating HID debug buffer\n");
397 return NULL; 399 return NULL;
398 } 400 }
399 401
diff --git a/drivers/hid/hid-drff.c b/drivers/hid/hid-drff.c
index 968b04f9b796..afcf3d67eb02 100644
--- a/drivers/hid/hid-drff.c
+++ b/drivers/hid/hid-drff.c
@@ -96,18 +96,18 @@ static int drff_init(struct hid_device *hid)
96 int error; 96 int error;
97 97
98 if (list_empty(report_list)) { 98 if (list_empty(report_list)) {
99 dev_err(&hid->dev, "no output reports found\n"); 99 hid_err(hid, "no output reports found\n");
100 return -ENODEV; 100 return -ENODEV;
101 } 101 }
102 102
103 report = list_first_entry(report_list, struct hid_report, list); 103 report = list_first_entry(report_list, struct hid_report, list);
104 if (report->maxfield < 1) { 104 if (report->maxfield < 1) {
105 dev_err(&hid->dev, "no fields in the report\n"); 105 hid_err(hid, "no fields in the report\n");
106 return -ENODEV; 106 return -ENODEV;
107 } 107 }
108 108
109 if (report->field[0]->report_count < 7) { 109 if (report->field[0]->report_count < 7) {
110 dev_err(&hid->dev, "not enough values in the field\n"); 110 hid_err(hid, "not enough values in the field\n");
111 return -ENODEV; 111 return -ENODEV;
112 } 112 }
113 113
@@ -133,8 +133,8 @@ static int drff_init(struct hid_device *hid)
133 drff->report->field[0]->value[6] = 0x00; 133 drff->report->field[0]->value[6] = 0x00;
134 usbhid_submit_report(hid, drff->report, USB_DIR_OUT); 134 usbhid_submit_report(hid, drff->report, USB_DIR_OUT);
135 135
136 dev_info(&hid->dev, "Force Feedback for DragonRise Inc. game " 136 hid_info(hid, "Force Feedback for DragonRise Inc. "
137 "controllers by Richard Walmsley <richwalm@gmail.com>\n"); 137 "game controllers by Richard Walmsley <richwalm@gmail.com>\n");
138 138
139 return 0; 139 return 0;
140} 140}
@@ -153,13 +153,13 @@ static int dr_probe(struct hid_device *hdev, const struct hid_device_id *id)
153 153
154 ret = hid_parse(hdev); 154 ret = hid_parse(hdev);
155 if (ret) { 155 if (ret) {
156 dev_err(&hdev->dev, "parse failed\n"); 156 hid_err(hdev, "parse failed\n");
157 goto err; 157 goto err;
158 } 158 }
159 159
160 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 160 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
161 if (ret) { 161 if (ret) {
162 dev_err(&hdev->dev, "hw start failed\n"); 162 hid_err(hdev, "hw start failed\n");
163 goto err; 163 goto err;
164 } 164 }
165 165
diff --git a/drivers/hid/hid-egalax.c b/drivers/hid/hid-egalax.c
index 5a1b52e0eb85..72b1dd8d16ce 100644
--- a/drivers/hid/hid-egalax.c
+++ b/drivers/hid/hid-egalax.c
@@ -223,7 +223,7 @@ static int egalax_probe(struct hid_device *hdev, const struct hid_device_id *id)
223 223
224 td = kzalloc(sizeof(struct egalax_data), GFP_KERNEL); 224 td = kzalloc(sizeof(struct egalax_data), GFP_KERNEL);
225 if (!td) { 225 if (!td) {
226 dev_err(&hdev->dev, "cannot allocate eGalax data\n"); 226 hid_err(hdev, "cannot allocate eGalax data\n");
227 return -ENOMEM; 227 return -ENOMEM;
228 } 228 }
229 hid_set_drvdata(hdev, td); 229 hid_set_drvdata(hdev, td);
diff --git a/drivers/hid/hid-elecom.c b/drivers/hid/hid-elecom.c
index 6e31f305397d..79d0c61e7214 100644
--- a/drivers/hid/hid-elecom.c
+++ b/drivers/hid/hid-elecom.c
@@ -24,8 +24,7 @@ static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
24 unsigned int *rsize) 24 unsigned int *rsize)
25{ 25{
26 if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) { 26 if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) {
27 dev_info(&hdev->dev, "Fixing up Elecom BM084 " 27 hid_info(hdev, "Fixing up Elecom BM084 report descriptor\n");
28 "report descriptor.\n");
29 rdesc[47] = 0x00; 28 rdesc[47] = 0x00;
30 } 29 }
31 return rdesc; 30 return rdesc;
diff --git a/drivers/hid/hid-emsff.c b/drivers/hid/hid-emsff.c
new file mode 100644
index 000000000000..81877c67caea
--- /dev/null
+++ b/drivers/hid/hid-emsff.c
@@ -0,0 +1,161 @@
1/*
2 * Force feedback support for EMS Trio Linker Plus II
3 *
4 * Copyright (c) 2010 Ignaz Forster <ignaz.forster@gmx.de>
5 */
6
7/*
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23
24#include <linux/hid.h>
25#include <linux/input.h>
26#include <linux/usb.h>
27
28#include "hid-ids.h"
29#include "usbhid/usbhid.h"
30
31struct emsff_device {
32 struct hid_report *report;
33};
34
35static int emsff_play(struct input_dev *dev, void *data,
36 struct ff_effect *effect)
37{
38 struct hid_device *hid = input_get_drvdata(dev);
39 struct emsff_device *emsff = data;
40 int weak, strong;
41
42 weak = effect->u.rumble.weak_magnitude;
43 strong = effect->u.rumble.strong_magnitude;
44
45 dbg_hid("called with 0x%04x 0x%04x\n", strong, weak);
46
47 weak = weak * 0xff / 0xffff;
48 strong = strong * 0xff / 0xffff;
49
50 emsff->report->field[0]->value[1] = weak;
51 emsff->report->field[0]->value[2] = strong;
52
53 dbg_hid("running with 0x%02x 0x%02x\n", strong, weak);
54 usbhid_submit_report(hid, emsff->report, USB_DIR_OUT);
55
56 return 0;
57}
58
59static int emsff_init(struct hid_device *hid)
60{
61 struct emsff_device *emsff;
62 struct hid_report *report;
63 struct hid_input *hidinput = list_first_entry(&hid->inputs,
64 struct hid_input, list);
65 struct list_head *report_list =
66 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
67 struct input_dev *dev = hidinput->input;
68 int error;
69
70 if (list_empty(report_list)) {
71 hid_err(hid, "no output reports found\n");
72 return -ENODEV;
73 }
74
75 report = list_first_entry(report_list, struct hid_report, list);
76 if (report->maxfield < 1) {
77 hid_err(hid, "no fields in the report\n");
78 return -ENODEV;
79 }
80
81 if (report->field[0]->report_count < 7) {
82 hid_err(hid, "not enough values in the field\n");
83 return -ENODEV;
84 }
85
86 emsff = kzalloc(sizeof(struct emsff_device), GFP_KERNEL);
87 if (!emsff)
88 return -ENOMEM;
89
90 set_bit(FF_RUMBLE, dev->ffbit);
91
92 error = input_ff_create_memless(dev, emsff, emsff_play);
93 if (error) {
94 kfree(emsff);
95 return error;
96 }
97
98 emsff->report = report;
99 emsff->report->field[0]->value[0] = 0x01;
100 emsff->report->field[0]->value[1] = 0x00;
101 emsff->report->field[0]->value[2] = 0x00;
102 emsff->report->field[0]->value[3] = 0x00;
103 emsff->report->field[0]->value[4] = 0x00;
104 emsff->report->field[0]->value[5] = 0x00;
105 emsff->report->field[0]->value[6] = 0x00;
106 usbhid_submit_report(hid, emsff->report, USB_DIR_OUT);
107
108 hid_info(hid, "force feedback for EMS based devices by Ignaz Forster <ignaz.forster@gmx.de>\n");
109
110 return 0;
111}
112
113static int ems_probe(struct hid_device *hdev, const struct hid_device_id *id)
114{
115 int ret;
116
117 ret = hid_parse(hdev);
118 if (ret) {
119 hid_err(hdev, "parse failed\n");
120 goto err;
121 }
122
123 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
124 if (ret) {
125 hid_err(hdev, "hw start failed\n");
126 goto err;
127 }
128
129 emsff_init(hdev);
130
131 return 0;
132err:
133 return ret;
134}
135
136static const struct hid_device_id ems_devices[] = {
137 { HID_USB_DEVICE(USB_VENDOR_ID_EMS, 0x118) },
138 { }
139};
140MODULE_DEVICE_TABLE(hid, ems_devices);
141
142static struct hid_driver ems_driver = {
143 .name = "hkems",
144 .id_table = ems_devices,
145 .probe = ems_probe,
146};
147
148static int ems_init(void)
149{
150 return hid_register_driver(&ems_driver);
151}
152
153static void ems_exit(void)
154{
155 hid_unregister_driver(&ems_driver);
156}
157
158module_init(ems_init);
159module_exit(ems_exit);
160MODULE_LICENSE("GPL");
161
diff --git a/drivers/hid/hid-gaff.c b/drivers/hid/hid-gaff.c
index 88dfcf49a5d7..279ba530003c 100644
--- a/drivers/hid/hid-gaff.c
+++ b/drivers/hid/hid-gaff.c
@@ -87,7 +87,7 @@ static int gaff_init(struct hid_device *hid)
87 int error; 87 int error;
88 88
89 if (list_empty(report_list)) { 89 if (list_empty(report_list)) {
90 dev_err(&hid->dev, "no output reports found\n"); 90 hid_err(hid, "no output reports found\n");
91 return -ENODEV; 91 return -ENODEV;
92 } 92 }
93 93
@@ -95,12 +95,12 @@ static int gaff_init(struct hid_device *hid)
95 95
96 report = list_entry(report_ptr, struct hid_report, list); 96 report = list_entry(report_ptr, struct hid_report, list);
97 if (report->maxfield < 1) { 97 if (report->maxfield < 1) {
98 dev_err(&hid->dev, "no fields in the report\n"); 98 hid_err(hid, "no fields in the report\n");
99 return -ENODEV; 99 return -ENODEV;
100 } 100 }
101 101
102 if (report->field[0]->report_count < 6) { 102 if (report->field[0]->report_count < 6) {
103 dev_err(&hid->dev, "not enough values in the field\n"); 103 hid_err(hid, "not enough values in the field\n");
104 return -ENODEV; 104 return -ENODEV;
105 } 105 }
106 106
@@ -128,8 +128,7 @@ static int gaff_init(struct hid_device *hid)
128 128
129 usbhid_submit_report(hid, gaff->report, USB_DIR_OUT); 129 usbhid_submit_report(hid, gaff->report, USB_DIR_OUT);
130 130
131 dev_info(&hid->dev, "Force Feedback for GreenAsia 0x12" 131 hid_info(hid, "Force Feedback for GreenAsia 0x12 devices by Lukasz Lubojanski <lukasz@lubojanski.info>\n");
132 " devices by Lukasz Lubojanski <lukasz@lubojanski.info>\n");
133 132
134 return 0; 133 return 0;
135} 134}
@@ -148,13 +147,13 @@ static int ga_probe(struct hid_device *hdev, const struct hid_device_id *id)
148 147
149 ret = hid_parse(hdev); 148 ret = hid_parse(hdev);
150 if (ret) { 149 if (ret) {
151 dev_err(&hdev->dev, "parse failed\n"); 150 hid_err(hdev, "parse failed\n");
152 goto err; 151 goto err;
153 } 152 }
154 153
155 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 154 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
156 if (ret) { 155 if (ret) {
157 dev_err(&hdev->dev, "hw start failed\n"); 156 hid_err(hdev, "hw start failed\n");
158 goto err; 157 goto err;
159 } 158 }
160 159
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 3341baa86a30..5cd1a6a356a3 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -97,6 +97,12 @@
97#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 97#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
98#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 98#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
99#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 99#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
100#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f
101#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240
102#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241
103#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242
104#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243
105#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244
100#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 106#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
101#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a 107#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
102#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b 108#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
@@ -156,6 +162,7 @@
156#define USB_VENDOR_ID_CHICONY 0x04f2 162#define USB_VENDOR_ID_CHICONY 0x04f2
157#define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 163#define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418
158#define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d 164#define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d
165#define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618
159 166
160#define USB_VENDOR_ID_CIDC 0x1677 167#define USB_VENDOR_ID_CIDC 0x1677
161 168
@@ -203,6 +210,9 @@
203#define USB_VENDOR_ID_ELO 0x04E7 210#define USB_VENDOR_ID_ELO 0x04E7
204#define USB_DEVICE_ID_ELO_TS2700 0x0020 211#define USB_DEVICE_ID_ELO_TS2700 0x0020
205 212
213#define USB_VENDOR_ID_EMS 0x2006
214#define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118
215
206#define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f 216#define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f
207#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 217#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
208 218
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index d8d372bae3cc..c0757821b1fc 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -817,14 +817,14 @@ static int hidinput_open(struct input_dev *dev)
817{ 817{
818 struct hid_device *hid = input_get_drvdata(dev); 818 struct hid_device *hid = input_get_drvdata(dev);
819 819
820 return hid->ll_driver->open(hid); 820 return hid_hw_open(hid);
821} 821}
822 822
823static void hidinput_close(struct input_dev *dev) 823static void hidinput_close(struct input_dev *dev)
824{ 824{
825 struct hid_device *hid = input_get_drvdata(dev); 825 struct hid_device *hid = input_get_drvdata(dev);
826 826
827 hid->ll_driver->close(hid); 827 hid_hw_close(hid);
828} 828}
829 829
830/* 830/*
@@ -871,7 +871,7 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
871 if (!hidinput || !input_dev) { 871 if (!hidinput || !input_dev) {
872 kfree(hidinput); 872 kfree(hidinput);
873 input_free_device(input_dev); 873 input_free_device(input_dev);
874 err_hid("Out of memory during hid input probe"); 874 hid_err(hid, "Out of memory during hid input probe\n");
875 goto out_unwind; 875 goto out_unwind;
876 } 876 }
877 877
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c
index 817247ee006c..f2ba9efc3a53 100644
--- a/drivers/hid/hid-kye.c
+++ b/drivers/hid/hid-kye.c
@@ -32,8 +32,8 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
32 rdesc[65] == 0x29 && rdesc[66] == 0x0f && 32 rdesc[65] == 0x29 && rdesc[66] == 0x0f &&
33 rdesc[71] == 0x75 && rdesc[72] == 0x08 && 33 rdesc[71] == 0x75 && rdesc[72] == 0x08 &&
34 rdesc[73] == 0x95 && rdesc[74] == 0x01) { 34 rdesc[73] == 0x95 && rdesc[74] == 0x01) {
35 dev_info(&hdev->dev, "fixing up Kye/Genius Ergo Mouse report " 35 hid_info(hdev,
36 "descriptor\n"); 36 "fixing up Kye/Genius Ergo Mouse report descriptor\n");
37 rdesc[62] = 0x09; 37 rdesc[62] = 0x09;
38 rdesc[64] = 0x04; 38 rdesc[64] = 0x04;
39 rdesc[66] = 0x07; 39 rdesc[66] = 0x07;
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index b629fba5a057..aef4104da141 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -53,23 +53,22 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
53 53
54 if ((quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 && 54 if ((quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 &&
55 rdesc[84] == 0x8c && rdesc[85] == 0x02) { 55 rdesc[84] == 0x8c && rdesc[85] == 0x02) {
56 dev_info(&hdev->dev, "fixing up Logitech keyboard report " 56 hid_info(hdev,
57 "descriptor\n"); 57 "fixing up Logitech keyboard report descriptor\n");
58 rdesc[84] = rdesc[89] = 0x4d; 58 rdesc[84] = rdesc[89] = 0x4d;
59 rdesc[85] = rdesc[90] = 0x10; 59 rdesc[85] = rdesc[90] = 0x10;
60 } 60 }
61 if ((quirks & LG_RDESC_REL_ABS) && *rsize >= 50 && 61 if ((quirks & LG_RDESC_REL_ABS) && *rsize >= 50 &&
62 rdesc[32] == 0x81 && rdesc[33] == 0x06 && 62 rdesc[32] == 0x81 && rdesc[33] == 0x06 &&
63 rdesc[49] == 0x81 && rdesc[50] == 0x06) { 63 rdesc[49] == 0x81 && rdesc[50] == 0x06) {
64 dev_info(&hdev->dev, "fixing up rel/abs in Logitech " 64 hid_info(hdev,
65 "report descriptor\n"); 65 "fixing up rel/abs in Logitech report descriptor\n");
66 rdesc[33] = rdesc[50] = 0x02; 66 rdesc[33] = rdesc[50] = 0x02;
67 } 67 }
68 if ((quirks & LG_FF4) && *rsize >= 101 && 68 if ((quirks & LG_FF4) && *rsize >= 101 &&
69 rdesc[41] == 0x95 && rdesc[42] == 0x0B && 69 rdesc[41] == 0x95 && rdesc[42] == 0x0B &&
70 rdesc[47] == 0x05 && rdesc[48] == 0x09) { 70 rdesc[47] == 0x05 && rdesc[48] == 0x09) {
71 dev_info(&hdev->dev, "fixing up Logitech Speed Force Wireless " 71 hid_info(hdev, "fixing up Logitech Speed Force Wireless button descriptor\n");
72 "button descriptor\n");
73 rdesc[41] = 0x05; 72 rdesc[41] = 0x05;
74 rdesc[42] = 0x09; 73 rdesc[42] = 0x09;
75 rdesc[47] = 0x95; 74 rdesc[47] = 0x95;
@@ -288,7 +287,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
288 287
289 ret = hid_parse(hdev); 288 ret = hid_parse(hdev);
290 if (ret) { 289 if (ret) {
291 dev_err(&hdev->dev, "parse failed\n"); 290 hid_err(hdev, "parse failed\n");
292 goto err_free; 291 goto err_free;
293 } 292 }
294 293
@@ -297,7 +296,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
297 296
298 ret = hid_hw_start(hdev, connect_mask); 297 ret = hid_hw_start(hdev, connect_mask);
299 if (ret) { 298 if (ret) {
300 dev_err(&hdev->dev, "hw start failed\n"); 299 hid_err(hdev, "hw start failed\n");
301 goto err_free; 300 goto err_free;
302 } 301 }
303 302
diff --git a/drivers/hid/hid-lg2ff.c b/drivers/hid/hid-lg2ff.c
index 4258253c36b3..3c31bc650e5d 100644
--- a/drivers/hid/hid-lg2ff.c
+++ b/drivers/hid/hid-lg2ff.c
@@ -72,18 +72,18 @@ int lg2ff_init(struct hid_device *hid)
72 int error; 72 int error;
73 73
74 if (list_empty(report_list)) { 74 if (list_empty(report_list)) {
75 dev_err(&hid->dev, "no output report found\n"); 75 hid_err(hid, "no output report found\n");
76 return -ENODEV; 76 return -ENODEV;
77 } 77 }
78 78
79 report = list_entry(report_list->next, struct hid_report, list); 79 report = list_entry(report_list->next, struct hid_report, list);
80 80
81 if (report->maxfield < 1) { 81 if (report->maxfield < 1) {
82 dev_err(&hid->dev, "output report is empty\n"); 82 hid_err(hid, "output report is empty\n");
83 return -ENODEV; 83 return -ENODEV;
84 } 84 }
85 if (report->field[0]->report_count < 7) { 85 if (report->field[0]->report_count < 7) {
86 dev_err(&hid->dev, "not enough values in the field\n"); 86 hid_err(hid, "not enough values in the field\n");
87 return -ENODEV; 87 return -ENODEV;
88 } 88 }
89 89
@@ -110,8 +110,7 @@ int lg2ff_init(struct hid_device *hid)
110 110
111 usbhid_submit_report(hid, report, USB_DIR_OUT); 111 usbhid_submit_report(hid, report, USB_DIR_OUT);
112 112
113 dev_info(&hid->dev, "Force feedback for Logitech RumblePad/Rumblepad 2 by " 113 hid_info(hid, "Force feedback for Logitech RumblePad/Rumblepad 2 by Anssi Hannula <anssi.hannula@gmail.com>\n");
114 "Anssi Hannula <anssi.hannula@gmail.com>\n");
115 114
116 return 0; 115 return 0;
117} 116}
diff --git a/drivers/hid/hid-lg3ff.c b/drivers/hid/hid-lg3ff.c
index 4002832ee4af..f98644c26c1d 100644
--- a/drivers/hid/hid-lg3ff.c
+++ b/drivers/hid/hid-lg3ff.c
@@ -141,20 +141,20 @@ int lg3ff_init(struct hid_device *hid)
141 141
142 /* Find the report to use */ 142 /* Find the report to use */
143 if (list_empty(report_list)) { 143 if (list_empty(report_list)) {
144 err_hid("No output report found"); 144 hid_err(hid, "No output report found\n");
145 return -1; 145 return -1;
146 } 146 }
147 147
148 /* Check that the report looks ok */ 148 /* Check that the report looks ok */
149 report = list_entry(report_list->next, struct hid_report, list); 149 report = list_entry(report_list->next, struct hid_report, list);
150 if (!report) { 150 if (!report) {
151 err_hid("NULL output report"); 151 hid_err(hid, "NULL output report\n");
152 return -1; 152 return -1;
153 } 153 }
154 154
155 field = report->field[0]; 155 field = report->field[0];
156 if (!field) { 156 if (!field) {
157 err_hid("NULL field"); 157 hid_err(hid, "NULL field\n");
158 return -1; 158 return -1;
159 } 159 }
160 160
@@ -169,8 +169,7 @@ int lg3ff_init(struct hid_device *hid)
169 if (test_bit(FF_AUTOCENTER, dev->ffbit)) 169 if (test_bit(FF_AUTOCENTER, dev->ffbit))
170 dev->ff->set_autocenter = hid_lg3ff_set_autocenter; 170 dev->ff->set_autocenter = hid_lg3ff_set_autocenter;
171 171
172 dev_info(&hid->dev, "Force feedback for Logitech Flight System G940 by " 172 hid_info(hid, "Force feedback for Logitech Flight System G940 by Gary Stein <LordCnidarian@gmail.com>\n");
173 "Gary Stein <LordCnidarian@gmail.com>\n");
174 return 0; 173 return 0;
175} 174}
176 175
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 7eef5a2ce948..fa550c8e1d1b 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -101,20 +101,20 @@ int lg4ff_init(struct hid_device *hid)
101 101
102 /* Find the report to use */ 102 /* Find the report to use */
103 if (list_empty(report_list)) { 103 if (list_empty(report_list)) {
104 err_hid("No output report found"); 104 hid_err(hid, "No output report found\n");
105 return -1; 105 return -1;
106 } 106 }
107 107
108 /* Check that the report looks ok */ 108 /* Check that the report looks ok */
109 report = list_entry(report_list->next, struct hid_report, list); 109 report = list_entry(report_list->next, struct hid_report, list);
110 if (!report) { 110 if (!report) {
111 err_hid("NULL output report"); 111 hid_err(hid, "NULL output report\n");
112 return -1; 112 return -1;
113 } 113 }
114 114
115 field = report->field[0]; 115 field = report->field[0];
116 if (!field) { 116 if (!field) {
117 err_hid("NULL field"); 117 hid_err(hid, "NULL field\n");
118 return -1; 118 return -1;
119 } 119 }
120 120
@@ -129,8 +129,7 @@ int lg4ff_init(struct hid_device *hid)
129 if (test_bit(FF_AUTOCENTER, dev->ffbit)) 129 if (test_bit(FF_AUTOCENTER, dev->ffbit))
130 dev->ff->set_autocenter = hid_lg4ff_set_autocenter; 130 dev->ff->set_autocenter = hid_lg4ff_set_autocenter;
131 131
132 dev_info(&hid->dev, "Force feedback for Logitech Speed Force Wireless by " 132 hid_info(hid, "Force feedback for Logitech Speed Force Wireless by Simon Wood <simon@mungewell.org>\n");
133 "Simon Wood <simon@mungewell.org>\n");
134 return 0; 133 return 0;
135} 134}
136 135
diff --git a/drivers/hid/hid-lgff.c b/drivers/hid/hid-lgff.c
index 61142b76a9b1..90d0ef2c92be 100644
--- a/drivers/hid/hid-lgff.c
+++ b/drivers/hid/hid-lgff.c
@@ -27,6 +27,8 @@
27 * e-mail - mail your message to <johann.deneux@it.uu.se> 27 * e-mail - mail your message to <johann.deneux@it.uu.se>
28 */ 28 */
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
30#include <linux/input.h> 32#include <linux/input.h>
31#include <linux/usb.h> 33#include <linux/usb.h>
32#include <linux/hid.h> 34#include <linux/hid.h>
@@ -146,7 +148,7 @@ int lgff_init(struct hid_device* hid)
146 148
147 /* Find the report to use */ 149 /* Find the report to use */
148 if (list_empty(report_list)) { 150 if (list_empty(report_list)) {
149 err_hid("No output report found"); 151 hid_err(hid, "No output report found\n");
150 return -1; 152 return -1;
151 } 153 }
152 154
@@ -154,7 +156,7 @@ int lgff_init(struct hid_device* hid)
154 report = list_entry(report_list->next, struct hid_report, list); 156 report = list_entry(report_list->next, struct hid_report, list);
155 field = report->field[0]; 157 field = report->field[0];
156 if (!field) { 158 if (!field) {
157 err_hid("NULL field"); 159 hid_err(hid, "NULL field\n");
158 return -1; 160 return -1;
159 } 161 }
160 162
@@ -176,7 +178,7 @@ int lgff_init(struct hid_device* hid)
176 if ( test_bit(FF_AUTOCENTER, dev->ffbit) ) 178 if ( test_bit(FF_AUTOCENTER, dev->ffbit) )
177 dev->ff->set_autocenter = hid_lgff_set_autocenter; 179 dev->ff->set_autocenter = hid_lgff_set_autocenter;
178 180
179 printk(KERN_INFO "Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>\n"); 181 pr_info("Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>\n");
180 182
181 return 0; 183 return 0;
182} 184}
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index e6dc15171664..11306b3d9c56 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -12,6 +12,8 @@
12 * any later version. 12 * any later version.
13 */ 13 */
14 14
15#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
16
15#include <linux/device.h> 17#include <linux/device.h>
16#include <linux/hid.h> 18#include <linux/hid.h>
17#include <linux/module.h> 19#include <linux/module.h>
@@ -446,7 +448,7 @@ static int magicmouse_probe(struct hid_device *hdev,
446 448
447 msc = kzalloc(sizeof(*msc), GFP_KERNEL); 449 msc = kzalloc(sizeof(*msc), GFP_KERNEL);
448 if (msc == NULL) { 450 if (msc == NULL) {
449 dev_err(&hdev->dev, "can't alloc magicmouse descriptor\n"); 451 hid_err(hdev, "can't alloc magicmouse descriptor\n");
450 return -ENOMEM; 452 return -ENOMEM;
451 } 453 }
452 454
@@ -459,13 +461,13 @@ static int magicmouse_probe(struct hid_device *hdev,
459 461
460 ret = hid_parse(hdev); 462 ret = hid_parse(hdev);
461 if (ret) { 463 if (ret) {
462 dev_err(&hdev->dev, "magicmouse hid parse failed\n"); 464 hid_err(hdev, "magicmouse hid parse failed\n");
463 goto err_free; 465 goto err_free;
464 } 466 }
465 467
466 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 468 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
467 if (ret) { 469 if (ret) {
468 dev_err(&hdev->dev, "magicmouse hw start failed\n"); 470 hid_err(hdev, "magicmouse hw start failed\n");
469 goto err_free; 471 goto err_free;
470 } 472 }
471 473
@@ -486,7 +488,7 @@ static int magicmouse_probe(struct hid_device *hdev,
486 } 488 }
487 489
488 if (!report) { 490 if (!report) {
489 dev_err(&hdev->dev, "unable to register touch report\n"); 491 hid_err(hdev, "unable to register touch report\n");
490 ret = -ENOMEM; 492 ret = -ENOMEM;
491 goto err_stop_hw; 493 goto err_stop_hw;
492 } 494 }
@@ -495,8 +497,7 @@ static int magicmouse_probe(struct hid_device *hdev,
495 ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), 497 ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature),
496 HID_FEATURE_REPORT); 498 HID_FEATURE_REPORT);
497 if (ret != sizeof(feature)) { 499 if (ret != sizeof(feature)) {
498 dev_err(&hdev->dev, "unable to request touch data (%d)\n", 500 hid_err(hdev, "unable to request touch data (%d)\n", ret);
499 ret);
500 goto err_stop_hw; 501 goto err_stop_hw;
501 } 502 }
502 503
@@ -540,7 +541,7 @@ static int __init magicmouse_init(void)
540 541
541 ret = hid_register_driver(&magicmouse_driver); 542 ret = hid_register_driver(&magicmouse_driver);
542 if (ret) 543 if (ret)
543 printk(KERN_ERR "can't register magicmouse driver\n"); 544 pr_err("can't register magicmouse driver\n");
544 545
545 return ret; 546 return ret;
546} 547}
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index dc618c33d0a2..0f6fc54dc196 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -40,8 +40,7 @@ static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc,
40 40
41 if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 && 41 if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 &&
42 rdesc[559] == 0x29) { 42 rdesc[559] == 0x29) {
43 dev_info(&hdev->dev, "fixing up Microsoft Wireless Receiver " 43 hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n");
44 "Model 1028 report descriptor\n");
45 rdesc[557] = 0x35; 44 rdesc[557] = 0x35;
46 rdesc[559] = 0x45; 45 rdesc[559] = 0x45;
47 } 46 }
@@ -155,14 +154,14 @@ static int ms_probe(struct hid_device *hdev, const struct hid_device_id *id)
155 154
156 ret = hid_parse(hdev); 155 ret = hid_parse(hdev);
157 if (ret) { 156 if (ret) {
158 dev_err(&hdev->dev, "parse failed\n"); 157 hid_err(hdev, "parse failed\n");
159 goto err_free; 158 goto err_free;
160 } 159 }
161 160
162 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | ((quirks & MS_HIDINPUT) ? 161 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | ((quirks & MS_HIDINPUT) ?
163 HID_CONNECT_HIDINPUT_FORCE : 0)); 162 HID_CONNECT_HIDINPUT_FORCE : 0));
164 if (ret) { 163 if (ret) {
165 dev_err(&hdev->dev, "hw start failed\n"); 164 hid_err(hdev, "hw start failed\n");
166 goto err_free; 165 goto err_free;
167 } 166 }
168 167
diff --git a/drivers/hid/hid-monterey.c b/drivers/hid/hid-monterey.c
index c95c31e2d869..dedf757781ae 100644
--- a/drivers/hid/hid-monterey.c
+++ b/drivers/hid/hid-monterey.c
@@ -26,8 +26,7 @@ static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
26 unsigned int *rsize) 26 unsigned int *rsize)
27{ 27{
28 if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { 28 if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) {
29 dev_info(&hdev->dev, "fixing up button/consumer in HID report " 29 hid_info(hdev, "fixing up button/consumer in HID report descriptor\n");
30 "descriptor\n");
31 rdesc[30] = 0x0c; 30 rdesc[30] = 0x0c;
32 } 31 }
33 return rdesc; 32 return rdesc;
diff --git a/drivers/hid/hid-mosart.c b/drivers/hid/hid-mosart.c
index ac5421d568f1..0668685380d5 100644
--- a/drivers/hid/hid-mosart.c
+++ b/drivers/hid/hid-mosart.c
@@ -199,7 +199,7 @@ static int mosart_probe(struct hid_device *hdev, const struct hid_device_id *id)
199 199
200 td = kmalloc(sizeof(struct mosart_data), GFP_KERNEL); 200 td = kmalloc(sizeof(struct mosart_data), GFP_KERNEL);
201 if (!td) { 201 if (!td) {
202 dev_err(&hdev->dev, "cannot allocate MosArt data\n"); 202 hid_err(hdev, "cannot allocate MosArt data\n");
203 return -ENOMEM; 203 return -ENOMEM;
204 } 204 }
205 td->valid = false; 205 td->valid = false;
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 69169efa1e16..beb403421e72 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -130,8 +130,7 @@ static void ntrig_report_version(struct hid_device *hdev)
130 if (ret == 8) { 130 if (ret == 8) {
131 ret = ntrig_version_string(&data[2], buf); 131 ret = ntrig_version_string(&data[2], buf);
132 132
133 dev_info(&hdev->dev, 133 hid_info(hdev, "Firmware version: %s (%02x%02x %02x%02x)\n",
134 "Firmware version: %s (%02x%02x %02x%02x)\n",
135 buf, data[2], data[3], data[4], data[5]); 134 buf, data[2], data[3], data[4], data[5]);
136 } 135 }
137 136
@@ -831,7 +830,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
831 830
832 nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL); 831 nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL);
833 if (!nd) { 832 if (!nd) {
834 dev_err(&hdev->dev, "cannot allocate N-Trig data\n"); 833 hid_err(hdev, "cannot allocate N-Trig data\n");
835 return -ENOMEM; 834 return -ENOMEM;
836 } 835 }
837 836
@@ -850,13 +849,13 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
850 849
851 ret = hid_parse(hdev); 850 ret = hid_parse(hdev);
852 if (ret) { 851 if (ret) {
853 dev_err(&hdev->dev, "parse failed\n"); 852 hid_err(hdev, "parse failed\n");
854 goto err_free; 853 goto err_free;
855 } 854 }
856 855
857 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 856 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
858 if (ret) { 857 if (ret) {
859 dev_err(&hdev->dev, "hw start failed\n"); 858 hid_err(hdev, "hw start failed\n");
860 goto err_free; 859 goto err_free;
861 } 860 }
862 861
diff --git a/drivers/hid/hid-ortek.c b/drivers/hid/hid-ortek.c
index 2e79716dca31..e90edfc63051 100644
--- a/drivers/hid/hid-ortek.c
+++ b/drivers/hid/hid-ortek.c
@@ -23,8 +23,7 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
23 unsigned int *rsize) 23 unsigned int *rsize)
24{ 24{
25 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) { 25 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
26 dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 " 26 hid_info(hdev, "Fixing up Ortek WKB-2000 report descriptor\n");
27 "report descriptor.\n");
28 rdesc[55] = 0x92; 27 rdesc[55] = 0x92;
29 } 28 }
30 return rdesc; 29 return rdesc;
diff --git a/drivers/hid/hid-petalynx.c b/drivers/hid/hid-petalynx.c
index 308d6ae48a3e..f1ea3ff8a98d 100644
--- a/drivers/hid/hid-petalynx.c
+++ b/drivers/hid/hid-petalynx.c
@@ -29,8 +29,7 @@ static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc,
29 if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && 29 if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 &&
30 rdesc[41] == 0x00 && rdesc[59] == 0x26 && 30 rdesc[41] == 0x00 && rdesc[59] == 0x26 &&
31 rdesc[60] == 0xf9 && rdesc[61] == 0x00) { 31 rdesc[60] == 0xf9 && rdesc[61] == 0x00) {
32 dev_info(&hdev->dev, "fixing up Petalynx Maxter Remote report " 32 hid_info(hdev, "fixing up Petalynx Maxter Remote report descriptor\n");
33 "descriptor\n");
34 rdesc[60] = 0xfa; 33 rdesc[60] = 0xfa;
35 rdesc[40] = 0xfa; 34 rdesc[40] = 0xfa;
36 } 35 }
@@ -77,13 +76,13 @@ static int pl_probe(struct hid_device *hdev, const struct hid_device_id *id)
77 76
78 ret = hid_parse(hdev); 77 ret = hid_parse(hdev);
79 if (ret) { 78 if (ret) {
80 dev_err(&hdev->dev, "parse failed\n"); 79 hid_err(hdev, "parse failed\n");
81 goto err_free; 80 goto err_free;
82 } 81 }
83 82
84 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 83 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
85 if (ret) { 84 if (ret) {
86 dev_err(&hdev->dev, "hw start failed\n"); 85 hid_err(hdev, "hw start failed\n");
87 goto err_free; 86 goto err_free;
88 } 87 }
89 88
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
index bc2e07740628..e4ce47156106 100644
--- a/drivers/hid/hid-picolcd.c
+++ b/drivers/hid/hid-picolcd.c
@@ -253,7 +253,7 @@ static struct hid_report *picolcd_report(int id, struct hid_device *hdev, int di
253 if (report->id == id) 253 if (report->id == id)
254 return report; 254 return report;
255 } 255 }
256 dev_warn(&hdev->dev, "No report with id 0x%x found\n", id); 256 hid_warn(hdev, "No report with id 0x%x found\n", id);
257 return NULL; 257 return NULL;
258} 258}
259 259
@@ -1329,7 +1329,7 @@ static int picolcd_check_version(struct hid_device *hdev)
1329 1329
1330 verinfo = picolcd_send_and_wait(hdev, REPORT_VERSION, NULL, 0); 1330 verinfo = picolcd_send_and_wait(hdev, REPORT_VERSION, NULL, 0);
1331 if (!verinfo) { 1331 if (!verinfo) {
1332 dev_err(&hdev->dev, "no version response from PicoLCD"); 1332 hid_err(hdev, "no version response from PicoLCD\n");
1333 return -ENODEV; 1333 return -ENODEV;
1334 } 1334 }
1335 1335
@@ -1337,14 +1337,14 @@ static int picolcd_check_version(struct hid_device *hdev)
1337 data->version[0] = verinfo->raw_data[1]; 1337 data->version[0] = verinfo->raw_data[1];
1338 data->version[1] = verinfo->raw_data[0]; 1338 data->version[1] = verinfo->raw_data[0];
1339 if (data->status & PICOLCD_BOOTLOADER) { 1339 if (data->status & PICOLCD_BOOTLOADER) {
1340 dev_info(&hdev->dev, "PicoLCD, bootloader version %d.%d\n", 1340 hid_info(hdev, "PicoLCD, bootloader version %d.%d\n",
1341 verinfo->raw_data[1], verinfo->raw_data[0]); 1341 verinfo->raw_data[1], verinfo->raw_data[0]);
1342 } else { 1342 } else {
1343 dev_info(&hdev->dev, "PicoLCD, firmware version %d.%d\n", 1343 hid_info(hdev, "PicoLCD, firmware version %d.%d\n",
1344 verinfo->raw_data[1], verinfo->raw_data[0]); 1344 verinfo->raw_data[1], verinfo->raw_data[0]);
1345 } 1345 }
1346 } else { 1346 } else {
1347 dev_err(&hdev->dev, "confused, got unexpected version response from PicoLCD\n"); 1347 hid_err(hdev, "confused, got unexpected version response from PicoLCD\n");
1348 ret = -EINVAL; 1348 ret = -EINVAL;
1349 } 1349 }
1350 kfree(verinfo); 1350 kfree(verinfo);
@@ -2328,8 +2328,7 @@ static void picolcd_init_devfs(struct picolcd_data *data,
2328 (flash_w ? S_IWUSR : 0) | (flash_r ? S_IRUSR : 0), 2328 (flash_w ? S_IWUSR : 0) | (flash_r ? S_IRUSR : 0),
2329 hdev->debug_dir, data, &picolcd_debug_flash_fops); 2329 hdev->debug_dir, data, &picolcd_debug_flash_fops);
2330 } else if (flash_r || flash_w) 2330 } else if (flash_r || flash_w)
2331 dev_warn(&hdev->dev, "Unexpected FLASH access reports, " 2331 hid_warn(hdev, "Unexpected FLASH access reports, please submit rdesc for review\n");
2332 "please submit rdesc for review\n");
2333} 2332}
2334 2333
2335static void picolcd_exit_devfs(struct picolcd_data *data) 2334static void picolcd_exit_devfs(struct picolcd_data *data)
@@ -2457,13 +2456,13 @@ static int picolcd_init_keys(struct picolcd_data *data,
2457 return -ENODEV; 2456 return -ENODEV;
2458 if (report->maxfield != 1 || report->field[0]->report_count != 2 || 2457 if (report->maxfield != 1 || report->field[0]->report_count != 2 ||
2459 report->field[0]->report_size != 8) { 2458 report->field[0]->report_size != 8) {
2460 dev_err(&hdev->dev, "unsupported KEY_STATE report"); 2459 hid_err(hdev, "unsupported KEY_STATE report\n");
2461 return -EINVAL; 2460 return -EINVAL;
2462 } 2461 }
2463 2462
2464 idev = input_allocate_device(); 2463 idev = input_allocate_device();
2465 if (idev == NULL) { 2464 if (idev == NULL) {
2466 dev_err(&hdev->dev, "failed to allocate input device"); 2465 hid_err(hdev, "failed to allocate input device\n");
2467 return -ENOMEM; 2466 return -ENOMEM;
2468 } 2467 }
2469 input_set_drvdata(idev, hdev); 2468 input_set_drvdata(idev, hdev);
@@ -2485,7 +2484,7 @@ static int picolcd_init_keys(struct picolcd_data *data,
2485 input_set_capability(idev, EV_KEY, data->keycode[i]); 2484 input_set_capability(idev, EV_KEY, data->keycode[i]);
2486 error = input_register_device(idev); 2485 error = input_register_device(idev);
2487 if (error) { 2486 if (error) {
2488 dev_err(&hdev->dev, "error registering the input device"); 2487 hid_err(hdev, "error registering the input device\n");
2489 input_free_device(idev); 2488 input_free_device(idev);
2490 return error; 2489 return error;
2491 } 2490 }
@@ -2522,9 +2521,8 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
2522 return error; 2521 return error;
2523 2522
2524 if (data->version[0] != 0 && data->version[1] != 3) 2523 if (data->version[0] != 0 && data->version[1] != 3)
2525 dev_info(&hdev->dev, "Device with untested firmware revision, " 2524 hid_info(hdev, "Device with untested firmware revision, please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n",
2526 "please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n", 2525 dev_name(&hdev->dev));
2527 dev_name(&hdev->dev));
2528 2526
2529 /* Setup keypad input device */ 2527 /* Setup keypad input device */
2530 error = picolcd_init_keys(data, picolcd_in_report(REPORT_KEY_STATE, hdev)); 2528 error = picolcd_init_keys(data, picolcd_in_report(REPORT_KEY_STATE, hdev));
@@ -2581,9 +2579,8 @@ static int picolcd_probe_bootloader(struct hid_device *hdev, struct picolcd_data
2581 return error; 2579 return error;
2582 2580
2583 if (data->version[0] != 1 && data->version[1] != 0) 2581 if (data->version[0] != 1 && data->version[1] != 0)
2584 dev_info(&hdev->dev, "Device with untested bootloader revision, " 2582 hid_info(hdev, "Device with untested bootloader revision, please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n",
2585 "please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n", 2583 dev_name(&hdev->dev));
2586 dev_name(&hdev->dev));
2587 2584
2588 picolcd_init_devfs(data, NULL, NULL, 2585 picolcd_init_devfs(data, NULL, NULL,
2589 picolcd_out_report(REPORT_BL_READ_MEMORY, hdev), 2586 picolcd_out_report(REPORT_BL_READ_MEMORY, hdev),
@@ -2605,7 +2602,7 @@ static int picolcd_probe(struct hid_device *hdev,
2605 */ 2602 */
2606 data = kzalloc(sizeof(struct picolcd_data), GFP_KERNEL); 2603 data = kzalloc(sizeof(struct picolcd_data), GFP_KERNEL);
2607 if (data == NULL) { 2604 if (data == NULL) {
2608 dev_err(&hdev->dev, "can't allocate space for Minibox PicoLCD device data\n"); 2605 hid_err(hdev, "can't allocate space for Minibox PicoLCD device data\n");
2609 error = -ENOMEM; 2606 error = -ENOMEM;
2610 goto err_no_cleanup; 2607 goto err_no_cleanup;
2611 } 2608 }
@@ -2621,7 +2618,7 @@ static int picolcd_probe(struct hid_device *hdev,
2621 /* Parse the device reports and start it up */ 2618 /* Parse the device reports and start it up */
2622 error = hid_parse(hdev); 2619 error = hid_parse(hdev);
2623 if (error) { 2620 if (error) {
2624 dev_err(&hdev->dev, "device report parse failed\n"); 2621 hid_err(hdev, "device report parse failed\n");
2625 goto err_cleanup_data; 2622 goto err_cleanup_data;
2626 } 2623 }
2627 2624
@@ -2631,25 +2628,25 @@ static int picolcd_probe(struct hid_device *hdev,
2631 error = hid_hw_start(hdev, 0); 2628 error = hid_hw_start(hdev, 0);
2632 hdev->claimed = 0; 2629 hdev->claimed = 0;
2633 if (error) { 2630 if (error) {
2634 dev_err(&hdev->dev, "hardware start failed\n"); 2631 hid_err(hdev, "hardware start failed\n");
2635 goto err_cleanup_data; 2632 goto err_cleanup_data;
2636 } 2633 }
2637 2634
2638 error = hdev->ll_driver->open(hdev); 2635 error = hid_hw_open(hdev);
2639 if (error) { 2636 if (error) {
2640 dev_err(&hdev->dev, "failed to open input interrupt pipe for key and IR events\n"); 2637 hid_err(hdev, "failed to open input interrupt pipe for key and IR events\n");
2641 goto err_cleanup_hid_hw; 2638 goto err_cleanup_hid_hw;
2642 } 2639 }
2643 2640
2644 error = device_create_file(&hdev->dev, &dev_attr_operation_mode_delay); 2641 error = device_create_file(&hdev->dev, &dev_attr_operation_mode_delay);
2645 if (error) { 2642 if (error) {
2646 dev_err(&hdev->dev, "failed to create sysfs attributes\n"); 2643 hid_err(hdev, "failed to create sysfs attributes\n");
2647 goto err_cleanup_hid_ll; 2644 goto err_cleanup_hid_ll;
2648 } 2645 }
2649 2646
2650 error = device_create_file(&hdev->dev, &dev_attr_operation_mode); 2647 error = device_create_file(&hdev->dev, &dev_attr_operation_mode);
2651 if (error) { 2648 if (error) {
2652 dev_err(&hdev->dev, "failed to create sysfs attributes\n"); 2649 hid_err(hdev, "failed to create sysfs attributes\n");
2653 goto err_cleanup_sysfs1; 2650 goto err_cleanup_sysfs1;
2654 } 2651 }
2655 2652
@@ -2668,7 +2665,7 @@ err_cleanup_sysfs2:
2668err_cleanup_sysfs1: 2665err_cleanup_sysfs1:
2669 device_remove_file(&hdev->dev, &dev_attr_operation_mode_delay); 2666 device_remove_file(&hdev->dev, &dev_attr_operation_mode_delay);
2670err_cleanup_hid_ll: 2667err_cleanup_hid_ll:
2671 hdev->ll_driver->close(hdev); 2668 hid_hw_close(hdev);
2672err_cleanup_hid_hw: 2669err_cleanup_hid_hw:
2673 hid_hw_stop(hdev); 2670 hid_hw_stop(hdev);
2674err_cleanup_data: 2671err_cleanup_data:
@@ -2699,7 +2696,7 @@ static void picolcd_remove(struct hid_device *hdev)
2699 picolcd_exit_devfs(data); 2696 picolcd_exit_devfs(data);
2700 device_remove_file(&hdev->dev, &dev_attr_operation_mode); 2697 device_remove_file(&hdev->dev, &dev_attr_operation_mode);
2701 device_remove_file(&hdev->dev, &dev_attr_operation_mode_delay); 2698 device_remove_file(&hdev->dev, &dev_attr_operation_mode_delay);
2702 hdev->ll_driver->close(hdev); 2699 hid_hw_close(hdev);
2703 hid_hw_stop(hdev); 2700 hid_hw_stop(hdev);
2704 hid_set_drvdata(hdev, NULL); 2701 hid_set_drvdata(hdev, NULL);
2705 2702
diff --git a/drivers/hid/hid-pl.c b/drivers/hid/hid-pl.c
index 9f41e2bd8483..06e5300d43d2 100644
--- a/drivers/hid/hid-pl.c
+++ b/drivers/hid/hid-pl.c
@@ -103,7 +103,7 @@ static int plff_init(struct hid_device *hid)
103 */ 103 */
104 104
105 if (list_empty(report_list)) { 105 if (list_empty(report_list)) {
106 dev_err(&hid->dev, "no output reports found\n"); 106 hid_err(hid, "no output reports found\n");
107 return -ENODEV; 107 return -ENODEV;
108 } 108 }
109 109
@@ -112,14 +112,13 @@ static int plff_init(struct hid_device *hid)
112 report_ptr = report_ptr->next; 112 report_ptr = report_ptr->next;
113 113
114 if (report_ptr == report_list) { 114 if (report_ptr == report_list) {
115 dev_err(&hid->dev, "required output report is " 115 hid_err(hid, "required output report is missing\n");
116 "missing\n");
117 return -ENODEV; 116 return -ENODEV;
118 } 117 }
119 118
120 report = list_entry(report_ptr, struct hid_report, list); 119 report = list_entry(report_ptr, struct hid_report, list);
121 if (report->maxfield < 1) { 120 if (report->maxfield < 1) {
122 dev_err(&hid->dev, "no fields in the report\n"); 121 hid_err(hid, "no fields in the report\n");
123 return -ENODEV; 122 return -ENODEV;
124 } 123 }
125 124
@@ -137,7 +136,7 @@ static int plff_init(struct hid_device *hid)
137 weak = &report->field[3]->value[0]; 136 weak = &report->field[3]->value[0];
138 debug("detected 4-field device"); 137 debug("detected 4-field device");
139 } else { 138 } else {
140 dev_err(&hid->dev, "not enough fields or values\n"); 139 hid_err(hid, "not enough fields or values\n");
141 return -ENODEV; 140 return -ENODEV;
142 } 141 }
143 142
@@ -164,8 +163,7 @@ static int plff_init(struct hid_device *hid)
164 usbhid_submit_report(hid, plff->report, USB_DIR_OUT); 163 usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
165 } 164 }
166 165
167 dev_info(&hid->dev, "Force feedback for PantherLord/GreenAsia " 166 hid_info(hid, "Force feedback for PantherLord/GreenAsia devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
168 "devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
169 167
170 return 0; 168 return 0;
171} 169}
@@ -185,13 +183,13 @@ static int pl_probe(struct hid_device *hdev, const struct hid_device_id *id)
185 183
186 ret = hid_parse(hdev); 184 ret = hid_parse(hdev);
187 if (ret) { 185 if (ret) {
188 dev_err(&hdev->dev, "parse failed\n"); 186 hid_err(hdev, "parse failed\n");
189 goto err; 187 goto err;
190 } 188 }
191 189
192 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 190 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
193 if (ret) { 191 if (ret) {
194 dev_err(&hdev->dev, "hw start failed\n"); 192 hid_err(hdev, "hw start failed\n");
195 goto err; 193 goto err;
196 } 194 }
197 195
diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c
index 48eab84f53b5..ab19f2905d27 100644
--- a/drivers/hid/hid-prodikeys.c
+++ b/drivers/hid/hid-prodikeys.c
@@ -16,6 +16,8 @@
16 * any later version. 16 * any later version.
17 */ 17 */
18 18
19#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20
19#include <linux/device.h> 21#include <linux/device.h>
20#include <linux/module.h> 22#include <linux/module.h>
21#include <linux/usb.h> 23#include <linux/usb.h>
@@ -130,7 +132,7 @@ static ssize_t store_channel(struct device *dev,
130 return -EINVAL; 132 return -EINVAL;
131} 133}
132 134
133static DEVICE_ATTR(channel, S_IRUGO | S_IWUGO, show_channel, 135static DEVICE_ATTR(channel, S_IRUGO | S_IWUSR | S_IWGRP , show_channel,
134 store_channel); 136 store_channel);
135 137
136static struct device_attribute *sysfs_device_attr_channel = { 138static struct device_attribute *sysfs_device_attr_channel = {
@@ -169,7 +171,7 @@ static ssize_t store_sustain(struct device *dev,
169 return -EINVAL; 171 return -EINVAL;
170} 172}
171 173
172static DEVICE_ATTR(sustain, S_IRUGO | S_IWUGO, show_sustain, 174static DEVICE_ATTR(sustain, S_IRUGO | S_IWUSR | S_IWGRP, show_sustain,
173 store_sustain); 175 store_sustain);
174 176
175static struct device_attribute *sysfs_device_attr_sustain = { 177static struct device_attribute *sysfs_device_attr_sustain = {
@@ -207,7 +209,7 @@ static ssize_t store_octave(struct device *dev,
207 return -EINVAL; 209 return -EINVAL;
208} 210}
209 211
210static DEVICE_ATTR(octave, S_IRUGO | S_IWUGO, show_octave, 212static DEVICE_ATTR(octave, S_IRUGO | S_IWUSR | S_IWGRP, show_octave,
211 store_octave); 213 store_octave);
212 214
213static struct device_attribute *sysfs_device_attr_octave = { 215static struct device_attribute *sysfs_device_attr_octave = {
@@ -285,11 +287,11 @@ static int pcmidi_get_output_report(struct pcmidi_snd *pm)
285 continue; 287 continue;
286 288
287 if (report->maxfield < 1) { 289 if (report->maxfield < 1) {
288 dev_err(&hdev->dev, "output report is empty\n"); 290 hid_err(hdev, "output report is empty\n");
289 break; 291 break;
290 } 292 }
291 if (report->field[0]->report_count != 2) { 293 if (report->field[0]->report_count != 2) {
292 dev_err(&hdev->dev, "field count too low\n"); 294 hid_err(hdev, "field count too low\n");
293 break; 295 break;
294 } 296 }
295 pm->pcmidi_report6 = report; 297 pm->pcmidi_report6 = report;
@@ -746,8 +748,8 @@ static __u8 *pk_report_fixup(struct hid_device *hdev, __u8 *rdesc,
746 if (*rsize == 178 && 748 if (*rsize == 178 &&
747 rdesc[111] == 0x06 && rdesc[112] == 0x00 && 749 rdesc[111] == 0x06 && rdesc[112] == 0x00 &&
748 rdesc[113] == 0xff) { 750 rdesc[113] == 0xff) {
749 dev_info(&hdev->dev, "fixing up pc-midi keyboard report " 751 hid_info(hdev,
750 "descriptor\n"); 752 "fixing up pc-midi keyboard report descriptor\n");
751 753
752 rdesc[144] = 0x18; /* report 4: was 0x10 report count */ 754 rdesc[144] = 0x18; /* report 4: was 0x10 report count */
753 } 755 }
@@ -805,7 +807,7 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
805 807
806 pk = kzalloc(sizeof(*pk), GFP_KERNEL); 808 pk = kzalloc(sizeof(*pk), GFP_KERNEL);
807 if (pk == NULL) { 809 if (pk == NULL) {
808 dev_err(&hdev->dev, "prodikeys: can't alloc descriptor\n"); 810 hid_err(hdev, "can't alloc descriptor\n");
809 return -ENOMEM; 811 return -ENOMEM;
810 } 812 }
811 813
@@ -813,8 +815,7 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
813 815
814 pm = kzalloc(sizeof(*pm), GFP_KERNEL); 816 pm = kzalloc(sizeof(*pm), GFP_KERNEL);
815 if (pm == NULL) { 817 if (pm == NULL) {
816 dev_err(&hdev->dev, 818 hid_err(hdev, "can't alloc descriptor\n");
817 "prodikeys: can't alloc descriptor\n");
818 ret = -ENOMEM; 819 ret = -ENOMEM;
819 goto err_free; 820 goto err_free;
820 } 821 }
@@ -827,7 +828,7 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
827 828
828 ret = hid_parse(hdev); 829 ret = hid_parse(hdev);
829 if (ret) { 830 if (ret) {
830 dev_err(&hdev->dev, "prodikeys: hid parse failed\n"); 831 hid_err(hdev, "hid parse failed\n");
831 goto err_free; 832 goto err_free;
832 } 833 }
833 834
@@ -837,7 +838,7 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
837 838
838 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 839 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
839 if (ret) { 840 if (ret) {
840 dev_err(&hdev->dev, "prodikeys: hw start failed\n"); 841 hid_err(hdev, "hw start failed\n");
841 goto err_free; 842 goto err_free;
842 } 843 }
843 844
@@ -896,7 +897,7 @@ static int pk_init(void)
896 897
897 ret = hid_register_driver(&pk_driver); 898 ret = hid_register_driver(&pk_driver);
898 if (ret) 899 if (ret)
899 printk(KERN_ERR "can't register prodikeys driver\n"); 900 pr_err("can't register prodikeys driver\n");
900 901
901 return ret; 902 return ret;
902} 903}
diff --git a/drivers/hid/hid-quanta.c b/drivers/hid/hid-quanta.c
index 54d3db50605b..87a54df4d4ac 100644
--- a/drivers/hid/hid-quanta.c
+++ b/drivers/hid/hid-quanta.c
@@ -195,7 +195,7 @@ static int quanta_probe(struct hid_device *hdev, const struct hid_device_id *id)
195 195
196 td = kmalloc(sizeof(struct quanta_data), GFP_KERNEL); 196 td = kmalloc(sizeof(struct quanta_data), GFP_KERNEL);
197 if (!td) { 197 if (!td) {
198 dev_err(&hdev->dev, "cannot allocate Quanta Touch data\n"); 198 hid_err(hdev, "cannot allocate Quanta Touch data\n");
199 return -ENOMEM; 199 return -ENOMEM;
200 } 200 }
201 td->valid = false; 201 td->valid = false;
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index f77695762cb5..73199de2e37f 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -90,8 +90,7 @@ static int kone_check_write(struct usb_device *usb_dev)
90 kfree(data); 90 kfree(data);
91 return 0; 91 return 0;
92 } else { /* unknown answer */ 92 } else { /* unknown answer */
93 dev_err(&usb_dev->dev, "got retval %d when checking write\n", 93 hid_err(usb_dev, "got retval %d when checking write\n", *data);
94 *data);
95 kfree(data); 94 kfree(data);
96 return -EIO; 95 return -EIO;
97 } 96 }
@@ -556,7 +555,7 @@ static ssize_t kone_sysfs_set_tcu(struct device *dev,
556 555
557 retval = kone_set_settings(usb_dev, &kone->settings); 556 retval = kone_set_settings(usb_dev, &kone->settings);
558 if (retval) { 557 if (retval) {
559 dev_err(&usb_dev->dev, "couldn't set tcu state\n"); 558 hid_err(usb_dev, "couldn't set tcu state\n");
560 /* 559 /*
561 * try to reread valid settings into buffer overwriting 560 * try to reread valid settings into buffer overwriting
562 * first error code 561 * first error code
@@ -570,7 +569,7 @@ static ssize_t kone_sysfs_set_tcu(struct device *dev,
570 569
571 retval = size; 570 retval = size;
572exit_no_settings: 571exit_no_settings:
573 dev_err(&usb_dev->dev, "couldn't read settings\n"); 572 hid_err(usb_dev, "couldn't read settings\n");
574exit_unlock: 573exit_unlock:
575 mutex_unlock(&kone->kone_lock); 574 mutex_unlock(&kone->kone_lock);
576 return retval; 575 return retval;
@@ -818,21 +817,20 @@ static int kone_init_specials(struct hid_device *hdev)
818 817
819 kone = kzalloc(sizeof(*kone), GFP_KERNEL); 818 kone = kzalloc(sizeof(*kone), GFP_KERNEL);
820 if (!kone) { 819 if (!kone) {
821 dev_err(&hdev->dev, "can't alloc device descriptor\n"); 820 hid_err(hdev, "can't alloc device descriptor\n");
822 return -ENOMEM; 821 return -ENOMEM;
823 } 822 }
824 hid_set_drvdata(hdev, kone); 823 hid_set_drvdata(hdev, kone);
825 824
826 retval = kone_init_kone_device_struct(usb_dev, kone); 825 retval = kone_init_kone_device_struct(usb_dev, kone);
827 if (retval) { 826 if (retval) {
828 dev_err(&hdev->dev, 827 hid_err(hdev, "couldn't init struct kone_device\n");
829 "couldn't init struct kone_device\n");
830 goto exit_free; 828 goto exit_free;
831 } 829 }
832 830
833 retval = roccat_connect(hdev); 831 retval = roccat_connect(hdev);
834 if (retval < 0) { 832 if (retval < 0) {
835 dev_err(&hdev->dev, "couldn't init char dev\n"); 833 hid_err(hdev, "couldn't init char dev\n");
836 /* be tolerant about not getting chrdev */ 834 /* be tolerant about not getting chrdev */
837 } else { 835 } else {
838 kone->roccat_claimed = 1; 836 kone->roccat_claimed = 1;
@@ -841,7 +839,7 @@ static int kone_init_specials(struct hid_device *hdev)
841 839
842 retval = kone_create_sysfs_attributes(intf); 840 retval = kone_create_sysfs_attributes(intf);
843 if (retval) { 841 if (retval) {
844 dev_err(&hdev->dev, "cannot create sysfs files\n"); 842 hid_err(hdev, "cannot create sysfs files\n");
845 goto exit_free; 843 goto exit_free;
846 } 844 }
847 } else { 845 } else {
@@ -876,19 +874,19 @@ static int kone_probe(struct hid_device *hdev, const struct hid_device_id *id)
876 874
877 retval = hid_parse(hdev); 875 retval = hid_parse(hdev);
878 if (retval) { 876 if (retval) {
879 dev_err(&hdev->dev, "parse failed\n"); 877 hid_err(hdev, "parse failed\n");
880 goto exit; 878 goto exit;
881 } 879 }
882 880
883 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 881 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
884 if (retval) { 882 if (retval) {
885 dev_err(&hdev->dev, "hw start failed\n"); 883 hid_err(hdev, "hw start failed\n");
886 goto exit; 884 goto exit;
887 } 885 }
888 886
889 retval = kone_init_specials(hdev); 887 retval = kone_init_specials(hdev);
890 if (retval) { 888 if (retval) {
891 dev_err(&hdev->dev, "couldn't install mouse\n"); 889 hid_err(hdev, "couldn't install mouse\n");
892 goto exit_stop; 890 goto exit_stop;
893 } 891 }
894 892
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c
index 9bf23047892a..e7b4affe2664 100644
--- a/drivers/hid/hid-roccat-pyra.c
+++ b/drivers/hid/hid-roccat-pyra.c
@@ -87,9 +87,8 @@ static int pyra_receive_control_status(struct usb_device *usb_dev)
87 control.value == 1) 87 control.value == 1)
88 return 0; 88 return 0;
89 else { 89 else {
90 dev_err(&usb_dev->dev, "receive control status: " 90 hid_err(usb_dev, "receive control status: unknown response 0x%x 0x%x\n",
91 "unknown response 0x%x 0x%x\n", 91 control.request, control.value);
92 control.request, control.value);
93 return -EINVAL; 92 return -EINVAL;
94 } 93 }
95} 94}
@@ -770,21 +769,20 @@ static int pyra_init_specials(struct hid_device *hdev)
770 769
771 pyra = kzalloc(sizeof(*pyra), GFP_KERNEL); 770 pyra = kzalloc(sizeof(*pyra), GFP_KERNEL);
772 if (!pyra) { 771 if (!pyra) {
773 dev_err(&hdev->dev, "can't alloc device descriptor\n"); 772 hid_err(hdev, "can't alloc device descriptor\n");
774 return -ENOMEM; 773 return -ENOMEM;
775 } 774 }
776 hid_set_drvdata(hdev, pyra); 775 hid_set_drvdata(hdev, pyra);
777 776
778 retval = pyra_init_pyra_device_struct(usb_dev, pyra); 777 retval = pyra_init_pyra_device_struct(usb_dev, pyra);
779 if (retval) { 778 if (retval) {
780 dev_err(&hdev->dev, 779 hid_err(hdev, "couldn't init struct pyra_device\n");
781 "couldn't init struct pyra_device\n");
782 goto exit_free; 780 goto exit_free;
783 } 781 }
784 782
785 retval = roccat_connect(hdev); 783 retval = roccat_connect(hdev);
786 if (retval < 0) { 784 if (retval < 0) {
787 dev_err(&hdev->dev, "couldn't init char dev\n"); 785 hid_err(hdev, "couldn't init char dev\n");
788 } else { 786 } else {
789 pyra->chrdev_minor = retval; 787 pyra->chrdev_minor = retval;
790 pyra->roccat_claimed = 1; 788 pyra->roccat_claimed = 1;
@@ -792,7 +790,7 @@ static int pyra_init_specials(struct hid_device *hdev)
792 790
793 retval = pyra_create_sysfs_attributes(intf); 791 retval = pyra_create_sysfs_attributes(intf);
794 if (retval) { 792 if (retval) {
795 dev_err(&hdev->dev, "cannot create sysfs files\n"); 793 hid_err(hdev, "cannot create sysfs files\n");
796 goto exit_free; 794 goto exit_free;
797 } 795 }
798 } else { 796 } else {
@@ -826,19 +824,19 @@ static int pyra_probe(struct hid_device *hdev, const struct hid_device_id *id)
826 824
827 retval = hid_parse(hdev); 825 retval = hid_parse(hdev);
828 if (retval) { 826 if (retval) {
829 dev_err(&hdev->dev, "parse failed\n"); 827 hid_err(hdev, "parse failed\n");
830 goto exit; 828 goto exit;
831 } 829 }
832 830
833 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 831 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
834 if (retval) { 832 if (retval) {
835 dev_err(&hdev->dev, "hw start failed\n"); 833 hid_err(hdev, "hw start failed\n");
836 goto exit; 834 goto exit;
837 } 835 }
838 836
839 retval = pyra_init_specials(hdev); 837 retval = pyra_init_specials(hdev);
840 if (retval) { 838 if (retval) {
841 dev_err(&hdev->dev, "couldn't install mouse\n"); 839 hid_err(hdev, "couldn't install mouse\n");
842 goto exit_stop; 840 goto exit_stop;
843 } 841 }
844 return 0; 842 return 0;
diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c
index 5a6879e235ac..4bc7a93dc1f5 100644
--- a/drivers/hid/hid-roccat.c
+++ b/drivers/hid/hid-roccat.c
@@ -21,6 +21,8 @@
21 * It is inspired by hidraw, but uses only one circular buffer for all readers. 21 * It is inspired by hidraw, but uses only one circular buffer for all readers.
22 */ 22 */
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#include <linux/cdev.h> 26#include <linux/cdev.h>
25#include <linux/poll.h> 27#include <linux/poll.h>
26#include <linux/sched.h> 28#include <linux/sched.h>
@@ -165,27 +167,22 @@ static int roccat_open(struct inode *inode, struct file *file)
165 mutex_lock(&device->readers_lock); 167 mutex_lock(&device->readers_lock);
166 168
167 if (!device) { 169 if (!device) {
168 printk(KERN_EMERG "roccat device with minor %d doesn't exist\n", 170 pr_emerg("roccat device with minor %d doesn't exist\n", minor);
169 minor);
170 error = -ENODEV; 171 error = -ENODEV;
171 goto exit_err; 172 goto exit_err;
172 } 173 }
173 174
174 if (!device->open++) { 175 if (!device->open++) {
175 /* power on device on adding first reader */ 176 /* power on device on adding first reader */
176 if (device->hid->ll_driver->power) { 177 error = hid_hw_power(device->hid, PM_HINT_FULLON);
177 error = device->hid->ll_driver->power(device->hid, 178 if (error < 0) {
178 PM_HINT_FULLON); 179 --device->open;
179 if (error < 0) { 180 goto exit_err;
180 --device->open;
181 goto exit_err;
182 }
183 } 181 }
184 error = device->hid->ll_driver->open(device->hid); 182
183 error = hid_hw_open(device->hid);
185 if (error < 0) { 184 if (error < 0) {
186 if (device->hid->ll_driver->power) 185 hid_hw_power(device->hid, PM_HINT_NORMAL);
187 device->hid->ll_driver->power(device->hid,
188 PM_HINT_NORMAL);
189 --device->open; 186 --device->open;
190 goto exit_err; 187 goto exit_err;
191 } 188 }
@@ -218,8 +215,7 @@ static int roccat_release(struct inode *inode, struct file *file)
218 device = devices[minor]; 215 device = devices[minor];
219 if (!device) { 216 if (!device) {
220 mutex_unlock(&devices_lock); 217 mutex_unlock(&devices_lock);
221 printk(KERN_EMERG "roccat device with minor %d doesn't exist\n", 218 pr_emerg("roccat device with minor %d doesn't exist\n", minor);
222 minor);
223 return -ENODEV; 219 return -ENODEV;
224 } 220 }
225 221
@@ -231,10 +227,8 @@ static int roccat_release(struct inode *inode, struct file *file)
231 if (!--device->open) { 227 if (!--device->open) {
232 /* removing last reader */ 228 /* removing last reader */
233 if (device->exist) { 229 if (device->exist) {
234 if (device->hid->ll_driver->power) 230 hid_hw_power(device->hid, PM_HINT_NORMAL);
235 device->hid->ll_driver->power(device->hid, 231 hid_hw_close(device->hid);
236 PM_HINT_NORMAL);
237 device->hid->ll_driver->close(device->hid);
238 } else { 232 } else {
239 kfree(device); 233 kfree(device);
240 } 234 }
@@ -370,7 +364,7 @@ void roccat_disconnect(int minor)
370 device_destroy(roccat_class, MKDEV(roccat_major, minor)); 364 device_destroy(roccat_class, MKDEV(roccat_major, minor));
371 365
372 if (device->open) { 366 if (device->open) {
373 device->hid->ll_driver->close(device->hid); 367 hid_hw_close(device->hid);
374 wake_up_interruptible(&device->wait); 368 wake_up_interruptible(&device->wait);
375 } else { 369 } else {
376 kfree(device); 370 kfree(device);
@@ -398,7 +392,7 @@ static int __init roccat_init(void)
398 roccat_major = MAJOR(dev_id); 392 roccat_major = MAJOR(dev_id);
399 393
400 if (retval < 0) { 394 if (retval < 0) {
401 printk(KERN_WARNING "roccat: can't get major number\n"); 395 pr_warn("can't get major number\n");
402 return retval; 396 return retval;
403 } 397 }
404 398
diff --git a/drivers/hid/hid-samsung.c b/drivers/hid/hid-samsung.c
index 35894444e000..3c1fd8af5e0c 100644
--- a/drivers/hid/hid-samsung.c
+++ b/drivers/hid/hid-samsung.c
@@ -57,8 +57,8 @@
57static inline void samsung_irda_dev_trace(struct hid_device *hdev, 57static inline void samsung_irda_dev_trace(struct hid_device *hdev,
58 unsigned int rsize) 58 unsigned int rsize)
59{ 59{
60 dev_info(&hdev->dev, "fixing up Samsung IrDA %d byte report " 60 hid_info(hdev, "fixing up Samsung IrDA %d byte report descriptor\n",
61 "descriptor\n", rsize); 61 rsize);
62} 62}
63 63
64static __u8 *samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc, 64static __u8 *samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc,
@@ -160,7 +160,7 @@ static int samsung_probe(struct hid_device *hdev,
160 160
161 ret = hid_parse(hdev); 161 ret = hid_parse(hdev);
162 if (ret) { 162 if (ret) {
163 dev_err(&hdev->dev, "parse failed\n"); 163 hid_err(hdev, "parse failed\n");
164 goto err_free; 164 goto err_free;
165 } 165 }
166 166
@@ -174,7 +174,7 @@ static int samsung_probe(struct hid_device *hdev,
174 174
175 ret = hid_hw_start(hdev, cmask); 175 ret = hid_hw_start(hdev, cmask);
176 if (ret) { 176 if (ret) {
177 dev_err(&hdev->dev, "hw start failed\n"); 177 hid_err(hdev, "hw start failed\n");
178 goto err_free; 178 goto err_free;
179 } 179 }
180 180
diff --git a/drivers/hid/hid-sjoy.c b/drivers/hid/hid-sjoy.c
index e10a7687ebf2..16f7cafc9695 100644
--- a/drivers/hid/hid-sjoy.c
+++ b/drivers/hid/hid-sjoy.c
@@ -74,26 +74,25 @@ static int sjoyff_init(struct hid_device *hid)
74 int error; 74 int error;
75 75
76 if (list_empty(report_list)) { 76 if (list_empty(report_list)) {
77 dev_err(&hid->dev, "no output reports found\n"); 77 hid_err(hid, "no output reports found\n");
78 return -ENODEV; 78 return -ENODEV;
79 } 79 }
80 80
81 report_ptr = report_ptr->next; 81 report_ptr = report_ptr->next;
82 82
83 if (report_ptr == report_list) { 83 if (report_ptr == report_list) {
84 dev_err(&hid->dev, "required output report is " 84 hid_err(hid, "required output report is missing\n");
85 "missing\n");
86 return -ENODEV; 85 return -ENODEV;
87 } 86 }
88 87
89 report = list_entry(report_ptr, struct hid_report, list); 88 report = list_entry(report_ptr, struct hid_report, list);
90 if (report->maxfield < 1) { 89 if (report->maxfield < 1) {
91 dev_err(&hid->dev, "no fields in the report\n"); 90 hid_err(hid, "no fields in the report\n");
92 return -ENODEV; 91 return -ENODEV;
93 } 92 }
94 93
95 if (report->field[0]->report_count < 3) { 94 if (report->field[0]->report_count < 3) {
96 dev_err(&hid->dev, "not enough values in the field\n"); 95 hid_err(hid, "not enough values in the field\n");
97 return -ENODEV; 96 return -ENODEV;
98 } 97 }
99 98
@@ -117,8 +116,7 @@ static int sjoyff_init(struct hid_device *hid)
117 sjoyff->report->field[0]->value[2] = 0x00; 116 sjoyff->report->field[0]->value[2] = 0x00;
118 usbhid_submit_report(hid, sjoyff->report, USB_DIR_OUT); 117 usbhid_submit_report(hid, sjoyff->report, USB_DIR_OUT);
119 118
120 dev_info(&hid->dev, 119 hid_info(hid, "Force feedback for SmartJoy PLUS PS2/USB adapter\n");
121 "Force feedback for SmartJoy PLUS PS2/USB adapter\n");
122 120
123 return 0; 121 return 0;
124} 122}
@@ -135,13 +133,13 @@ static int sjoy_probe(struct hid_device *hdev, const struct hid_device_id *id)
135 133
136 ret = hid_parse(hdev); 134 ret = hid_parse(hdev);
137 if (ret) { 135 if (ret) {
138 dev_err(&hdev->dev, "parse failed\n"); 136 hid_err(hdev, "parse failed\n");
139 goto err; 137 goto err;
140 } 138 }
141 139
142 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 140 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
143 if (ret) { 141 if (ret) {
144 dev_err(&hdev->dev, "hw start failed\n"); 142 hid_err(hdev, "hw start failed\n");
145 goto err; 143 goto err;
146 } 144 }
147 145
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 677bb3da10e8..68d7b36e31e4 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -40,8 +40,7 @@ static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc,
40 40
41 if ((sc->quirks & VAIO_RDESC_CONSTANT) && 41 if ((sc->quirks & VAIO_RDESC_CONSTANT) &&
42 *rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) { 42 *rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) {
43 dev_info(&hdev->dev, "Fixing up Sony Vaio VGX report " 43 hid_info(hdev, "Fixing up Sony Vaio VGX report descriptor\n");
44 "descriptor\n");
45 rdesc[55] = 0x06; 44 rdesc[55] = 0x06;
46 } 45 }
47 return rdesc; 46 return rdesc;
@@ -89,7 +88,7 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev)
89 (3 << 8) | 0xf2, ifnum, buf, 17, 88 (3 << 8) | 0xf2, ifnum, buf, 17,
90 USB_CTRL_GET_TIMEOUT); 89 USB_CTRL_GET_TIMEOUT);
91 if (ret < 0) 90 if (ret < 0)
92 dev_err(&hdev->dev, "can't set operational mode\n"); 91 hid_err(hdev, "can't set operational mode\n");
93 92
94 kfree(buf); 93 kfree(buf);
95 94
@@ -110,7 +109,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
110 109
111 sc = kzalloc(sizeof(*sc), GFP_KERNEL); 110 sc = kzalloc(sizeof(*sc), GFP_KERNEL);
112 if (sc == NULL) { 111 if (sc == NULL) {
113 dev_err(&hdev->dev, "can't alloc sony descriptor\n"); 112 hid_err(hdev, "can't alloc sony descriptor\n");
114 return -ENOMEM; 113 return -ENOMEM;
115 } 114 }
116 115
@@ -119,14 +118,14 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
119 118
120 ret = hid_parse(hdev); 119 ret = hid_parse(hdev);
121 if (ret) { 120 if (ret) {
122 dev_err(&hdev->dev, "parse failed\n"); 121 hid_err(hdev, "parse failed\n");
123 goto err_free; 122 goto err_free;
124 } 123 }
125 124
126 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | 125 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT |
127 HID_CONNECT_HIDDEV_FORCE); 126 HID_CONNECT_HIDDEV_FORCE);
128 if (ret) { 127 if (ret) {
129 dev_err(&hdev->dev, "hw start failed\n"); 128 hid_err(hdev, "hw start failed\n");
130 goto err_free; 129 goto err_free;
131 } 130 }
132 131
diff --git a/drivers/hid/hid-stantum.c b/drivers/hid/hid-stantum.c
index 3171be28c3d5..b2be1d11916b 100644
--- a/drivers/hid/hid-stantum.c
+++ b/drivers/hid/hid-stantum.c
@@ -222,7 +222,7 @@ static int stantum_probe(struct hid_device *hdev,
222 222
223 sd = kmalloc(sizeof(struct stantum_data), GFP_KERNEL); 223 sd = kmalloc(sizeof(struct stantum_data), GFP_KERNEL);
224 if (!sd) { 224 if (!sd) {
225 dev_err(&hdev->dev, "cannot allocate Stantum data\n"); 225 hid_err(hdev, "cannot allocate Stantum data\n");
226 return -ENOMEM; 226 return -ENOMEM;
227 } 227 }
228 sd->valid = false; 228 sd->valid = false;
diff --git a/drivers/hid/hid-sunplus.c b/drivers/hid/hid-sunplus.c
index 164ed568f6cf..d484a0043dd4 100644
--- a/drivers/hid/hid-sunplus.c
+++ b/drivers/hid/hid-sunplus.c
@@ -27,8 +27,7 @@ static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
27{ 27{
28 if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && 28 if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 &&
29 rdesc[106] == 0x03) { 29 rdesc[106] == 0x03) {
30 dev_info(&hdev->dev, "fixing up Sunplus Wireless Desktop " 30 hid_info(hdev, "fixing up Sunplus Wireless Desktop report descriptor\n");
31 "report descriptor\n");
32 rdesc[105] = rdesc[110] = 0x03; 31 rdesc[105] = rdesc[110] = 0x03;
33 rdesc[106] = rdesc[111] = 0x21; 32 rdesc[106] = rdesc[111] = 0x21;
34 } 33 }
diff --git a/drivers/hid/hid-tmff.c b/drivers/hid/hid-tmff.c
index 25be4e1461bd..575862b0688e 100644
--- a/drivers/hid/hid-tmff.c
+++ b/drivers/hid/hid-tmff.c
@@ -151,28 +151,23 @@ static int tmff_init(struct hid_device *hid, const signed short *ff_bits)
151 switch (field->usage[0].hid) { 151 switch (field->usage[0].hid) {
152 case THRUSTMASTER_USAGE_FF: 152 case THRUSTMASTER_USAGE_FF:
153 if (field->report_count < 2) { 153 if (field->report_count < 2) {
154 dev_warn(&hid->dev, "ignoring FF field " 154 hid_warn(hid, "ignoring FF field with report_count < 2\n");
155 "with report_count < 2\n");
156 continue; 155 continue;
157 } 156 }
158 157
159 if (field->logical_maximum == 158 if (field->logical_maximum ==
160 field->logical_minimum) { 159 field->logical_minimum) {
161 dev_warn(&hid->dev, "ignoring FF field " 160 hid_warn(hid, "ignoring FF field with logical_maximum == logical_minimum\n");
162 "with logical_maximum "
163 "== logical_minimum\n");
164 continue; 161 continue;
165 } 162 }
166 163
167 if (tmff->report && tmff->report != report) { 164 if (tmff->report && tmff->report != report) {
168 dev_warn(&hid->dev, "ignoring FF field " 165 hid_warn(hid, "ignoring FF field in other report\n");
169 "in other report\n");
170 continue; 166 continue;
171 } 167 }
172 168
173 if (tmff->ff_field && tmff->ff_field != field) { 169 if (tmff->ff_field && tmff->ff_field != field) {
174 dev_warn(&hid->dev, "ignoring " 170 hid_warn(hid, "ignoring duplicate FF field\n");
175 "duplicate FF field\n");
176 continue; 171 continue;
177 } 172 }
178 173
@@ -185,16 +180,15 @@ static int tmff_init(struct hid_device *hid, const signed short *ff_bits)
185 break; 180 break;
186 181
187 default: 182 default:
188 dev_warn(&hid->dev, "ignoring unknown output " 183 hid_warn(hid, "ignoring unknown output usage %08x\n",
189 "usage %08x\n", 184 field->usage[0].hid);
190 field->usage[0].hid);
191 continue; 185 continue;
192 } 186 }
193 } 187 }
194 } 188 }
195 189
196 if (!tmff->report) { 190 if (!tmff->report) {
197 dev_err(&hid->dev, "can't find FF field in output reports\n"); 191 hid_err(hid, "can't find FF field in output reports\n");
198 error = -ENODEV; 192 error = -ENODEV;
199 goto fail; 193 goto fail;
200 } 194 }
@@ -203,8 +197,7 @@ static int tmff_init(struct hid_device *hid, const signed short *ff_bits)
203 if (error) 197 if (error)
204 goto fail; 198 goto fail;
205 199
206 dev_info(&hid->dev, "force feedback for ThrustMaster devices by Zinx " 200 hid_info(hid, "force feedback for ThrustMaster devices by Zinx Verituse <zinx@epicsol.org>\n");
207 "Verituse <zinx@epicsol.org>");
208 return 0; 201 return 0;
209 202
210fail: 203fail:
@@ -224,13 +217,13 @@ static int tm_probe(struct hid_device *hdev, const struct hid_device_id *id)
224 217
225 ret = hid_parse(hdev); 218 ret = hid_parse(hdev);
226 if (ret) { 219 if (ret) {
227 dev_err(&hdev->dev, "parse failed\n"); 220 hid_err(hdev, "parse failed\n");
228 goto err; 221 goto err;
229 } 222 }
230 223
231 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 224 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
232 if (ret) { 225 if (ret) {
233 dev_err(&hdev->dev, "hw start failed\n"); 226 hid_err(hdev, "hw start failed\n");
234 goto err; 227 goto err;
235 } 228 }
236 229
diff --git a/drivers/hid/hid-topseed.c b/drivers/hid/hid-topseed.c
index 956ed9ac19d4..613ff7b1d746 100644
--- a/drivers/hid/hid-topseed.c
+++ b/drivers/hid/hid-topseed.c
@@ -66,6 +66,7 @@ static const struct hid_device_id ts_devices[] = {
66 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, 66 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
67 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, 67 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
68 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, 68 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) },
69 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
69 { } 70 { }
70}; 71};
71MODULE_DEVICE_TABLE(hid, ts_devices); 72MODULE_DEVICE_TABLE(hid, ts_devices);
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index 724f46ed612f..06888323828c 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -18,6 +18,8 @@
18 * any later version. 18 * any later version.
19 */ 19 */
20 20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
21#include <linux/device.h> 23#include <linux/device.h>
22#include <linux/hid.h> 24#include <linux/hid.h>
23#include <linux/module.h> 25#include <linux/module.h>
@@ -141,8 +143,8 @@ static void wacom_poke(struct hid_device *hdev, u8 speed)
141 * Note that if the raw queries fail, it's not a hard failure and it 143 * Note that if the raw queries fail, it's not a hard failure and it
142 * is safe to continue 144 * is safe to continue
143 */ 145 */
144 dev_warn(&hdev->dev, "failed to poke device, command %d, err %d\n", 146 hid_warn(hdev, "failed to poke device, command %d, err %d\n",
145 rep_data[0], ret); 147 rep_data[0], ret);
146 return; 148 return;
147} 149}
148 150
@@ -172,7 +174,7 @@ static ssize_t wacom_store_speed(struct device *dev,
172 return -EINVAL; 174 return -EINVAL;
173} 175}
174 176
175static DEVICE_ATTR(speed, S_IRUGO | S_IWUGO, 177static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR | S_IWGRP,
176 wacom_show_speed, wacom_store_speed); 178 wacom_show_speed, wacom_store_speed);
177 179
178static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, 180static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
@@ -312,7 +314,7 @@ static int wacom_probe(struct hid_device *hdev,
312 314
313 wdata = kzalloc(sizeof(*wdata), GFP_KERNEL); 315 wdata = kzalloc(sizeof(*wdata), GFP_KERNEL);
314 if (wdata == NULL) { 316 if (wdata == NULL) {
315 dev_err(&hdev->dev, "can't alloc wacom descriptor\n"); 317 hid_err(hdev, "can't alloc wacom descriptor\n");
316 return -ENOMEM; 318 return -ENOMEM;
317 } 319 }
318 320
@@ -321,20 +323,20 @@ static int wacom_probe(struct hid_device *hdev,
321 /* Parse the HID report now */ 323 /* Parse the HID report now */
322 ret = hid_parse(hdev); 324 ret = hid_parse(hdev);
323 if (ret) { 325 if (ret) {
324 dev_err(&hdev->dev, "parse failed\n"); 326 hid_err(hdev, "parse failed\n");
325 goto err_free; 327 goto err_free;
326 } 328 }
327 329
328 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 330 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
329 if (ret) { 331 if (ret) {
330 dev_err(&hdev->dev, "hw start failed\n"); 332 hid_err(hdev, "hw start failed\n");
331 goto err_free; 333 goto err_free;
332 } 334 }
333 335
334 ret = device_create_file(&hdev->dev, &dev_attr_speed); 336 ret = device_create_file(&hdev->dev, &dev_attr_speed);
335 if (ret) 337 if (ret)
336 dev_warn(&hdev->dev, 338 hid_warn(hdev,
337 "can't create sysfs speed attribute err: %d\n", ret); 339 "can't create sysfs speed attribute err: %d\n", ret);
338 340
339 /* Set Wacom mode 2 with high reporting speed */ 341 /* Set Wacom mode 2 with high reporting speed */
340 wacom_poke(hdev, 1); 342 wacom_poke(hdev, 1);
@@ -349,8 +351,8 @@ static int wacom_probe(struct hid_device *hdev,
349 351
350 ret = power_supply_register(&hdev->dev, &wdata->battery); 352 ret = power_supply_register(&hdev->dev, &wdata->battery);
351 if (ret) { 353 if (ret) {
352 dev_warn(&hdev->dev, 354 hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n",
353 "can't create sysfs battery attribute, err: %d\n", ret); 355 ret);
354 /* 356 /*
355 * battery attribute is not critical for the tablet, but if it 357 * battery attribute is not critical for the tablet, but if it
356 * failed then there is no need to create ac attribute 358 * failed then there is no need to create ac attribute
@@ -367,8 +369,8 @@ static int wacom_probe(struct hid_device *hdev,
367 369
368 ret = power_supply_register(&hdev->dev, &wdata->ac); 370 ret = power_supply_register(&hdev->dev, &wdata->ac);
369 if (ret) { 371 if (ret) {
370 dev_warn(&hdev->dev, 372 hid_warn(hdev,
371 "can't create ac battery attribute, err: %d\n", ret); 373 "can't create ac battery attribute, err: %d\n", ret);
372 /* 374 /*
373 * ac attribute is not critical for the tablet, but if it 375 * ac attribute is not critical for the tablet, but if it
374 * failed then we don't want to battery attribute to exist 376 * failed then we don't want to battery attribute to exist
@@ -454,7 +456,7 @@ static int __init wacom_init(void)
454 456
455 ret = hid_register_driver(&wacom_driver); 457 ret = hid_register_driver(&wacom_driver);
456 if (ret) 458 if (ret)
457 printk(KERN_ERR "can't register wacom driver\n"); 459 pr_err("can't register wacom driver\n");
458 return ret; 460 return ret;
459} 461}
460 462
diff --git a/drivers/hid/hid-zpff.c b/drivers/hid/hid-zpff.c
index b7acceabba80..f31fab012f2f 100644
--- a/drivers/hid/hid-zpff.c
+++ b/drivers/hid/hid-zpff.c
@@ -75,14 +75,14 @@ static int zpff_init(struct hid_device *hid)
75 int error; 75 int error;
76 76
77 if (list_empty(report_list)) { 77 if (list_empty(report_list)) {
78 dev_err(&hid->dev, "no output report found\n"); 78 hid_err(hid, "no output report found\n");
79 return -ENODEV; 79 return -ENODEV;
80 } 80 }
81 81
82 report = list_entry(report_list->next, struct hid_report, list); 82 report = list_entry(report_list->next, struct hid_report, list);
83 83
84 if (report->maxfield < 4) { 84 if (report->maxfield < 4) {
85 dev_err(&hid->dev, "not enough fields in report\n"); 85 hid_err(hid, "not enough fields in report\n");
86 return -ENODEV; 86 return -ENODEV;
87 } 87 }
88 88
@@ -105,8 +105,7 @@ static int zpff_init(struct hid_device *hid)
105 zpff->report->field[3]->value[0] = 0x00; 105 zpff->report->field[3]->value[0] = 0x00;
106 usbhid_submit_report(hid, zpff->report, USB_DIR_OUT); 106 usbhid_submit_report(hid, zpff->report, USB_DIR_OUT);
107 107
108 dev_info(&hid->dev, "force feedback for Zeroplus based devices by " 108 hid_info(hid, "force feedback for Zeroplus based devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
109 "Anssi Hannula <anssi.hannula@gmail.com>\n");
110 109
111 return 0; 110 return 0;
112} 111}
@@ -123,13 +122,13 @@ static int zp_probe(struct hid_device *hdev, const struct hid_device_id *id)
123 122
124 ret = hid_parse(hdev); 123 ret = hid_parse(hdev);
125 if (ret) { 124 if (ret) {
126 dev_err(&hdev->dev, "parse failed\n"); 125 hid_err(hdev, "parse failed\n");
127 goto err; 126 goto err;
128 } 127 }
129 128
130 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 129 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
131 if (ret) { 130 if (ret) {
132 dev_err(&hdev->dev, "hw start failed\n"); 131 hid_err(hdev, "hw start failed\n");
133 goto err; 132 goto err;
134 } 133 }
135 134
diff --git a/drivers/hid/hid-zydacron.c b/drivers/hid/hid-zydacron.c
index aac1f9273149..e90371508fd2 100644
--- a/drivers/hid/hid-zydacron.c
+++ b/drivers/hid/hid-zydacron.c
@@ -34,9 +34,8 @@ static __u8 *zc_report_fixup(struct hid_device *hdev, __u8 *rdesc,
34 rdesc[0x96] == 0xbc && rdesc[0x97] == 0xff && 34 rdesc[0x96] == 0xbc && rdesc[0x97] == 0xff &&
35 rdesc[0xca] == 0xbc && rdesc[0xcb] == 0xff && 35 rdesc[0xca] == 0xbc && rdesc[0xcb] == 0xff &&
36 rdesc[0xe1] == 0xbc && rdesc[0xe2] == 0xff) { 36 rdesc[0xe1] == 0xbc && rdesc[0xe2] == 0xff) {
37 dev_info(&hdev->dev, 37 hid_info(hdev,
38 "fixing up zydacron remote control report " 38 "fixing up zydacron remote control report descriptor\n");
39 "descriptor\n");
40 rdesc[0x96] = rdesc[0xca] = rdesc[0xe1] = 0x0c; 39 rdesc[0x96] = rdesc[0xca] = rdesc[0xe1] = 0x0c;
41 rdesc[0x97] = rdesc[0xcb] = rdesc[0xe2] = 0x00; 40 rdesc[0x97] = rdesc[0xcb] = rdesc[0xe2] = 0x00;
42 } 41 }
@@ -172,7 +171,7 @@ static int zc_probe(struct hid_device *hdev, const struct hid_device_id *id)
172 171
173 zc = kzalloc(sizeof(*zc), GFP_KERNEL); 172 zc = kzalloc(sizeof(*zc), GFP_KERNEL);
174 if (zc == NULL) { 173 if (zc == NULL) {
175 dev_err(&hdev->dev, "zydacron: can't alloc descriptor\n"); 174 hid_err(hdev, "can't alloc descriptor\n");
176 return -ENOMEM; 175 return -ENOMEM;
177 } 176 }
178 177
@@ -180,13 +179,13 @@ static int zc_probe(struct hid_device *hdev, const struct hid_device_id *id)
180 179
181 ret = hid_parse(hdev); 180 ret = hid_parse(hdev);
182 if (ret) { 181 if (ret) {
183 dev_err(&hdev->dev, "zydacron: parse failed\n"); 182 hid_err(hdev, "parse failed\n");
184 goto err_free; 183 goto err_free;
185 } 184 }
186 185
187 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 186 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
188 if (ret) { 187 if (ret) {
189 dev_err(&hdev->dev, "zydacron: hw start failed\n"); 188 hid_err(hdev, "hw start failed\n");
190 goto err_free; 189 goto err_free;
191 } 190 }
192 191
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index e1f07483691f..68d087f63c02 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -19,6 +19,8 @@
19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20 */ 20 */
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23
22#include <linux/fs.h> 24#include <linux/fs.h>
23#include <linux/module.h> 25#include <linux/module.h>
24#include <linux/errno.h> 26#include <linux/errno.h>
@@ -122,15 +124,15 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
122 } 124 }
123 125
124 if (count > HID_MAX_BUFFER_SIZE) { 126 if (count > HID_MAX_BUFFER_SIZE) {
125 printk(KERN_WARNING "hidraw: pid %d passed too large report\n", 127 hid_warn(dev, "pid %d passed too large report\n",
126 task_pid_nr(current)); 128 task_pid_nr(current));
127 ret = -EINVAL; 129 ret = -EINVAL;
128 goto out; 130 goto out;
129 } 131 }
130 132
131 if (count < 2) { 133 if (count < 2) {
132 printk(KERN_WARNING "hidraw: pid %d passed too short report\n", 134 hid_warn(dev, "pid %d passed too short report\n",
133 task_pid_nr(current)); 135 task_pid_nr(current));
134 ret = -EINVAL; 136 ret = -EINVAL;
135 goto out; 137 goto out;
136 } 138 }
@@ -192,15 +194,13 @@ static int hidraw_open(struct inode *inode, struct file *file)
192 194
193 dev = hidraw_table[minor]; 195 dev = hidraw_table[minor];
194 if (!dev->open++) { 196 if (!dev->open++) {
195 if (dev->hid->ll_driver->power) { 197 err = hid_hw_power(dev->hid, PM_HINT_FULLON);
196 err = dev->hid->ll_driver->power(dev->hid, PM_HINT_FULLON); 198 if (err < 0)
197 if (err < 0) 199 goto out_unlock;
198 goto out_unlock; 200
199 } 201 err = hid_hw_open(dev->hid);
200 err = dev->hid->ll_driver->open(dev->hid);
201 if (err < 0) { 202 if (err < 0) {
202 if (dev->hid->ll_driver->power) 203 hid_hw_power(dev->hid, PM_HINT_NORMAL);
203 dev->hid->ll_driver->power(dev->hid, PM_HINT_NORMAL);
204 dev->open--; 204 dev->open--;
205 } 205 }
206 } 206 }
@@ -229,9 +229,8 @@ static int hidraw_release(struct inode * inode, struct file * file)
229 dev = hidraw_table[minor]; 229 dev = hidraw_table[minor];
230 if (!--dev->open) { 230 if (!--dev->open) {
231 if (list->hidraw->exist) { 231 if (list->hidraw->exist) {
232 if (dev->hid->ll_driver->power) 232 hid_hw_power(dev->hid, PM_HINT_NORMAL);
233 dev->hid->ll_driver->power(dev->hid, PM_HINT_NORMAL); 233 hid_hw_close(dev->hid);
234 dev->hid->ll_driver->close(dev->hid);
235 } else { 234 } else {
236 kfree(list->hidraw); 235 kfree(list->hidraw);
237 } 236 }
@@ -433,7 +432,7 @@ void hidraw_disconnect(struct hid_device *hid)
433 device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor)); 432 device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
434 433
435 if (hidraw->open) { 434 if (hidraw->open) {
436 hid->ll_driver->close(hid); 435 hid_hw_close(hid);
437 wake_up_interruptible(&hidraw->wait); 436 wake_up_interruptible(&hidraw->wait);
438 } else { 437 } else {
439 kfree(hidraw); 438 kfree(hidraw);
@@ -452,7 +451,7 @@ int __init hidraw_init(void)
452 hidraw_major = MAJOR(dev_id); 451 hidraw_major = MAJOR(dev_id);
453 452
454 if (result < 0) { 453 if (result < 0) {
455 printk(KERN_WARNING "hidraw: can't get major number\n"); 454 pr_warn("can't get major number\n");
456 result = 0; 455 result = 0;
457 goto out; 456 goto out;
458 } 457 }
diff --git a/drivers/hid/usbhid/Makefile b/drivers/hid/usbhid/Makefile
index 1329ecb37a1c..db3cf31c6fa1 100644
--- a/drivers/hid/usbhid/Makefile
+++ b/drivers/hid/usbhid/Makefile
@@ -3,15 +3,15 @@
3# 3#
4 4
5# Multipart objects. 5# Multipart objects.
6usbhid-objs := hid-core.o hid-quirks.o 6usbhid-y := hid-core.o hid-quirks.o
7 7
8# Optional parts of multipart objects. 8# Optional parts of multipart objects.
9 9
10ifeq ($(CONFIG_USB_HIDDEV),y) 10ifeq ($(CONFIG_USB_HIDDEV),y)
11 usbhid-objs += hiddev.o 11 usbhid-y += hiddev.o
12endif 12endif
13ifeq ($(CONFIG_HID_PID),y) 13ifeq ($(CONFIG_HID_PID),y)
14 usbhid-objs += hid-pidff.o 14 usbhid-y += hid-pidff.o
15endif 15endif
16 16
17obj-$(CONFIG_USB_HID) += usbhid.o 17obj-$(CONFIG_USB_HID) += usbhid.o
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 5489eab3a6bd..276758f53ab5 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -136,10 +136,10 @@ static void hid_reset(struct work_struct *work)
136 hid_io_error(hid); 136 hid_io_error(hid);
137 break; 137 break;
138 default: 138 default:
139 err_hid("can't reset device, %s-%s/input%d, status %d", 139 hid_err(hid, "can't reset device, %s-%s/input%d, status %d\n",
140 hid_to_usb_dev(hid)->bus->bus_name, 140 hid_to_usb_dev(hid)->bus->bus_name,
141 hid_to_usb_dev(hid)->devpath, 141 hid_to_usb_dev(hid)->devpath,
142 usbhid->ifnum, rc); 142 usbhid->ifnum, rc);
143 /* FALLTHROUGH */ 143 /* FALLTHROUGH */
144 case -EHOSTUNREACH: 144 case -EHOSTUNREACH:
145 case -ENODEV: 145 case -ENODEV:
@@ -278,18 +278,18 @@ static void hid_irq_in(struct urb *urb)
278 hid_io_error(hid); 278 hid_io_error(hid);
279 return; 279 return;
280 default: /* error */ 280 default: /* error */
281 dev_warn(&urb->dev->dev, "input irq status %d " 281 hid_warn(urb->dev, "input irq status %d received\n",
282 "received\n", urb->status); 282 urb->status);
283 } 283 }
284 284
285 status = usb_submit_urb(urb, GFP_ATOMIC); 285 status = usb_submit_urb(urb, GFP_ATOMIC);
286 if (status) { 286 if (status) {
287 clear_bit(HID_IN_RUNNING, &usbhid->iofl); 287 clear_bit(HID_IN_RUNNING, &usbhid->iofl);
288 if (status != -EPERM) { 288 if (status != -EPERM) {
289 err_hid("can't resubmit intr, %s-%s/input%d, status %d", 289 hid_err(hid, "can't resubmit intr, %s-%s/input%d, status %d\n",
290 hid_to_usb_dev(hid)->bus->bus_name, 290 hid_to_usb_dev(hid)->bus->bus_name,
291 hid_to_usb_dev(hid)->devpath, 291 hid_to_usb_dev(hid)->devpath,
292 usbhid->ifnum, status); 292 usbhid->ifnum, status);
293 hid_io_error(hid); 293 hid_io_error(hid);
294 } 294 }
295 } 295 }
@@ -313,7 +313,7 @@ static int hid_submit_out(struct hid_device *hid)
313 dbg_hid("submitting out urb\n"); 313 dbg_hid("submitting out urb\n");
314 314
315 if (usb_submit_urb(usbhid->urbout, GFP_ATOMIC)) { 315 if (usb_submit_urb(usbhid->urbout, GFP_ATOMIC)) {
316 err_hid("usb_submit_urb(out) failed"); 316 hid_err(hid, "usb_submit_urb(out) failed\n");
317 return -1; 317 return -1;
318 } 318 }
319 usbhid->last_out = jiffies; 319 usbhid->last_out = jiffies;
@@ -375,7 +375,7 @@ static int hid_submit_ctrl(struct hid_device *hid)
375 usbhid->cr->wValue, usbhid->cr->wIndex, usbhid->cr->wLength); 375 usbhid->cr->wValue, usbhid->cr->wIndex, usbhid->cr->wLength);
376 376
377 if (usb_submit_urb(usbhid->urbctrl, GFP_ATOMIC)) { 377 if (usb_submit_urb(usbhid->urbctrl, GFP_ATOMIC)) {
378 err_hid("usb_submit_urb(ctrl) failed"); 378 hid_err(hid, "usb_submit_urb(ctrl) failed\n");
379 return -1; 379 return -1;
380 } 380 }
381 usbhid->last_ctrl = jiffies; 381 usbhid->last_ctrl = jiffies;
@@ -413,8 +413,8 @@ static void hid_irq_out(struct urb *urb)
413 case -ENOENT: 413 case -ENOENT:
414 break; 414 break;
415 default: /* error */ 415 default: /* error */
416 dev_warn(&urb->dev->dev, "output irq status %d " 416 hid_warn(urb->dev, "output irq status %d received\n",
417 "received\n", urb->status); 417 urb->status);
418 } 418 }
419 419
420 spin_lock_irqsave(&usbhid->lock, flags); 420 spin_lock_irqsave(&usbhid->lock, flags);
@@ -466,8 +466,7 @@ static void hid_ctrl(struct urb *urb)
466 case -EPIPE: /* report not available */ 466 case -EPIPE: /* report not available */
467 break; 467 break;
468 default: /* error */ 468 default: /* error */
469 dev_warn(&urb->dev->dev, "ctrl urb status %d " 469 hid_warn(urb->dev, "ctrl urb status %d received\n", status);
470 "received\n", status);
471 } 470 }
472 471
473 if (unplug) 472 if (unplug)
@@ -501,13 +500,13 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re
501 500
502 if (usbhid->urbout && dir == USB_DIR_OUT && report->type == HID_OUTPUT_REPORT) { 501 if (usbhid->urbout && dir == USB_DIR_OUT && report->type == HID_OUTPUT_REPORT) {
503 if ((head = (usbhid->outhead + 1) & (HID_OUTPUT_FIFO_SIZE - 1)) == usbhid->outtail) { 502 if ((head = (usbhid->outhead + 1) & (HID_OUTPUT_FIFO_SIZE - 1)) == usbhid->outtail) {
504 dev_warn(&hid->dev, "output queue full\n"); 503 hid_warn(hid, "output queue full\n");
505 return; 504 return;
506 } 505 }
507 506
508 usbhid->out[usbhid->outhead].raw_report = kmalloc(len, GFP_ATOMIC); 507 usbhid->out[usbhid->outhead].raw_report = kmalloc(len, GFP_ATOMIC);
509 if (!usbhid->out[usbhid->outhead].raw_report) { 508 if (!usbhid->out[usbhid->outhead].raw_report) {
510 dev_warn(&hid->dev, "output queueing failed\n"); 509 hid_warn(hid, "output queueing failed\n");
511 return; 510 return;
512 } 511 }
513 hid_output_report(report, usbhid->out[usbhid->outhead].raw_report); 512 hid_output_report(report, usbhid->out[usbhid->outhead].raw_report);
@@ -532,14 +531,14 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re
532 } 531 }
533 532
534 if ((head = (usbhid->ctrlhead + 1) & (HID_CONTROL_FIFO_SIZE - 1)) == usbhid->ctrltail) { 533 if ((head = (usbhid->ctrlhead + 1) & (HID_CONTROL_FIFO_SIZE - 1)) == usbhid->ctrltail) {
535 dev_warn(&hid->dev, "control queue full\n"); 534 hid_warn(hid, "control queue full\n");
536 return; 535 return;
537 } 536 }
538 537
539 if (dir == USB_DIR_OUT) { 538 if (dir == USB_DIR_OUT) {
540 usbhid->ctrl[usbhid->ctrlhead].raw_report = kmalloc(len, GFP_ATOMIC); 539 usbhid->ctrl[usbhid->ctrlhead].raw_report = kmalloc(len, GFP_ATOMIC);
541 if (!usbhid->ctrl[usbhid->ctrlhead].raw_report) { 540 if (!usbhid->ctrl[usbhid->ctrlhead].raw_report) {
542 dev_warn(&hid->dev, "control queueing failed\n"); 541 hid_warn(hid, "control queueing failed\n");
543 return; 542 return;
544 } 543 }
545 hid_output_report(report, usbhid->ctrl[usbhid->ctrlhead].raw_report); 544 hid_output_report(report, usbhid->ctrl[usbhid->ctrlhead].raw_report);
@@ -590,7 +589,7 @@ static int usb_hidinput_input_event(struct input_dev *dev, unsigned int type, un
590 return -1; 589 return -1;
591 590
592 if ((offset = hidinput_find_field(hid, type, code, &field)) == -1) { 591 if ((offset = hidinput_find_field(hid, type, code, &field)) == -1) {
593 dev_warn(&dev->dev, "event field not found\n"); 592 hid_warn(dev, "event field not found\n");
594 return -1; 593 return -1;
595 } 594 }
596 595
@@ -722,7 +721,7 @@ void usbhid_init_reports(struct hid_device *hid)
722 } 721 }
723 722
724 if (err) 723 if (err)
725 dev_warn(&hid->dev, "timeout initializing reports\n"); 724 hid_warn(hid, "timeout initializing reports\n");
726} 725}
727 726
728/* 727/*
@@ -1140,8 +1139,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
1140 if (usb_endpoint_is_int_in(&interface->endpoint[n].desc)) 1139 if (usb_endpoint_is_int_in(&interface->endpoint[n].desc))
1141 has_in++; 1140 has_in++;
1142 if (!has_in) { 1141 if (!has_in) {
1143 dev_err(&intf->dev, "couldn't find an input interrupt " 1142 hid_err(intf, "couldn't find an input interrupt endpoint\n");
1144 "endpoint\n");
1145 return -ENODEV; 1143 return -ENODEV;
1146 } 1144 }
1147 1145
@@ -1213,7 +1211,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
1213 ret = hid_add_device(hid); 1211 ret = hid_add_device(hid);
1214 if (ret) { 1212 if (ret) {
1215 if (ret != -ENODEV) 1213 if (ret != -ENODEV)
1216 dev_err(&intf->dev, "can't add hid device: %d\n", ret); 1214 hid_err(intf, "can't add hid device: %d\n", ret);
1217 goto err_free; 1215 goto err_free;
1218 } 1216 }
1219 1217
diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
index ef381d79cfa8..f91c136821f7 100644
--- a/drivers/hid/usbhid/hid-pidff.c
+++ b/drivers/hid/usbhid/hid-pidff.c
@@ -22,7 +22,7 @@
22 22
23/* #define DEBUG */ 23/* #define DEBUG */
24 24
25#define debug(format, arg...) pr_debug("hid-pidff: " format "\n" , ## arg) 25#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
26 26
27#include <linux/input.h> 27#include <linux/input.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
@@ -220,7 +220,7 @@ static int pidff_rescale_signed(int i, struct hid_field *field)
220static void pidff_set(struct pidff_usage *usage, u16 value) 220static void pidff_set(struct pidff_usage *usage, u16 value)
221{ 221{
222 usage->value[0] = pidff_rescale(value, 0xffff, usage->field); 222 usage->value[0] = pidff_rescale(value, 0xffff, usage->field);
223 debug("calculated from %d to %d", value, usage->value[0]); 223 pr_debug("calculated from %d to %d\n", value, usage->value[0]);
224} 224}
225 225
226static void pidff_set_signed(struct pidff_usage *usage, s16 value) 226static void pidff_set_signed(struct pidff_usage *usage, s16 value)
@@ -235,7 +235,7 @@ static void pidff_set_signed(struct pidff_usage *usage, s16 value)
235 usage->value[0] = 235 usage->value[0] =
236 pidff_rescale(value, 0x7fff, usage->field); 236 pidff_rescale(value, 0x7fff, usage->field);
237 } 237 }
238 debug("calculated from %d to %d", value, usage->value[0]); 238 pr_debug("calculated from %d to %d\n", value, usage->value[0]);
239} 239}
240 240
241/* 241/*
@@ -259,8 +259,9 @@ static void pidff_set_envelope_report(struct pidff_device *pidff,
259 pidff->set_envelope[PID_ATTACK_TIME].value[0] = envelope->attack_length; 259 pidff->set_envelope[PID_ATTACK_TIME].value[0] = envelope->attack_length;
260 pidff->set_envelope[PID_FADE_TIME].value[0] = envelope->fade_length; 260 pidff->set_envelope[PID_FADE_TIME].value[0] = envelope->fade_length;
261 261
262 debug("attack %u => %d", envelope->attack_level, 262 hid_dbg(pidff->hid, "attack %u => %d\n",
263 pidff->set_envelope[PID_ATTACK_LEVEL].value[0]); 263 envelope->attack_level,
264 pidff->set_envelope[PID_ATTACK_LEVEL].value[0]);
264 265
265 usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_ENVELOPE], 266 usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_ENVELOPE],
266 USB_DIR_OUT); 267 USB_DIR_OUT);
@@ -466,33 +467,33 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum)
466 pidff->create_new_effect_type->value[0] = efnum; 467 pidff->create_new_effect_type->value[0] = efnum;
467 usbhid_submit_report(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT], 468 usbhid_submit_report(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT],
468 USB_DIR_OUT); 469 USB_DIR_OUT);
469 debug("create_new_effect sent, type: %d", efnum); 470 hid_dbg(pidff->hid, "create_new_effect sent, type: %d\n", efnum);
470 471
471 pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0; 472 pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0;
472 pidff->block_load_status->value[0] = 0; 473 pidff->block_load_status->value[0] = 0;
473 usbhid_wait_io(pidff->hid); 474 usbhid_wait_io(pidff->hid);
474 475
475 for (j = 0; j < 60; j++) { 476 for (j = 0; j < 60; j++) {
476 debug("pid_block_load requested"); 477 hid_dbg(pidff->hid, "pid_block_load requested\n");
477 usbhid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_LOAD], 478 usbhid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_LOAD],
478 USB_DIR_IN); 479 USB_DIR_IN);
479 usbhid_wait_io(pidff->hid); 480 usbhid_wait_io(pidff->hid);
480 if (pidff->block_load_status->value[0] == 481 if (pidff->block_load_status->value[0] ==
481 pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) { 482 pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) {
482 debug("device reported free memory: %d bytes", 483 hid_dbg(pidff->hid, "device reported free memory: %d bytes\n",
483 pidff->block_load[PID_RAM_POOL_AVAILABLE].value ? 484 pidff->block_load[PID_RAM_POOL_AVAILABLE].value ?
484 pidff->block_load[PID_RAM_POOL_AVAILABLE].value[0] : -1); 485 pidff->block_load[PID_RAM_POOL_AVAILABLE].value[0] : -1);
485 return 0; 486 return 0;
486 } 487 }
487 if (pidff->block_load_status->value[0] == 488 if (pidff->block_load_status->value[0] ==
488 pidff->status_id[PID_BLOCK_LOAD_FULL]) { 489 pidff->status_id[PID_BLOCK_LOAD_FULL]) {
489 debug("not enough memory free: %d bytes", 490 hid_dbg(pidff->hid, "not enough memory free: %d bytes\n",
490 pidff->block_load[PID_RAM_POOL_AVAILABLE].value ? 491 pidff->block_load[PID_RAM_POOL_AVAILABLE].value ?
491 pidff->block_load[PID_RAM_POOL_AVAILABLE].value[0] : -1); 492 pidff->block_load[PID_RAM_POOL_AVAILABLE].value[0] : -1);
492 return -ENOSPC; 493 return -ENOSPC;
493 } 494 }
494 } 495 }
495 printk(KERN_ERR "hid-pidff: pid_block_load failed 60 times\n"); 496 hid_err(pidff->hid, "pid_block_load failed 60 times\n");
496 return -EIO; 497 return -EIO;
497} 498}
498 499
@@ -546,7 +547,8 @@ static int pidff_erase_effect(struct input_dev *dev, int effect_id)
546 struct pidff_device *pidff = dev->ff->private; 547 struct pidff_device *pidff = dev->ff->private;
547 int pid_id = pidff->pid_id[effect_id]; 548 int pid_id = pidff->pid_id[effect_id];
548 549
549 debug("starting to erase %d/%d", effect_id, pidff->pid_id[effect_id]); 550 hid_dbg(pidff->hid, "starting to erase %d/%d\n",
551 effect_id, pidff->pid_id[effect_id]);
550 /* Wait for the queue to clear. We do not want a full fifo to 552 /* Wait for the queue to clear. We do not want a full fifo to
551 prevent the effect removal. */ 553 prevent the effect removal. */
552 usbhid_wait_io(pidff->hid); 554 usbhid_wait_io(pidff->hid);
@@ -604,8 +606,7 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,
604 type_id = PID_SAW_DOWN; 606 type_id = PID_SAW_DOWN;
605 break; 607 break;
606 default: 608 default:
607 printk(KERN_ERR 609 hid_err(pidff->hid, "invalid waveform\n");
608 "hid-pidff: invalid waveform\n");
609 return -EINVAL; 610 return -EINVAL;
610 } 611 }
611 612
@@ -696,7 +697,7 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,
696 break; 697 break;
697 698
698 default: 699 default:
699 printk(KERN_ERR "hid-pidff: invalid type\n"); 700 hid_err(pidff->hid, "invalid type\n");
700 return -EINVAL; 701 return -EINVAL;
701 } 702 }
702 703
@@ -704,7 +705,7 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,
704 pidff->pid_id[effect->id] = 705 pidff->pid_id[effect->id] =
705 pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0]; 706 pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0];
706 707
707 debug("uploaded"); 708 hid_dbg(pidff->hid, "uploaded\n");
708 709
709 return 0; 710 return 0;
710} 711}
@@ -770,14 +771,14 @@ static int pidff_find_fields(struct pidff_usage *usage, const u8 *table,
770 for (i = 0; i < report->maxfield; i++) { 771 for (i = 0; i < report->maxfield; i++) {
771 if (report->field[i]->maxusage != 772 if (report->field[i]->maxusage !=
772 report->field[i]->report_count) { 773 report->field[i]->report_count) {
773 debug("maxusage and report_count do not match, " 774 pr_debug("maxusage and report_count do not match, skipping\n");
774 "skipping");
775 continue; 775 continue;
776 } 776 }
777 for (j = 0; j < report->field[i]->maxusage; j++) { 777 for (j = 0; j < report->field[i]->maxusage; j++) {
778 if (report->field[i]->usage[j].hid == 778 if (report->field[i]->usage[j].hid ==
779 (HID_UP_PID | table[k])) { 779 (HID_UP_PID | table[k])) {
780 debug("found %d at %d->%d", k, i, j); 780 pr_debug("found %d at %d->%d\n",
781 k, i, j);
781 usage[k].field = report->field[i]; 782 usage[k].field = report->field[i];
782 usage[k].value = 783 usage[k].value =
783 &report->field[i]->value[j]; 784 &report->field[i]->value[j];
@@ -789,7 +790,7 @@ static int pidff_find_fields(struct pidff_usage *usage, const u8 *table,
789 break; 790 break;
790 } 791 }
791 if (!found && strict) { 792 if (!found && strict) {
792 debug("failed to locate %d", k); 793 pr_debug("failed to locate %d\n", k);
793 return -1; 794 return -1;
794 } 795 }
795 } 796 }
@@ -826,8 +827,8 @@ static void pidff_find_reports(struct hid_device *hid, int report_type,
826 continue; 827 continue;
827 ret = pidff_check_usage(report->field[0]->logical); 828 ret = pidff_check_usage(report->field[0]->logical);
828 if (ret != -1) { 829 if (ret != -1) {
829 debug("found usage 0x%02x from field->logical", 830 hid_dbg(hid, "found usage 0x%02x from field->logical\n",
830 pidff_reports[ret]); 831 pidff_reports[ret]);
831 pidff->reports[ret] = report; 832 pidff->reports[ret] = report;
832 continue; 833 continue;
833 } 834 }
@@ -845,8 +846,9 @@ static void pidff_find_reports(struct hid_device *hid, int report_type,
845 continue; 846 continue;
846 ret = pidff_check_usage(hid->collection[i - 1].usage); 847 ret = pidff_check_usage(hid->collection[i - 1].usage);
847 if (ret != -1 && !pidff->reports[ret]) { 848 if (ret != -1 && !pidff->reports[ret]) {
848 debug("found usage 0x%02x from collection array", 849 hid_dbg(hid,
849 pidff_reports[ret]); 850 "found usage 0x%02x from collection array\n",
851 pidff_reports[ret]);
850 pidff->reports[ret] = report; 852 pidff->reports[ret] = report;
851 } 853 }
852 } 854 }
@@ -861,7 +863,7 @@ static int pidff_reports_ok(struct pidff_device *pidff)
861 863
862 for (i = 0; i <= PID_REQUIRED_REPORTS; i++) { 864 for (i = 0; i <= PID_REQUIRED_REPORTS; i++) {
863 if (!pidff->reports[i]) { 865 if (!pidff->reports[i]) {
864 debug("%d missing", i); 866 hid_dbg(pidff->hid, "%d missing\n", i);
865 return 0; 867 return 0;
866 } 868 }
867 } 869 }
@@ -884,8 +886,7 @@ static struct hid_field *pidff_find_special_field(struct hid_report *report,
884 report->field[i]->logical_minimum == 1) 886 report->field[i]->logical_minimum == 1)
885 return report->field[i]; 887 return report->field[i];
886 else { 888 else {
887 printk(KERN_ERR "hid-pidff: logical_minimum " 889 pr_err("logical_minimum is not 1 as it should be\n");
888 "is not 1 as it should be\n");
889 return NULL; 890 return NULL;
890 } 891 }
891 } 892 }
@@ -924,7 +925,7 @@ static int pidff_find_special_keys(int *keys, struct hid_field *fld,
924 */ 925 */
925static int pidff_find_special_fields(struct pidff_device *pidff) 926static int pidff_find_special_fields(struct pidff_device *pidff)
926{ 927{
927 debug("finding special fields"); 928 hid_dbg(pidff->hid, "finding special fields\n");
928 929
929 pidff->create_new_effect_type = 930 pidff->create_new_effect_type =
930 pidff_find_special_field(pidff->reports[PID_CREATE_NEW_EFFECT], 931 pidff_find_special_field(pidff->reports[PID_CREATE_NEW_EFFECT],
@@ -945,32 +946,30 @@ static int pidff_find_special_fields(struct pidff_device *pidff)
945 pidff_find_special_field(pidff->reports[PID_EFFECT_OPERATION], 946 pidff_find_special_field(pidff->reports[PID_EFFECT_OPERATION],
946 0x78, 1); 947 0x78, 1);
947 948
948 debug("search done"); 949 hid_dbg(pidff->hid, "search done\n");
949 950
950 if (!pidff->create_new_effect_type || !pidff->set_effect_type) { 951 if (!pidff->create_new_effect_type || !pidff->set_effect_type) {
951 printk(KERN_ERR "hid-pidff: effect lists not found\n"); 952 hid_err(pidff->hid, "effect lists not found\n");
952 return -1; 953 return -1;
953 } 954 }
954 955
955 if (!pidff->effect_direction) { 956 if (!pidff->effect_direction) {
956 printk(KERN_ERR "hid-pidff: direction field not found\n"); 957 hid_err(pidff->hid, "direction field not found\n");
957 return -1; 958 return -1;
958 } 959 }
959 960
960 if (!pidff->device_control) { 961 if (!pidff->device_control) {
961 printk(KERN_ERR "hid-pidff: device control field not found\n"); 962 hid_err(pidff->hid, "device control field not found\n");
962 return -1; 963 return -1;
963 } 964 }
964 965
965 if (!pidff->block_load_status) { 966 if (!pidff->block_load_status) {
966 printk(KERN_ERR 967 hid_err(pidff->hid, "block load status field not found\n");
967 "hid-pidff: block load status field not found\n");
968 return -1; 968 return -1;
969 } 969 }
970 970
971 if (!pidff->effect_operation_status) { 971 if (!pidff->effect_operation_status) {
972 printk(KERN_ERR 972 hid_err(pidff->hid, "effect operation field not found\n");
973 "hid-pidff: effect operation field not found\n");
974 return -1; 973 return -1;
975 } 974 }
976 975
@@ -982,23 +981,22 @@ static int pidff_find_special_fields(struct pidff_device *pidff)
982 981
983 if (!PIDFF_FIND_SPECIAL_KEYS(type_id, create_new_effect_type, 982 if (!PIDFF_FIND_SPECIAL_KEYS(type_id, create_new_effect_type,
984 effect_types)) { 983 effect_types)) {
985 printk(KERN_ERR "hid-pidff: no effect types found\n"); 984 hid_err(pidff->hid, "no effect types found\n");
986 return -1; 985 return -1;
987 } 986 }
988 987
989 if (PIDFF_FIND_SPECIAL_KEYS(status_id, block_load_status, 988 if (PIDFF_FIND_SPECIAL_KEYS(status_id, block_load_status,
990 block_load_status) != 989 block_load_status) !=
991 sizeof(pidff_block_load_status)) { 990 sizeof(pidff_block_load_status)) {
992 printk(KERN_ERR 991 hid_err(pidff->hid,
993 "hidpidff: block load status identifiers not found\n"); 992 "block load status identifiers not found\n");
994 return -1; 993 return -1;
995 } 994 }
996 995
997 if (PIDFF_FIND_SPECIAL_KEYS(operation_id, effect_operation_status, 996 if (PIDFF_FIND_SPECIAL_KEYS(operation_id, effect_operation_status,
998 effect_operation_status) != 997 effect_operation_status) !=
999 sizeof(pidff_effect_operation_status)) { 998 sizeof(pidff_effect_operation_status)) {
1000 printk(KERN_ERR 999 hid_err(pidff->hid, "effect operation identifiers not found\n");
1001 "hidpidff: effect operation identifiers not found\n");
1002 return -1; 1000 return -1;
1003 } 1001 }
1004 1002
@@ -1017,8 +1015,8 @@ static int pidff_find_effects(struct pidff_device *pidff,
1017 int pidff_type = pidff->type_id[i]; 1015 int pidff_type = pidff->type_id[i];
1018 if (pidff->set_effect_type->usage[pidff_type].hid != 1016 if (pidff->set_effect_type->usage[pidff_type].hid !=
1019 pidff->create_new_effect_type->usage[pidff_type].hid) { 1017 pidff->create_new_effect_type->usage[pidff_type].hid) {
1020 printk(KERN_ERR "hid-pidff: " 1018 hid_err(pidff->hid,
1021 "effect type number %d is invalid\n", i); 1019 "effect type number %d is invalid\n", i);
1022 return -1; 1020 return -1;
1023 } 1021 }
1024 } 1022 }
@@ -1073,27 +1071,23 @@ static int pidff_init_fields(struct pidff_device *pidff, struct input_dev *dev)
1073 int envelope_ok = 0; 1071 int envelope_ok = 0;
1074 1072
1075 if (PIDFF_FIND_FIELDS(set_effect, PID_SET_EFFECT, 1)) { 1073 if (PIDFF_FIND_FIELDS(set_effect, PID_SET_EFFECT, 1)) {
1076 printk(KERN_ERR 1074 hid_err(pidff->hid, "unknown set_effect report layout\n");
1077 "hid-pidff: unknown set_effect report layout\n");
1078 return -ENODEV; 1075 return -ENODEV;
1079 } 1076 }
1080 1077
1081 PIDFF_FIND_FIELDS(block_load, PID_BLOCK_LOAD, 0); 1078 PIDFF_FIND_FIELDS(block_load, PID_BLOCK_LOAD, 0);
1082 if (!pidff->block_load[PID_EFFECT_BLOCK_INDEX].value) { 1079 if (!pidff->block_load[PID_EFFECT_BLOCK_INDEX].value) {
1083 printk(KERN_ERR 1080 hid_err(pidff->hid, "unknown pid_block_load report layout\n");
1084 "hid-pidff: unknown pid_block_load report layout\n");
1085 return -ENODEV; 1081 return -ENODEV;
1086 } 1082 }
1087 1083
1088 if (PIDFF_FIND_FIELDS(effect_operation, PID_EFFECT_OPERATION, 1)) { 1084 if (PIDFF_FIND_FIELDS(effect_operation, PID_EFFECT_OPERATION, 1)) {
1089 printk(KERN_ERR 1085 hid_err(pidff->hid, "unknown effect_operation report layout\n");
1090 "hid-pidff: unknown effect_operation report layout\n");
1091 return -ENODEV; 1086 return -ENODEV;
1092 } 1087 }
1093 1088
1094 if (PIDFF_FIND_FIELDS(block_free, PID_BLOCK_FREE, 1)) { 1089 if (PIDFF_FIND_FIELDS(block_free, PID_BLOCK_FREE, 1)) {
1095 printk(KERN_ERR 1090 hid_err(pidff->hid, "unknown pid_block_free report layout\n");
1096 "hid-pidff: unknown pid_block_free report layout\n");
1097 return -ENODEV; 1091 return -ENODEV;
1098 } 1092 }
1099 1093
@@ -1105,27 +1099,26 @@ static int pidff_init_fields(struct pidff_device *pidff, struct input_dev *dev)
1105 1099
1106 if (!envelope_ok) { 1100 if (!envelope_ok) {
1107 if (test_and_clear_bit(FF_CONSTANT, dev->ffbit)) 1101 if (test_and_clear_bit(FF_CONSTANT, dev->ffbit))
1108 printk(KERN_WARNING "hid-pidff: " 1102 hid_warn(pidff->hid,
1109 "has constant effect but no envelope\n"); 1103 "has constant effect but no envelope\n");
1110 if (test_and_clear_bit(FF_RAMP, dev->ffbit)) 1104 if (test_and_clear_bit(FF_RAMP, dev->ffbit))
1111 printk(KERN_WARNING "hid-pidff: " 1105 hid_warn(pidff->hid,
1112 "has ramp effect but no envelope\n"); 1106 "has ramp effect but no envelope\n");
1113 1107
1114 if (test_and_clear_bit(FF_PERIODIC, dev->ffbit)) 1108 if (test_and_clear_bit(FF_PERIODIC, dev->ffbit))
1115 printk(KERN_WARNING "hid-pidff: " 1109 hid_warn(pidff->hid,
1116 "has periodic effect but no envelope\n"); 1110 "has periodic effect but no envelope\n");
1117 } 1111 }
1118 1112
1119 if (test_bit(FF_CONSTANT, dev->ffbit) && 1113 if (test_bit(FF_CONSTANT, dev->ffbit) &&
1120 PIDFF_FIND_FIELDS(set_constant, PID_SET_CONSTANT, 1)) { 1114 PIDFF_FIND_FIELDS(set_constant, PID_SET_CONSTANT, 1)) {
1121 printk(KERN_WARNING 1115 hid_warn(pidff->hid, "unknown constant effect layout\n");
1122 "hid-pidff: unknown constant effect layout\n");
1123 clear_bit(FF_CONSTANT, dev->ffbit); 1116 clear_bit(FF_CONSTANT, dev->ffbit);
1124 } 1117 }
1125 1118
1126 if (test_bit(FF_RAMP, dev->ffbit) && 1119 if (test_bit(FF_RAMP, dev->ffbit) &&
1127 PIDFF_FIND_FIELDS(set_ramp, PID_SET_RAMP, 1)) { 1120 PIDFF_FIND_FIELDS(set_ramp, PID_SET_RAMP, 1)) {
1128 printk(KERN_WARNING "hid-pidff: unknown ramp effect layout\n"); 1121 hid_warn(pidff->hid, "unknown ramp effect layout\n");
1129 clear_bit(FF_RAMP, dev->ffbit); 1122 clear_bit(FF_RAMP, dev->ffbit);
1130 } 1123 }
1131 1124
@@ -1134,8 +1127,7 @@ static int pidff_init_fields(struct pidff_device *pidff, struct input_dev *dev)
1134 test_bit(FF_FRICTION, dev->ffbit) || 1127 test_bit(FF_FRICTION, dev->ffbit) ||
1135 test_bit(FF_INERTIA, dev->ffbit)) && 1128 test_bit(FF_INERTIA, dev->ffbit)) &&
1136 PIDFF_FIND_FIELDS(set_condition, PID_SET_CONDITION, 1)) { 1129 PIDFF_FIND_FIELDS(set_condition, PID_SET_CONDITION, 1)) {
1137 printk(KERN_WARNING 1130 hid_warn(pidff->hid, "unknown condition effect layout\n");
1138 "hid-pidff: unknown condition effect layout\n");
1139 clear_bit(FF_SPRING, dev->ffbit); 1131 clear_bit(FF_SPRING, dev->ffbit);
1140 clear_bit(FF_DAMPER, dev->ffbit); 1132 clear_bit(FF_DAMPER, dev->ffbit);
1141 clear_bit(FF_FRICTION, dev->ffbit); 1133 clear_bit(FF_FRICTION, dev->ffbit);
@@ -1144,8 +1136,7 @@ static int pidff_init_fields(struct pidff_device *pidff, struct input_dev *dev)
1144 1136
1145 if (test_bit(FF_PERIODIC, dev->ffbit) && 1137 if (test_bit(FF_PERIODIC, dev->ffbit) &&
1146 PIDFF_FIND_FIELDS(set_periodic, PID_SET_PERIODIC, 1)) { 1138 PIDFF_FIND_FIELDS(set_periodic, PID_SET_PERIODIC, 1)) {
1147 printk(KERN_WARNING 1139 hid_warn(pidff->hid, "unknown periodic effect layout\n");
1148 "hid-pidff: unknown periodic effect layout\n");
1149 clear_bit(FF_PERIODIC, dev->ffbit); 1140 clear_bit(FF_PERIODIC, dev->ffbit);
1150 } 1141 }
1151 1142
@@ -1184,12 +1175,12 @@ static void pidff_reset(struct pidff_device *pidff)
1184 if (pidff->pool[PID_SIMULTANEOUS_MAX].value) { 1175 if (pidff->pool[PID_SIMULTANEOUS_MAX].value) {
1185 while (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] < 2) { 1176 while (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] < 2) {
1186 if (i++ > 20) { 1177 if (i++ > 20) {
1187 printk(KERN_WARNING "hid-pidff: device reports " 1178 hid_warn(pidff->hid,
1188 "%d simultaneous effects\n", 1179 "device reports %d simultaneous effects\n",
1189 pidff->pool[PID_SIMULTANEOUS_MAX].value[0]); 1180 pidff->pool[PID_SIMULTANEOUS_MAX].value[0]);
1190 break; 1181 break;
1191 } 1182 }
1192 debug("pid_pool requested again"); 1183 hid_dbg(pidff->hid, "pid_pool requested again\n");
1193 usbhid_submit_report(hid, pidff->reports[PID_POOL], 1184 usbhid_submit_report(hid, pidff->reports[PID_POOL],
1194 USB_DIR_IN); 1185 USB_DIR_IN);
1195 usbhid_wait_io(hid); 1186 usbhid_wait_io(hid);
@@ -1215,7 +1206,7 @@ static int pidff_check_autocenter(struct pidff_device *pidff,
1215 1206
1216 error = pidff_request_effect_upload(pidff, 1); 1207 error = pidff_request_effect_upload(pidff, 1);
1217 if (error) { 1208 if (error) {
1218 printk(KERN_ERR "hid-pidff: upload request failed\n"); 1209 hid_err(pidff->hid, "upload request failed\n");
1219 return error; 1210 return error;
1220 } 1211 }
1221 1212
@@ -1224,8 +1215,8 @@ static int pidff_check_autocenter(struct pidff_device *pidff,
1224 pidff_autocenter(pidff, 0xffff); 1215 pidff_autocenter(pidff, 0xffff);
1225 set_bit(FF_AUTOCENTER, dev->ffbit); 1216 set_bit(FF_AUTOCENTER, dev->ffbit);
1226 } else { 1217 } else {
1227 printk(KERN_NOTICE "hid-pidff: " 1218 hid_notice(pidff->hid,
1228 "device has unknown autocenter control method\n"); 1219 "device has unknown autocenter control method\n");
1229 } 1220 }
1230 1221
1231 pidff_erase_pid(pidff, 1222 pidff_erase_pid(pidff,
@@ -1248,10 +1239,10 @@ int hid_pidff_init(struct hid_device *hid)
1248 int max_effects; 1239 int max_effects;
1249 int error; 1240 int error;
1250 1241
1251 debug("starting pid init"); 1242 hid_dbg(hid, "starting pid init\n");
1252 1243
1253 if (list_empty(&hid->report_enum[HID_OUTPUT_REPORT].report_list)) { 1244 if (list_empty(&hid->report_enum[HID_OUTPUT_REPORT].report_list)) {
1254 debug("not a PID device, no output report"); 1245 hid_dbg(hid, "not a PID device, no output report\n");
1255 return -ENODEV; 1246 return -ENODEV;
1256 } 1247 }
1257 1248
@@ -1265,7 +1256,7 @@ int hid_pidff_init(struct hid_device *hid)
1265 pidff_find_reports(hid, HID_FEATURE_REPORT, pidff); 1256 pidff_find_reports(hid, HID_FEATURE_REPORT, pidff);
1266 1257
1267 if (!pidff_reports_ok(pidff)) { 1258 if (!pidff_reports_ok(pidff)) {
1268 debug("reports not ok, aborting"); 1259 hid_dbg(hid, "reports not ok, aborting\n");
1269 error = -ENODEV; 1260 error = -ENODEV;
1270 goto fail; 1261 goto fail;
1271 } 1262 }
@@ -1278,8 +1269,8 @@ int hid_pidff_init(struct hid_device *hid)
1278 1269
1279 if (test_bit(FF_GAIN, dev->ffbit)) { 1270 if (test_bit(FF_GAIN, dev->ffbit)) {
1280 pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], 0xffff); 1271 pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], 0xffff);
1281 usbhid_submit_report(pidff->hid, pidff->reports[PID_DEVICE_GAIN], 1272 usbhid_submit_report(hid, pidff->reports[PID_DEVICE_GAIN],
1282 USB_DIR_OUT); 1273 USB_DIR_OUT);
1283 } 1274 }
1284 1275
1285 error = pidff_check_autocenter(pidff, dev); 1276 error = pidff_check_autocenter(pidff, dev);
@@ -1290,23 +1281,23 @@ int hid_pidff_init(struct hid_device *hid)
1290 pidff->block_load[PID_EFFECT_BLOCK_INDEX].field->logical_maximum - 1281 pidff->block_load[PID_EFFECT_BLOCK_INDEX].field->logical_maximum -
1291 pidff->block_load[PID_EFFECT_BLOCK_INDEX].field->logical_minimum + 1282 pidff->block_load[PID_EFFECT_BLOCK_INDEX].field->logical_minimum +
1292 1; 1283 1;
1293 debug("max effects is %d", max_effects); 1284 hid_dbg(hid, "max effects is %d\n", max_effects);
1294 1285
1295 if (max_effects > PID_EFFECTS_MAX) 1286 if (max_effects > PID_EFFECTS_MAX)
1296 max_effects = PID_EFFECTS_MAX; 1287 max_effects = PID_EFFECTS_MAX;
1297 1288
1298 if (pidff->pool[PID_SIMULTANEOUS_MAX].value) 1289 if (pidff->pool[PID_SIMULTANEOUS_MAX].value)
1299 debug("max simultaneous effects is %d", 1290 hid_dbg(hid, "max simultaneous effects is %d\n",
1300 pidff->pool[PID_SIMULTANEOUS_MAX].value[0]); 1291 pidff->pool[PID_SIMULTANEOUS_MAX].value[0]);
1301 1292
1302 if (pidff->pool[PID_RAM_POOL_SIZE].value) 1293 if (pidff->pool[PID_RAM_POOL_SIZE].value)
1303 debug("device memory size is %d bytes", 1294 hid_dbg(hid, "device memory size is %d bytes\n",
1304 pidff->pool[PID_RAM_POOL_SIZE].value[0]); 1295 pidff->pool[PID_RAM_POOL_SIZE].value[0]);
1305 1296
1306 if (pidff->pool[PID_DEVICE_MANAGED_POOL].value && 1297 if (pidff->pool[PID_DEVICE_MANAGED_POOL].value &&
1307 pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) { 1298 pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) {
1308 printk(KERN_NOTICE "hid-pidff: " 1299 hid_notice(hid,
1309 "device does not support device managed pool\n"); 1300 "device does not support device managed pool\n");
1310 goto fail; 1301 goto fail;
1311 } 1302 }
1312 1303
@@ -1322,8 +1313,7 @@ int hid_pidff_init(struct hid_device *hid)
1322 ff->set_autocenter = pidff_set_autocenter; 1313 ff->set_autocenter = pidff_set_autocenter;
1323 ff->playback = pidff_playback; 1314 ff->playback = pidff_playback;
1324 1315
1325 printk(KERN_INFO "Force feedback for USB HID PID devices by " 1316 hid_info(dev, "Force feedback for USB HID PID devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
1326 "Anssi Hannula <anssi.hannula@gmail.com>\n");
1327 1317
1328 return 0; 1318 return 0;
1329 1319
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 2c185477eeb3..76b9a149c7df 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -85,7 +85,7 @@ static const struct hid_blacklist {
85 { USB_VENDOR_ID_PI_ENGINEERING, USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL, HID_QUIRK_HIDINPUT_FORCE }, 85 { USB_VENDOR_ID_PI_ENGINEERING, USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL, HID_QUIRK_HIDINPUT_FORCE },
86 86
87 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH, HID_QUIRK_MULTI_INPUT }, 87 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH, HID_QUIRK_MULTI_INPUT },
88 88 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT },
89 { 0, 0 } 89 { 0, 0 }
90}; 90};
91 91
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 984feb351a5a..af0a7c1002af 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -585,163 +585,168 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
585{ 585{
586 struct hiddev_list *list = file->private_data; 586 struct hiddev_list *list = file->private_data;
587 struct hiddev *hiddev = list->hiddev; 587 struct hiddev *hiddev = list->hiddev;
588 struct hid_device *hid = hiddev->hid; 588 struct hid_device *hid;
589 struct usb_device *dev;
590 struct hiddev_collection_info cinfo; 589 struct hiddev_collection_info cinfo;
591 struct hiddev_report_info rinfo; 590 struct hiddev_report_info rinfo;
592 struct hiddev_field_info finfo; 591 struct hiddev_field_info finfo;
593 struct hiddev_devinfo dinfo; 592 struct hiddev_devinfo dinfo;
594 struct hid_report *report; 593 struct hid_report *report;
595 struct hid_field *field; 594 struct hid_field *field;
596 struct usbhid_device *usbhid = hid->driver_data;
597 void __user *user_arg = (void __user *)arg; 595 void __user *user_arg = (void __user *)arg;
598 int i, r; 596 int i, r = -EINVAL;
599 597
600 /* Called without BKL by compat methods so no BKL taken */ 598 /* Called without BKL by compat methods so no BKL taken */
601 599
602 /* FIXME: Who or what stop this racing with a disconnect ?? */ 600 mutex_lock(&hiddev->existancelock);
603 if (!hiddev->exist || !hid) 601 if (!hiddev->exist) {
604 return -EIO; 602 r = -ENODEV;
603 goto ret_unlock;
604 }
605 605
606 dev = hid_to_usb_dev(hid); 606 hid = hiddev->hid;
607 607
608 switch (cmd) { 608 switch (cmd) {
609 609
610 case HIDIOCGVERSION: 610 case HIDIOCGVERSION:
611 return put_user(HID_VERSION, (int __user *)arg); 611 r = put_user(HID_VERSION, (int __user *)arg) ?
612 -EFAULT : 0;
613 break;
612 614
613 case HIDIOCAPPLICATION: 615 case HIDIOCAPPLICATION:
614 if (arg < 0 || arg >= hid->maxapplication) 616 if (arg < 0 || arg >= hid->maxapplication)
615 return -EINVAL; 617 break;
616 618
617 for (i = 0; i < hid->maxcollection; i++) 619 for (i = 0; i < hid->maxcollection; i++)
618 if (hid->collection[i].type == 620 if (hid->collection[i].type ==
619 HID_COLLECTION_APPLICATION && arg-- == 0) 621 HID_COLLECTION_APPLICATION && arg-- == 0)
620 break; 622 break;
621 623
622 if (i == hid->maxcollection) 624 if (i < hid->maxcollection)
623 return -EINVAL; 625 r = hid->collection[i].usage;
624 626 break;
625 return hid->collection[i].usage;
626 627
627 case HIDIOCGDEVINFO: 628 case HIDIOCGDEVINFO:
628 dinfo.bustype = BUS_USB; 629 {
629 dinfo.busnum = dev->bus->busnum; 630 struct usb_device *dev = hid_to_usb_dev(hid);
630 dinfo.devnum = dev->devnum; 631 struct usbhid_device *usbhid = hid->driver_data;
631 dinfo.ifnum = usbhid->ifnum; 632
632 dinfo.vendor = le16_to_cpu(dev->descriptor.idVendor); 633 dinfo.bustype = BUS_USB;
633 dinfo.product = le16_to_cpu(dev->descriptor.idProduct); 634 dinfo.busnum = dev->bus->busnum;
634 dinfo.version = le16_to_cpu(dev->descriptor.bcdDevice); 635 dinfo.devnum = dev->devnum;
635 dinfo.num_applications = hid->maxapplication; 636 dinfo.ifnum = usbhid->ifnum;
636 if (copy_to_user(user_arg, &dinfo, sizeof(dinfo))) 637 dinfo.vendor = le16_to_cpu(dev->descriptor.idVendor);
637 return -EFAULT; 638 dinfo.product = le16_to_cpu(dev->descriptor.idProduct);
638 639 dinfo.version = le16_to_cpu(dev->descriptor.bcdDevice);
639 return 0; 640 dinfo.num_applications = hid->maxapplication;
641
642 r = copy_to_user(user_arg, &dinfo, sizeof(dinfo)) ?
643 -EFAULT : 0;
644 break;
645 }
640 646
641 case HIDIOCGFLAG: 647 case HIDIOCGFLAG:
642 if (put_user(list->flags, (int __user *)arg)) 648 r = put_user(list->flags, (int __user *)arg) ?
643 return -EFAULT; 649 -EFAULT : 0;
644 650 break;
645 return 0;
646 651
647 case HIDIOCSFLAG: 652 case HIDIOCSFLAG:
648 { 653 {
649 int newflags; 654 int newflags;
650 if (get_user(newflags, (int __user *)arg)) 655
651 return -EFAULT; 656 if (get_user(newflags, (int __user *)arg)) {
657 r = -EFAULT;
658 break;
659 }
652 660
653 if ((newflags & ~HIDDEV_FLAGS) != 0 || 661 if ((newflags & ~HIDDEV_FLAGS) != 0 ||
654 ((newflags & HIDDEV_FLAG_REPORT) != 0 && 662 ((newflags & HIDDEV_FLAG_REPORT) != 0 &&
655 (newflags & HIDDEV_FLAG_UREF) == 0)) 663 (newflags & HIDDEV_FLAG_UREF) == 0))
656 return -EINVAL; 664 break;
657 665
658 list->flags = newflags; 666 list->flags = newflags;
659 667
660 return 0; 668 r = 0;
669 break;
661 } 670 }
662 671
663 case HIDIOCGSTRING: 672 case HIDIOCGSTRING:
664 mutex_lock(&hiddev->existancelock); 673 r = hiddev_ioctl_string(hiddev, cmd, user_arg);
665 if (hiddev->exist) 674 break;
666 r = hiddev_ioctl_string(hiddev, cmd, user_arg);
667 else
668 r = -ENODEV;
669 mutex_unlock(&hiddev->existancelock);
670 return r;
671 675
672 case HIDIOCINITREPORT: 676 case HIDIOCINITREPORT:
673 mutex_lock(&hiddev->existancelock);
674 if (!hiddev->exist) {
675 mutex_unlock(&hiddev->existancelock);
676 return -ENODEV;
677 }
678 usbhid_init_reports(hid); 677 usbhid_init_reports(hid);
679 mutex_unlock(&hiddev->existancelock); 678 r = 0;
680 679 break;
681 return 0;
682 680
683 case HIDIOCGREPORT: 681 case HIDIOCGREPORT:
684 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) 682 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) {
685 return -EFAULT; 683 r = -EFAULT;
684 break;
685 }
686 686
687 if (rinfo.report_type == HID_REPORT_TYPE_OUTPUT) 687 if (rinfo.report_type == HID_REPORT_TYPE_OUTPUT)
688 return -EINVAL; 688 break;
689 689
690 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) 690 report = hiddev_lookup_report(hid, &rinfo);
691 return -EINVAL; 691 if (report == NULL)
692 break;
692 693
693 mutex_lock(&hiddev->existancelock); 694 usbhid_submit_report(hid, report, USB_DIR_IN);
694 if (hiddev->exist) { 695 usbhid_wait_io(hid);
695 usbhid_submit_report(hid, report, USB_DIR_IN);
696 usbhid_wait_io(hid);
697 }
698 mutex_unlock(&hiddev->existancelock);
699 696
700 return 0; 697 r = 0;
698 break;
701 699
702 case HIDIOCSREPORT: 700 case HIDIOCSREPORT:
703 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) 701 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) {
704 return -EFAULT; 702 r = -EFAULT;
703 break;
704 }
705 705
706 if (rinfo.report_type == HID_REPORT_TYPE_INPUT) 706 if (rinfo.report_type == HID_REPORT_TYPE_INPUT)
707 return -EINVAL; 707 break;
708 708
709 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) 709 report = hiddev_lookup_report(hid, &rinfo);
710 return -EINVAL; 710 if (report == NULL)
711 break;
711 712
712 mutex_lock(&hiddev->existancelock); 713 usbhid_submit_report(hid, report, USB_DIR_OUT);
713 if (hiddev->exist) { 714 usbhid_wait_io(hid);
714 usbhid_submit_report(hid, report, USB_DIR_OUT);
715 usbhid_wait_io(hid);
716 }
717 mutex_unlock(&hiddev->existancelock);
718 715
719 return 0; 716 r = 0;
717 break;
720 718
721 case HIDIOCGREPORTINFO: 719 case HIDIOCGREPORTINFO:
722 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) 720 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) {
723 return -EFAULT; 721 r = -EFAULT;
722 break;
723 }
724 724
725 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) 725 report = hiddev_lookup_report(hid, &rinfo);
726 return -EINVAL; 726 if (report == NULL)
727 break;
727 728
728 rinfo.num_fields = report->maxfield; 729 rinfo.num_fields = report->maxfield;
729 730
730 if (copy_to_user(user_arg, &rinfo, sizeof(rinfo))) 731 r = copy_to_user(user_arg, &rinfo, sizeof(rinfo)) ?
731 return -EFAULT; 732 -EFAULT : 0;
732 733 break;
733 return 0;
734 734
735 case HIDIOCGFIELDINFO: 735 case HIDIOCGFIELDINFO:
736 if (copy_from_user(&finfo, user_arg, sizeof(finfo))) 736 if (copy_from_user(&finfo, user_arg, sizeof(finfo))) {
737 return -EFAULT; 737 r = -EFAULT;
738 break;
739 }
740
738 rinfo.report_type = finfo.report_type; 741 rinfo.report_type = finfo.report_type;
739 rinfo.report_id = finfo.report_id; 742 rinfo.report_id = finfo.report_id;
740 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) 743
741 return -EINVAL; 744 report = hiddev_lookup_report(hid, &rinfo);
745 if (report == NULL)
746 break;
742 747
743 if (finfo.field_index >= report->maxfield) 748 if (finfo.field_index >= report->maxfield)
744 return -EINVAL; 749 break;
745 750
746 field = report->field[finfo.field_index]; 751 field = report->field[finfo.field_index];
747 memset(&finfo, 0, sizeof(finfo)); 752 memset(&finfo, 0, sizeof(finfo));
@@ -760,10 +765,9 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
760 finfo.unit_exponent = field->unit_exponent; 765 finfo.unit_exponent = field->unit_exponent;
761 finfo.unit = field->unit; 766 finfo.unit = field->unit;
762 767
763 if (copy_to_user(user_arg, &finfo, sizeof(finfo))) 768 r = copy_to_user(user_arg, &finfo, sizeof(finfo)) ?
764 return -EFAULT; 769 -EFAULT : 0;
765 770 break;
766 return 0;
767 771
768 case HIDIOCGUCODE: 772 case HIDIOCGUCODE:
769 /* fall through */ 773 /* fall through */
@@ -772,57 +776,66 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
772 case HIDIOCGUSAGES: 776 case HIDIOCGUSAGES:
773 case HIDIOCSUSAGES: 777 case HIDIOCSUSAGES:
774 case HIDIOCGCOLLECTIONINDEX: 778 case HIDIOCGCOLLECTIONINDEX:
775 mutex_lock(&hiddev->existancelock); 779 r = hiddev_ioctl_usage(hiddev, cmd, user_arg);
776 if (hiddev->exist) 780 break;
777 r = hiddev_ioctl_usage(hiddev, cmd, user_arg);
778 else
779 r = -ENODEV;
780 mutex_unlock(&hiddev->existancelock);
781 return r;
782 781
783 case HIDIOCGCOLLECTIONINFO: 782 case HIDIOCGCOLLECTIONINFO:
784 if (copy_from_user(&cinfo, user_arg, sizeof(cinfo))) 783 if (copy_from_user(&cinfo, user_arg, sizeof(cinfo))) {
785 return -EFAULT; 784 r = -EFAULT;
785 break;
786 }
786 787
787 if (cinfo.index >= hid->maxcollection) 788 if (cinfo.index >= hid->maxcollection)
788 return -EINVAL; 789 break;
789 790
790 cinfo.type = hid->collection[cinfo.index].type; 791 cinfo.type = hid->collection[cinfo.index].type;
791 cinfo.usage = hid->collection[cinfo.index].usage; 792 cinfo.usage = hid->collection[cinfo.index].usage;
792 cinfo.level = hid->collection[cinfo.index].level; 793 cinfo.level = hid->collection[cinfo.index].level;
793 794
794 if (copy_to_user(user_arg, &cinfo, sizeof(cinfo))) 795 r = copy_to_user(user_arg, &cinfo, sizeof(cinfo)) ?
795 return -EFAULT; 796 -EFAULT : 0;
796 return 0; 797 break;
797 798
798 default: 799 default:
799
800 if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) 800 if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ)
801 return -EINVAL; 801 break;
802 802
803 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGNAME(0))) { 803 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGNAME(0))) {
804 int len; 804 int len;
805 if (!hid->name) 805
806 return 0; 806 if (!hid->name) {
807 r = 0;
808 break;
809 }
810
807 len = strlen(hid->name) + 1; 811 len = strlen(hid->name) + 1;
808 if (len > _IOC_SIZE(cmd)) 812 if (len > _IOC_SIZE(cmd))
809 len = _IOC_SIZE(cmd); 813 len = _IOC_SIZE(cmd);
810 return copy_to_user(user_arg, hid->name, len) ? 814 r = copy_to_user(user_arg, hid->name, len) ?
811 -EFAULT : len; 815 -EFAULT : len;
816 break;
812 } 817 }
813 818
814 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGPHYS(0))) { 819 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGPHYS(0))) {
815 int len; 820 int len;
816 if (!hid->phys) 821
817 return 0; 822 if (!hid->phys) {
823 r = 0;
824 break;
825 }
826
818 len = strlen(hid->phys) + 1; 827 len = strlen(hid->phys) + 1;
819 if (len > _IOC_SIZE(cmd)) 828 if (len > _IOC_SIZE(cmd))
820 len = _IOC_SIZE(cmd); 829 len = _IOC_SIZE(cmd);
821 return copy_to_user(user_arg, hid->phys, len) ? 830 r = copy_to_user(user_arg, hid->phys, len) ?
822 -EFAULT : len; 831 -EFAULT : len;
832 break;
823 } 833 }
824 } 834 }
825 return -EINVAL; 835
836ret_unlock:
837 mutex_unlock(&hiddev->existancelock);
838 return r;
826} 839}
827 840
828#ifdef CONFIG_COMPAT 841#ifdef CONFIG_COMPAT
@@ -892,7 +905,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
892 hiddev->exist = 1; 905 hiddev->exist = 1;
893 retval = usb_register_dev(usbhid->intf, &hiddev_class); 906 retval = usb_register_dev(usbhid->intf, &hiddev_class);
894 if (retval) { 907 if (retval) {
895 err_hid("Not able to get a minor for this device."); 908 hid_err(hid, "Not able to get a minor for this device\n");
896 hid->hiddev = NULL; 909 hid->hiddev = NULL;
897 kfree(hiddev); 910 kfree(hiddev);
898 return -1; 911 return -1;
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
index a948605564fb..065817329f03 100644
--- a/drivers/hid/usbhid/usbkbd.c
+++ b/drivers/hid/usbhid/usbkbd.c
@@ -24,6 +24,8 @@
24 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic 24 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
25 */ 25 */
26 26
27#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
28
27#include <linux/kernel.h> 29#include <linux/kernel.h>
28#include <linux/slab.h> 30#include <linux/slab.h>
29#include <linux/module.h> 31#include <linux/module.h>
@@ -104,16 +106,18 @@ static void usb_kbd_irq(struct urb *urb)
104 if (usb_kbd_keycode[kbd->old[i]]) 106 if (usb_kbd_keycode[kbd->old[i]])
105 input_report_key(kbd->dev, usb_kbd_keycode[kbd->old[i]], 0); 107 input_report_key(kbd->dev, usb_kbd_keycode[kbd->old[i]], 0);
106 else 108 else
107 dev_info(&urb->dev->dev, 109 hid_info(urb->dev,
108 "Unknown key (scancode %#x) released.\n", kbd->old[i]); 110 "Unknown key (scancode %#x) released.\n",
111 kbd->old[i]);
109 } 112 }
110 113
111 if (kbd->new[i] > 3 && memscan(kbd->old + 2, kbd->new[i], 6) == kbd->old + 8) { 114 if (kbd->new[i] > 3 && memscan(kbd->old + 2, kbd->new[i], 6) == kbd->old + 8) {
112 if (usb_kbd_keycode[kbd->new[i]]) 115 if (usb_kbd_keycode[kbd->new[i]])
113 input_report_key(kbd->dev, usb_kbd_keycode[kbd->new[i]], 1); 116 input_report_key(kbd->dev, usb_kbd_keycode[kbd->new[i]], 1);
114 else 117 else
115 dev_info(&urb->dev->dev, 118 hid_info(urb->dev,
116 "Unknown key (scancode %#x) released.\n", kbd->new[i]); 119 "Unknown key (scancode %#x) released.\n",
120 kbd->new[i]);
117 } 121 }
118 } 122 }
119 123
@@ -124,9 +128,9 @@ static void usb_kbd_irq(struct urb *urb)
124resubmit: 128resubmit:
125 i = usb_submit_urb (urb, GFP_ATOMIC); 129 i = usb_submit_urb (urb, GFP_ATOMIC);
126 if (i) 130 if (i)
127 err_hid ("can't resubmit intr, %s-%s/input0, status %d", 131 hid_err(urb->dev, "can't resubmit intr, %s-%s/input0, status %d",
128 kbd->usbdev->bus->bus_name, 132 kbd->usbdev->bus->bus_name,
129 kbd->usbdev->devpath, i); 133 kbd->usbdev->devpath, i);
130} 134}
131 135
132static int usb_kbd_event(struct input_dev *dev, unsigned int type, 136static int usb_kbd_event(struct input_dev *dev, unsigned int type,
@@ -150,7 +154,7 @@ static int usb_kbd_event(struct input_dev *dev, unsigned int type,
150 *(kbd->leds) = kbd->newleds; 154 *(kbd->leds) = kbd->newleds;
151 kbd->led->dev = kbd->usbdev; 155 kbd->led->dev = kbd->usbdev;
152 if (usb_submit_urb(kbd->led, GFP_ATOMIC)) 156 if (usb_submit_urb(kbd->led, GFP_ATOMIC))
153 err_hid("usb_submit_urb(leds) failed"); 157 pr_err("usb_submit_urb(leds) failed\n");
154 158
155 return 0; 159 return 0;
156} 160}
@@ -160,7 +164,7 @@ static void usb_kbd_led(struct urb *urb)
160 struct usb_kbd *kbd = urb->context; 164 struct usb_kbd *kbd = urb->context;
161 165
162 if (urb->status) 166 if (urb->status)
163 dev_warn(&urb->dev->dev, "led urb status %d received\n", 167 hid_warn(urb->dev, "led urb status %d received\n",
164 urb->status); 168 urb->status);
165 169
166 if (*(kbd->leds) == kbd->newleds) 170 if (*(kbd->leds) == kbd->newleds)
@@ -169,7 +173,7 @@ static void usb_kbd_led(struct urb *urb)
169 *(kbd->leds) = kbd->newleds; 173 *(kbd->leds) = kbd->newleds;
170 kbd->led->dev = kbd->usbdev; 174 kbd->led->dev = kbd->usbdev;
171 if (usb_submit_urb(kbd->led, GFP_ATOMIC)) 175 if (usb_submit_urb(kbd->led, GFP_ATOMIC))
172 err_hid("usb_submit_urb(leds) failed"); 176 hid_err(urb->dev, "usb_submit_urb(leds) failed\n");
173} 177}
174 178
175static int usb_kbd_open(struct input_dev *dev) 179static int usb_kbd_open(struct input_dev *dev)