Commit 4212cd74 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: usb-skeleton.c: remove err() usage

err() was a very old USB-specific macro that I thought had
gone away.  This patch removes it from being used in the
driver and uses dev_err() instead.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d57b1772
...@@ -93,8 +93,8 @@ static int skel_open(struct inode *inode, struct file *file) ...@@ -93,8 +93,8 @@ static int skel_open(struct inode *inode, struct file *file)
interface = usb_find_interface(&skel_driver, subminor); interface = usb_find_interface(&skel_driver, subminor);
if (!interface) { if (!interface) {
err("%s - error, can't find device for minor %d", pr_err("%s - error, can't find device for minor %d\n",
__func__, subminor); __func__, subminor);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
} }
...@@ -179,8 +179,9 @@ static void skel_read_bulk_callback(struct urb *urb) ...@@ -179,8 +179,9 @@ static void skel_read_bulk_callback(struct urb *urb)
if (!(urb->status == -ENOENT || if (!(urb->status == -ENOENT ||
urb->status == -ECONNRESET || urb->status == -ECONNRESET ||
urb->status == -ESHUTDOWN)) urb->status == -ESHUTDOWN))
err("%s - nonzero write bulk status received: %d", dev_err(&dev->interface->dev,
__func__, urb->status); "%s - nonzero write bulk status received: %d\n",
__func__, urb->status);
dev->errors = urb->status; dev->errors = urb->status;
} else { } else {
...@@ -213,7 +214,8 @@ static int skel_do_read_io(struct usb_skel *dev, size_t count) ...@@ -213,7 +214,8 @@ static int skel_do_read_io(struct usb_skel *dev, size_t count)
/* do it */ /* do it */
rv = usb_submit_urb(dev->bulk_in_urb, GFP_KERNEL); rv = usb_submit_urb(dev->bulk_in_urb, GFP_KERNEL);
if (rv < 0) { if (rv < 0) {
err("%s - failed submitting read urb, error %d", dev_err(&dev->interface->dev,
"%s - failed submitting read urb, error %d\n",
__func__, rv); __func__, rv);
dev->bulk_in_filled = 0; dev->bulk_in_filled = 0;
rv = (rv == -ENOMEM) ? rv : -EIO; rv = (rv == -ENOMEM) ? rv : -EIO;
...@@ -364,8 +366,9 @@ static void skel_write_bulk_callback(struct urb *urb) ...@@ -364,8 +366,9 @@ static void skel_write_bulk_callback(struct urb *urb)
if (!(urb->status == -ENOENT || if (!(urb->status == -ENOENT ||
urb->status == -ECONNRESET || urb->status == -ECONNRESET ||
urb->status == -ESHUTDOWN)) urb->status == -ESHUTDOWN))
err("%s - nonzero write bulk status received: %d", dev_err(&dev->interface->dev,
__func__, urb->status); "%s - nonzero write bulk status received: %d\n",
__func__, urb->status);
spin_lock(&dev->err_lock); spin_lock(&dev->err_lock);
dev->errors = urb->status; dev->errors = urb->status;
...@@ -459,8 +462,9 @@ static ssize_t skel_write(struct file *file, const char *user_buffer, ...@@ -459,8 +462,9 @@ static ssize_t skel_write(struct file *file, const char *user_buffer,
retval = usb_submit_urb(urb, GFP_KERNEL); retval = usb_submit_urb(urb, GFP_KERNEL);
mutex_unlock(&dev->io_mutex); mutex_unlock(&dev->io_mutex);
if (retval) { if (retval) {
err("%s - failed submitting write urb, error %d", __func__, dev_err(&dev->interface->dev,
retval); "%s - failed submitting write urb, error %d\n",
__func__, retval);
goto error_unanchor; goto error_unanchor;
} }
...@@ -519,7 +523,7 @@ static int skel_probe(struct usb_interface *interface, ...@@ -519,7 +523,7 @@ static int skel_probe(struct usb_interface *interface,
/* allocate memory for our device state and initialize it */ /* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) { if (!dev) {
err("Out of memory"); dev_err(&interface->dev, "Out of memory\n");
goto error; goto error;
} }
kref_init(&dev->kref); kref_init(&dev->kref);
...@@ -546,12 +550,14 @@ static int skel_probe(struct usb_interface *interface, ...@@ -546,12 +550,14 @@ static int skel_probe(struct usb_interface *interface,
dev->bulk_in_endpointAddr = endpoint->bEndpointAddress; dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!dev->bulk_in_buffer) { if (!dev->bulk_in_buffer) {
err("Could not allocate bulk_in_buffer"); dev_err(&interface->dev,
"Could not allocate bulk_in_buffer\n");
goto error; goto error;
} }
dev->bulk_in_urb = usb_alloc_urb(0, GFP_KERNEL); dev->bulk_in_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->bulk_in_urb) { if (!dev->bulk_in_urb) {
err("Could not allocate bulk_in_urb"); dev_err(&interface->dev,
"Could not allocate bulk_in_urb\n");
goto error; goto error;
} }
} }
...@@ -563,7 +569,8 @@ static int skel_probe(struct usb_interface *interface, ...@@ -563,7 +569,8 @@ static int skel_probe(struct usb_interface *interface,
} }
} }
if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr)) { if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr)) {
err("Could not find both bulk-in and bulk-out endpoints"); dev_err(&interface->dev,
"Could not find both bulk-in and bulk-out endpoints\n");
goto error; goto error;
} }
...@@ -574,7 +581,8 @@ static int skel_probe(struct usb_interface *interface, ...@@ -574,7 +581,8 @@ static int skel_probe(struct usb_interface *interface,
retval = usb_register_dev(interface, &skel_class); retval = usb_register_dev(interface, &skel_class);
if (retval) { if (retval) {
/* something prevented us from registering this driver */ /* something prevented us from registering this driver */
err("Not able to get a minor for this device."); dev_err(&interface->dev,
"Not able to get a minor for this device.\n");
usb_set_intfdata(interface, NULL); usb_set_intfdata(interface, NULL);
goto error; goto error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment