Skip to content

Commit

Permalink
USB: remove err() macro from usb class 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
gregkh committed Oct 17, 2008
1 parent 194343d commit 9908a32
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 30 deletions.
23 changes: 14 additions & 9 deletions drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ static void acm_ctrl_irq(struct urb *urb)
usb_mark_last_busy(acm->dev);
retval = usb_submit_urb (urb, GFP_ATOMIC);
if (retval)
err ("%s - usb_submit_urb failed with result %d",
__func__, retval);
dev_err(&urb->dev->dev, "%s - usb_submit_urb failed with "
"result %d", __func__, retval);
}

/* data interface returns incoming bytes, or we got unthrottled */
Expand Down Expand Up @@ -514,7 +514,7 @@ static void acm_waker(struct work_struct *waker)

rv = usb_autopm_get_interface(acm->control);
if (rv < 0) {
err("Autopm failure in %s", __func__);
dev_err(&acm->dev->dev, "Autopm failure in %s\n", __func__);
return;
}
if (acm->delayed_wb) {
Expand Down Expand Up @@ -924,7 +924,7 @@ static int acm_probe (struct usb_interface *intf,

/* normal probing*/
if (!buffer) {
err("Weird descriptor references\n");
dev_err(&intf->dev, "Weird descriptor references\n");
return -EINVAL;
}

Expand All @@ -934,21 +934,24 @@ static int acm_probe (struct usb_interface *intf,
buflen = intf->cur_altsetting->endpoint->extralen;
buffer = intf->cur_altsetting->endpoint->extra;
} else {
err("Zero length descriptor references\n");
dev_err(&intf->dev,
"Zero length descriptor references\n");
return -EINVAL;
}
}

while (buflen > 0) {
if (buffer [1] != USB_DT_CS_INTERFACE) {
err("skipping garbage\n");
dev_err(&intf->dev, "skipping garbage\n");
goto next_desc;
}

switch (buffer [2]) {
case USB_CDC_UNION_TYPE: /* we've found it */
if (union_header) {
err("More than one union descriptor, skipping ...");
dev_err(&intf->dev, "More than one "
"union descriptor, "
"skipping ...\n");
goto next_desc;
}
union_header = (struct usb_cdc_union_desc *)
Expand All @@ -966,7 +969,9 @@ static int acm_probe (struct usb_interface *intf,
call_management_function = buffer[3];
call_interface_num = buffer[4];
if ((call_management_function & 3) != 3)
err("This device cannot do calls on its own. It is no modem.");
dev_err(&intf->dev, "This device "
"cannot do calls on its own. "
"It is no modem.\n");
break;
default:
/* there are LOTS more CDC descriptors that
Expand Down Expand Up @@ -1051,7 +1056,7 @@ static int acm_probe (struct usb_interface *intf,
for (minor = 0; minor < ACM_TTY_MINORS && acm_table[minor]; minor++);

if (minor == ACM_TTY_MINORS) {
err("no more free acm devices");
dev_err(&intf->dev, "no more free acm devices\n");
return -ENODEV;
}

Expand Down
48 changes: 30 additions & 18 deletions drivers/usb/class/cdc-wdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,12 @@ static void wdm_in_callback(struct urb *urb)
"nonzero urb status received: -ESHUTDOWN");
break;
case -EPIPE:
err("nonzero urb status received: -EPIPE");
dev_err(&desc->intf->dev,
"nonzero urb status received: -EPIPE\n");
break;
default:
err("Unexpected error %d", status);
dev_err(&desc->intf->dev,
"Unexpected error %d\n", status);
break;
}
}
Expand Down Expand Up @@ -170,16 +172,18 @@ static void wdm_int_callback(struct urb *urb)
return; /* unplug */
case -EPIPE:
set_bit(WDM_INT_STALL, &desc->flags);
err("Stall on int endpoint");
dev_err(&desc->intf->dev, "Stall on int endpoint\n");
goto sw; /* halt is cleared in work */
default:
err("nonzero urb status received: %d", status);
dev_err(&desc->intf->dev,
"nonzero urb status received: %d\n", status);
break;
}
}

if (urb->actual_length < sizeof(struct usb_cdc_notification)) {
err("wdm_int_callback - %d bytes", urb->actual_length);
dev_err(&desc->intf->dev, "wdm_int_callback - %d bytes\n",
urb->actual_length);
goto exit;
}

Expand All @@ -198,7 +202,8 @@ static void wdm_int_callback(struct urb *urb)
goto exit;
default:
clear_bit(WDM_POLL_RUNNING, &desc->flags);
err("unknown notification %d received: index %d len %d",
dev_err(&desc->intf->dev,
"unknown notification %d received: index %d len %d\n",
dr->bNotificationType, dr->wIndex, dr->wLength);
goto exit;
}
Expand Down Expand Up @@ -236,14 +241,16 @@ static void wdm_int_callback(struct urb *urb)
sw:
rv = schedule_work(&desc->rxwork);
if (rv)
err("Cannot schedule work");
dev_err(&desc->intf->dev,
"Cannot schedule work\n");
}
}
exit:
rv = usb_submit_urb(urb, GFP_ATOMIC);
if (rv)
err("%s - usb_submit_urb failed with result %d",
__func__, rv);
dev_err(&desc->intf->dev,
"%s - usb_submit_urb failed with result %d\n",
__func__, rv);

}

