Skip to content

Commit

Permalink
USB: remove err() macro from usb misc drivers
Browse files Browse the repository at this point in the history
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 <gregkh@suse.de>
  • Loading branch information
Greg Kroah-Hartman committed Oct 17, 2008
1 parent 69a8594 commit fd3f191
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 29 deletions.
17 changes: 10 additions & 7 deletions drivers/usb/misc/adutux.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ static int adu_open(struct inode *inode, struct file *file)

interface = usb_find_interface(&adu_driver, subminor);
if (!interface) {
err("%s - error, can't find device for minor %d",
__func__, subminor);
printk(KERN_ERR "adutux: %s - error, can't find device for "
"minor %d\n", __func__, subminor);
retval = -ENODEV;
goto exit_no_device;
}
Expand Down Expand Up @@ -416,7 +416,8 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
/* verify that the device wasn't unplugged */
if (dev->udev == NULL) {
retval = -ENODEV;
err("No device or device unplugged %d", retval);
printk(KERN_ERR "adutux: No device or device unplugged %d\n",
retval);
goto exit;
}

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

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

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

Expand Down
24 changes: 13 additions & 11 deletions drivers/usb/misc/appledisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ static void appledisplay_complete(struct urb *urb)
exit:
retval = usb_submit_urb(pdata->urb, GFP_ATOMIC);
if (retval) {
err("%s - usb_submit_urb failed with result %d",
dev_err(&pdata->udev->dev,
"%s - usb_submit_urb failed with result %d\n",
__func__, retval);
}
}
Expand Down Expand Up @@ -220,15 +221,15 @@ static int appledisplay_probe(struct usb_interface *iface,
}
}
if (!int_in_endpointAddr) {
err("Could not find int-in endpoint");
dev_err(&iface->dev, "Could not find int-in endpoint\n");
return -EIO;
}

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

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

/* Allocate interrupt URB */
pdata->urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pdata->urb) {
retval = -ENOMEM;
err("appledisplay: Allocating URB failed");
dev_err(&iface->dev, "Allocating URB failed\n");
goto error;
}

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

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

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

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

if (brightness < 0) {
retval = brightness;
err("appledisplay: Error while getting initial brightness: %d", retval);
dev_err(&iface->dev,
"Error while getting initial brightness: %d\n", retval);
goto error;
}

Expand Down Expand Up @@ -352,7 +354,7 @@ static int __init appledisplay_init(void)
{
wq = create_singlethread_workqueue("appledisplay");
if (!wq) {
err("Could not create work queue\n");
printk(KERN_ERR "appledisplay: Could not create work queue\n");
return -ENOMEM;
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/misc/cypress_cy7c63.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ static int __init cypress_init(void)

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

return result;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/misc/cytherm.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,9 @@ static int __init usb_cytherm_init(void)
int result;

result = usb_register(&cytherm_driver);
if (result)
{
err("usb_register failed. Error number %d", result);
if (result) {
printk(KERN_ERR KBUILD_MODNAME ": usb_register failed! "
"Error number: %d\n", result);
return result;
}

Expand Down
13 changes: 8 additions & 5 deletions drivers/usb/misc/emi26.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static int emi26_writememory (struct usb_device *dev, int address,
unsigned char *buffer = kmemdup(data, length, GFP_KERNEL);

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

buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL);
if (!buf) {
err( "%s - error loading firmware: error = %d", __func__, -ENOMEM);
dev_err(&dev->dev, "%s - error loading firmware: error = %d\n",
__func__, -ENOMEM);
err = -ENOMEM;
goto wraperr;
}
Expand All @@ -106,14 +107,16 @@ static int emi26_load_firmware (struct usb_device *dev)
&dev->dev);
if (err) {
nofw:
err( "%s - request_firmware() failed", __func__);
dev_err(&dev->dev, "%s - request_firmware() failed\n",
__func__);
goto wraperr;
}

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

Expand Down

0 comments on commit fd3f191

Please sign in to comment.