Skip to content

Commit fd3f191

Browse files
committed
USB: remove err() macro from usb misc drivers
USB should not be having it's own printk macros, so remove err() and use the system-wide standard of dev_err() wherever possible. In the few places that will not work out, use a basic printk(). Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 69a8594 commit fd3f191

File tree

5 files changed

+37
-29
lines changed

5 files changed

+37
-29
lines changed

drivers/usb/misc/adutux.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ static int adu_open(struct inode *inode, struct file *file)
283283

284284
interface = usb_find_interface(&adu_driver, subminor);
285285
if (!interface) {
286-
err("%s - error, can't find device for minor %d",
287-
__func__, subminor);
286+
printk(KERN_ERR "adutux: %s - error, can't find device for "
287+
"minor %d\n", __func__, subminor);
288288
retval = -ENODEV;
289289
goto exit_no_device;
290290
}
@@ -416,7 +416,8 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
416416
/* verify that the device wasn't unplugged */
417417
if (dev->udev == NULL) {
418418
retval = -ENODEV;
419-
err("No device or device unplugged %d", retval);
419+
printk(KERN_ERR "adutux: No device or device unplugged %d\n",
420+
retval);
420421
goto exit;
421422
}
422423

@@ -576,7 +577,8 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
576577
/* verify that the device wasn't unplugged */
577578
if (dev->udev == NULL) {
578579
retval = -ENODEV;
579-
err("No device or device unplugged %d", retval);
580+
printk(KERN_ERR "adutux: No device or device unplugged %d\n",
581+
retval);
580582
goto exit;
581583
}
582584

@@ -645,7 +647,8 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
645647
retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL);
646648
if (retval < 0) {
647649
dev->out_urb_finished = 1;
648-
err("Couldn't submit interrupt_out_urb %d", retval);
650+
dev_err(&dev->udev->dev, "Couldn't submit "
651+
"interrupt_out_urb %d\n", retval);
649652
goto exit;
650653
}
651654

@@ -890,8 +893,8 @@ static int __init adu_init(void)
890893
/* register this driver with the USB subsystem */
891894
result = usb_register(&adu_driver);
892895
if (result < 0) {
893-
err("usb_register failed for the "__FILE__" driver. "
894-
"Error number %d", result);
896+
printk(KERN_ERR "usb_register failed for the "__FILE__
897+
" driver. Error number %d\n", result);
895898
goto exit;
896899
}
897900

drivers/usb/misc/appledisplay.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ static void appledisplay_complete(struct urb *urb)
130130
exit:
131131
retval = usb_submit_urb(pdata->urb, GFP_ATOMIC);
132132
if (retval) {
133-
err("%s - usb_submit_urb failed with result %d",
133+
dev_err(&pdata->udev->dev,
134+
"%s - usb_submit_urb failed with result %d\n",
134135
__func__, retval);
135136
}
136137
}
@@ -220,15 +221,15 @@ static int appledisplay_probe(struct usb_interface *iface,
220221
}
221222
}
222223
if (!int_in_endpointAddr) {
223-
err("Could not find int-in endpoint");
224+
dev_err(&iface->dev, "Could not find int-in endpoint\n");
224225
return -EIO;
225226
}
226227

227228
/* allocate memory for our device state and initialize it */
228229
pdata = kzalloc(sizeof(struct appledisplay), GFP_KERNEL);
229230
if (!pdata) {
230231
retval = -ENOMEM;
231-
err("Out of memory");
232+
dev_err(&iface->dev, "Out of memory\n");
232233
goto error;
233234
}
234235