Expand Down Expand Up @@ -353,7 +360,7 @@ static ssize_t wdm_write
if (rv < 0) {
kfree(buf);
clear_bit(WDM_IN_USE, &desc->flags);
err("Tx URB error: %d", rv);
dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv);
} else {
dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d",
req->wIndex);
Expand Down Expand Up @@ -401,7 +408,8 @@ static ssize_t wdm_read
int t = desc->rerr;
desc->rerr = 0;
spin_unlock_irq(&desc->iuspin);
err("reading had resulted in %d", t);
dev_err(&desc->intf->dev,
"reading had resulted in %d\n", t);
rv = -EIO;
goto err;
}
Expand Down Expand Up @@ -440,7 +448,7 @@ static ssize_t wdm_read
err:
mutex_unlock(&desc->rlock);
if (rv < 0)
err("wdm_read: exit error");
dev_err(&desc->intf->dev, "wdm_read: exit error\n");
return rv;
}

Expand All @@ -450,7 +458,8 @@ static int wdm_flush(struct file *file, fl_owner_t id)

wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags));
if (desc->werr < 0)
err("Error in flush path: %d", desc->werr);
dev_err(&desc->intf->dev, "Error in flush path: %d\n",
desc->werr);

return desc->werr;
}
Expand Down Expand Up @@ -502,7 +511,7 @@ static int wdm_open(struct inode *inode, struct file *file)

rv = usb_autopm_get_interface(desc->intf);
if (rv < 0) {
err("Error autopm - %d", rv);
dev_err(&desc->intf->dev, "Error autopm - %d\n", rv);
goto out;
}
intf->needs_remote_wakeup = 1;
Expand All @@ -512,7 +521,8 @@ static int wdm_open(struct inode *inode, struct file *file)
rv = usb_submit_urb(desc->validity, GFP_KERNEL);
if (rv < 0) {
desc->count--;
err("Error submitting int urb - %d", rv);
dev_err(&desc->intf->dev,
"Error submitting int urb - %d\n", rv);
}
} else {
rv = 0;
Expand Down Expand Up @@ -600,7 +610,7 @@ static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)

while (buflen > 0) {
if (buffer [1] != USB_DT_CS_INTERFACE) {
err("skipping garbage");
dev_err(&intf->dev, "skipping garbage\n");
goto next_desc;
}

Expand All @@ -614,7 +624,8 @@ static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
"Finding maximum buffer length: %d", maxcom);
break;
default:
err("Ignoring extra header, type %d, length %d",
dev_err(&intf->dev,
"Ignoring extra header, type %d, length %d\n",
buffer[2], buffer[0]);
break;
}
Expand Down Expand Up @@ -772,7 +783,8 @@ static int recover_from_urb_loss(struct wdm_device *desc)
if (desc->count) {
rv = usb_submit_urb(desc->validity, GFP_NOIO);
if (rv < 0)
err("Error resume submitting int urb - %d", rv);
dev_err(&desc->intf->dev,
"Error resume submitting int urb - %d\n", rv);
}
return rv;
}
Expand Down
7 changes: 4 additions & 3 deletions drivers/usb/class/usblp.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,9 @@ static long usblp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
err = usblp_hp_channel_change_request(usblp,
arg, &newChannel);
if (err < 0) {
err("usblp%d: error = %d setting "
"HP channel",
dev_err(&usblp->dev->dev,
"usblp%d: error = %d setting "
"HP channel\n",
usblp->minor, err);
retval = -EIO;
goto done;
Expand Down Expand Up @@ -1345,7 +1346,7 @@ static void usblp_disconnect(struct usb_interface *intf)
usb_deregister_dev(intf, &usblp_class);

if (!usblp || !usblp->dev) {
err("bogus disconnect");
dev_err(&intf->dev, "bogus disconnect\n");
BUG ();
}

Expand Down

0 comments on commit 9908a32

Please sign in to comment.