@@ -241,16 +242,16 @@ static int appledisplay_probe(struct usb_interface *iface,
241242
pdata->msgdata = kmalloc(ACD_MSG_BUFFER_LEN, GFP_KERNEL);
242243
if (!pdata->msgdata) {
243244
retval = -ENOMEM;
244-
err("appledisplay: Allocating buffer for control messages "
245-
"failed");
245+
dev_err(&iface->dev,
246+
"Allocating buffer for control messages failed\n");
246247
goto error;
247248
}
248249

249250
/* Allocate interrupt URB */
250251
pdata->urb = usb_alloc_urb(0, GFP_KERNEL);
251252
if (!pdata->urb) {
252253
retval = -ENOMEM;
253-
err("appledisplay: Allocating URB failed");
254+
dev_err(&iface->dev, "Allocating URB failed\n");
254255
goto error;
255256
}
256257

@@ -259,7 +260,7 @@ static int appledisplay_probe(struct usb_interface *iface,
259260
GFP_KERNEL, &pdata->urb->transfer_dma);
260261
if (!pdata->urbdata) {
261262
retval = -ENOMEM;
262-
err("appledisplay: Allocating URB buffer failed");
263+
dev_err(&iface->dev, "Allocating URB buffer failed\n");
263264
goto error;
264265
}
265266

@@ -270,7 +271,7 @@ static int appledisplay_probe(struct usb_interface *iface,
270271
pdata, 1);
271272
if (usb_submit_urb(pdata->urb, GFP_KERNEL)) {
272273
retval = -EIO;
273-
err("appledisplay: Submitting URB failed");
274+
dev_err(&iface->dev, "Submitting URB failed\n");
274275
goto error;
275276
}
276277

@@ -280,7 +281,7 @@ static int appledisplay_probe(struct usb_interface *iface,
280281
pdata->bd = backlight_device_register(bl_name, NULL, pdata,
281282
&appledisplay_bl_data);
282283
if (IS_ERR(pdata->bd)) {
283-
err("appledisplay: Backlight registration failed");
284+
dev_err(&iface->dev, "Backlight registration failed\n");
284285
goto error;
285286
}
286287

@@ -291,7 +292,8 @@ static int appledisplay_probe(struct usb_interface *iface,
291292

292293
if (brightness < 0) {
293294
retval = brightness;
294-
err("appledisplay: Error while getting initial brightness: %d", retval);
295+
dev_err(&iface->dev,
296+
"Error while getting initial brightness: %d\n", retval);
295297
goto error;
296298
}
297299

@@ -352,7 +354,7 @@ static int __init appledisplay_init(void)
352354
{
353355
wq = create_singlethread_workqueue("appledisplay");
354356
if (!wq) {
355-
err("Could not create work queue\n");
357+
printk(KERN_ERR "appledisplay: Could not create work queue\n");
356358
return -ENOMEM;
357359
}
358360

drivers/usb/misc/cypress_cy7c63.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ static int __init cypress_init(void)
278278

279279
/* register this driver with the USB subsystem */
280280
result = usb_register(&cypress_driver);
281-
if (result) {
282-
err("Function usb_register failed! Error number: %d\n", result);
283-
}
281+
if (result)
282+
printk(KERN_ERR KBUILD_MODNAME ": usb_register failed! "
283+
"Error number: %d\n", result);
284284

285285
return result;
286286
}

drivers/usb/misc/cytherm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,9 @@ static int __init usb_cytherm_init(void)
422422
int result;
423423

424424
result = usb_register(&cytherm_driver);
425-
if (result)
426-
{
427-
err("usb_register failed. Error number %d", result);
425+
if (result) {
426+
printk(KERN_ERR KBUILD_MODNAME ": usb_register failed! "
427+
"Error number: %d\n", result);
428428
return result;
429429
}
430430

drivers/usb/misc/emi26.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static int emi26_writememory (struct usb_device *dev, int address,
5050
unsigned char *buffer = kmemdup(data, length, GFP_KERNEL);
5151

5252
if (!buffer) {
53-
err("emi26: kmalloc(%d) failed.", length);
53+
dev_err(&dev->dev, "kmalloc(%d) failed.\n", length);
5454
return -ENOMEM;
5555
}
5656
/* Note: usb_control_msg returns negative value on error or length of the
@@ -68,7 +68,7 @@ static int emi26_set_reset (struct usb_device *dev, unsigned char reset_bit)
6868
/* printk(KERN_DEBUG "%s - %d", __func__, reset_bit); */
6969
response = emi26_writememory (dev, CPUCS_REG, &reset_bit, 1, 0xa0);
7070
if (response < 0) {
71-
err("emi26: set_reset (%d) failed", reset_bit);
71+
dev_err(&dev->dev, "set_reset (%d) failed\n", reset_bit);
7272
}
7373
return response;
7474
}
@@ -88,7 +88,8 @@ static int emi26_load_firmware (struct usb_device *dev)
8888

8989
buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL);
9090
if (!buf) {
91-
err( "%s - error loading firmware: error = %d", __func__, -ENOMEM);
91+
dev_err(&dev->dev, "%s - error loading firmware: error = %d\n",
92+
__func__, -ENOMEM);
9293
err = -ENOMEM;
9394
goto wraperr;
9495
}
@@ -106,14 +107,16 @@ static int emi26_load_firmware (struct usb_device *dev)
106107
&dev->dev);
107108
if (err) {
108109
nofw:
109-
err( "%s - request_firmware() failed", __func__);
110+
dev_err(&dev->dev, "%s - request_firmware() failed\n",
111+
__func__);
110112
goto wraperr;
111113
}
112114

113115
/* Assert reset (stop the CPU in the EMI) */
114116
err = emi26_set_reset(dev,1);
115117
if (err < 0) {
116-
err( "%s - error loading firmware: error = %d", __func__, err);
118+
dev_err(&dev->dev,"%s - error loading firmware: error = %d\n",
119+
__func__, err);
117120
goto wraperr;
118121
}
119122

0 commit comments

Comments
 (0)