Skip to content

Commit

Permalink
staging: usbip: replace usbip_u{dbg,err,info} and printk with dev_ an…
Browse files Browse the repository at this point in the history
…d pr_

This switches all of the usbip_u{dbg,err,info} and printk statements to
dev_<level>, if possible, or pr_<level> macros. And removes a few
unnecessary debug statements.

Signed-off-by: matt mooney <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
mfmooney authored and gregkh committed May 19, 2011
1 parent db60697 commit 1a4b6f6
Show file tree
Hide file tree
Showing 11 changed files with 220 additions and 306 deletions.
44 changes: 20 additions & 24 deletions drivers/staging/usbip/stub_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ static void stub_shutdown_connection(struct usbip_device *ud)
* step 1?
*/
if (ud->tcp_socket) {
usbip_udbg("shutdown tcp_socket %p\n", ud->tcp_socket);
dev_dbg(&sdev->udev->dev, "shutdown tcp_socket %p\n",
ud->tcp_socket);
kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR);
}

Expand Down Expand Up @@ -244,12 +245,11 @@ static void stub_device_reset(struct usbip_device *ud)
struct usb_device *udev = sdev->udev;
int ret;

usbip_udbg("device reset");
dev_dbg(&udev->dev, "device reset");

ret = usb_lock_device_for_reset(udev, sdev->interface);
if (ret < 0) {
dev_err(&udev->dev, "lock for reset\n");

spin_lock(&ud->lock);
ud->status = SDEV_ST_ERROR;
spin_unlock(&ud->lock);
Expand Down Expand Up @@ -336,7 +336,8 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev,

usbip_start_eh(&sdev->ud);

usbip_udbg("register new interface\n");
dev_dbg(&interface->dev, "register new interface\n");

return sdev;
}

Expand All @@ -346,7 +347,7 @@ static int stub_device_free(struct stub_device *sdev)
return -EINVAL;

kfree(sdev);
usbip_udbg("kfree udev ok\n");
pr_debug("kfree udev ok\n");

return 0;
}
Expand Down Expand Up @@ -376,9 +377,8 @@ static int stub_probe(struct usb_interface *interface,
busid_priv = get_busid_priv(udev_busid);
if (!busid_priv || (busid_priv->status == STUB_BUSID_REMOV) ||
(busid_priv->status == STUB_BUSID_OTHER)) {
dev_info(&interface->dev,
"this device %s is not in match_busid table. skip!\n",
udev_busid);
dev_info(&interface->dev, "%s is not in match_busid table... "
"skip!\n", udev_busid);

/*
* Return value should be ENODEV or ENOXIO to continue trying
Expand All @@ -388,15 +388,15 @@ static int stub_probe(struct usb_interface *interface,
return -ENODEV;
}

if (udev->descriptor.bDeviceClass == USB_CLASS_HUB) {
usbip_udbg("this device %s is a usb hub device. skip!\n",
udev_busid);
if (udev->descriptor.bDeviceClass == USB_CLASS_HUB) {
dev_dbg(&udev->dev, "%s is a usb hub device... skip!\n",
udev_busid);
return -ENODEV;
}

if (!strcmp(udev->bus->bus_name, "vhci_hcd")) {
usbip_udbg("this device %s is attached on vhci_hcd. skip!\n",
udev_busid);
dev_dbg(&udev->dev, "%s is attached on vhci_hcd... skip!\n",
udev_busid);
return -ENODEV;
}

Expand All @@ -406,8 +406,7 @@ static int stub_probe(struct usb_interface *interface,
return -ENODEV;

busid_priv->interf_count++;
dev_info(&interface->dev,
"USB/IP Stub: register a new interface "
dev_info(&interface->dev, "usbip-host: register new interface "
"(bus %u dev %u ifn %u)\n",
udev->bus->busnum, udev->devnum,
interface->cur_altsetting->desc.bInterfaceNumber);
Expand All @@ -417,7 +416,7 @@ static int stub_probe(struct usb_interface *interface,

err = stub_add_files(&interface->dev);
if (err) {
dev_err(&interface->dev, "create sysfs files for %s\n",
dev_err(&interface->dev, "stub_add_files for %s\n",
udev_busid);
usb_set_intfdata(interface, NULL);
busid_priv->interf_count--;
Expand All @@ -434,7 +433,7 @@ static int stub_probe(struct usb_interface *interface,
if (!sdev)
return -ENOMEM;

dev_info(&interface->dev, "USB/IP Stub: register a new device "
dev_info(&interface->dev, "usbip-host: register new device "
"(bus %u dev %u ifn %u)\n", udev->bus->busnum, udev->devnum,
interface->cur_altsetting->desc.bInterfaceNumber);

Expand All @@ -449,8 +448,7 @@ static int stub_probe(struct usb_interface *interface,

err = stub_add_files(&interface->dev);
if (err) {
dev_err(&interface->dev, "create sysfs files for %s\n",
udev_busid);
dev_err(&interface->dev, "stub_add_files for %s\n", udev_busid);
usb_set_intfdata(interface, NULL);
usb_put_intf(interface);

Expand Down Expand Up @@ -486,10 +484,9 @@ static void stub_disconnect(struct usb_interface *interface)
const char *udev_busid = dev_name(interface->dev.parent);
struct bus_id_priv *busid_priv;

busid_priv = get_busid_priv(udev_busid);

usbip_udbg("Enter\n");
dev_dbg(&interface->dev, "Enter\n");

busid_priv = get_busid_priv(udev_busid);
if (!busid_priv) {
BUG();
return;
Expand All @@ -499,7 +496,7 @@ static void stub_disconnect(struct usb_interface *interface)

/* get stub_device */
if (!sdev) {
err(" could not get device from inteface data");
dev_err(&interface->dev, "could not get device");
/* BUG(); */
return;
}
Expand Down Expand Up @@ -543,5 +540,4 @@ static void stub_disconnect(struct usb_interface *interface)
busid_priv->status = STUB_BUSID_OTHER;
del_match_busid((char *)udev_busid);
}
usbip_udbg("bye\n");
}
19 changes: 8 additions & 11 deletions drivers/staging/usbip/stub_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ static ssize_t store_match_busid(struct device_driver *dev, const char *buf,
if (add_match_busid(busid) < 0)
return -ENOMEM;
else {
usbip_udbg("add busid %s\n", busid);
pr_debug("add busid %s\n", busid);
return count;
}
} else if (!strncmp(buf, "del ", 4)) {
if (del_match_busid(busid) < 0)
return -ENODEV;
else {
usbip_udbg("del busid %s\n", busid);
pr_debug("del busid %s\n", busid);
return count;
}
} else
Expand Down Expand Up @@ -239,12 +239,12 @@ void stub_device_cleanup_urbs(struct stub_device *sdev)
{
struct stub_priv *priv;

usbip_udbg("free sdev %p\n", sdev);
dev_dbg(&sdev->udev->dev, "free sdev %p\n", sdev);

while ((priv = stub_priv_pop(sdev))) {
struct urb *urb = priv->urb;

usbip_udbg(" free urb %p\n", urb);
dev_dbg(&sdev->udev->dev, "free urb %p\n", urb);
usb_kill_urb(urb);

kmem_cache_free(stub_priv_cache, priv);
Expand All @@ -265,28 +265,25 @@ static int __init usb_stub_init(void)
SLAB_HWCACHE_ALIGN, NULL);

if (!stub_priv_cache) {
printk(KERN_ERR KBUILD_MODNAME
": create stub_priv_cache error\n");
pr_err("create stub_priv_cache error\n");
return -ENOMEM;
}

ret = usb_register(&stub_driver);
if (ret) {
printk(KERN_ERR KBUILD_MODNAME ": usb_register failed %d\n",
ret);
pr_err("usb_register failed %d\n", ret);
goto error_usb_register;
}

printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC " " USBIP_VERSION
"\n");
pr_info(DRIVER_DESC " " USBIP_VERSION "\n");

init_busid_table();

ret = driver_create_file(&stub_driver.drvwrap.driver,
&driver_attr_match_busid);

if (ret) {
printk(KERN_ERR KBUILD_MODNAME ": create driver sysfs\n");
pr_err("create driver sysfs\n");
goto error_create_file;
}

Expand Down
23 changes: 11 additions & 12 deletions drivers/staging/usbip/stub_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ static int tweak_clear_halt_cmd(struct urb *urb)

ret = usb_clear_halt(urb->dev, target_pipe);
if (ret < 0)
usbip_uinfo("clear_halt error: devnum %d endp %d, %d\n",
urb->dev->devnum, target_endp, ret);
dev_err(&urb->dev->dev, "usb_clear_halt error: devnum %d endp "
"%d ret %d\n", urb->dev->devnum, target_endp, ret);
else
usbip_uinfo("clear_halt done: devnum %d endp %d\n",
urb->dev->devnum, target_endp);
dev_info(&urb->dev->dev, "usb_clear_halt done: devnum %d endp "
"%d\n", urb->dev->devnum, target_endp);

return ret;
}
Expand All @@ -127,11 +127,11 @@ static int tweak_set_interface_cmd(struct urb *urb)

ret = usb_set_interface(urb->dev, interface, alternate);
if (ret < 0)
usbip_uinfo("set_interface error: inf %u alt %u, %d\n",
interface, alternate, ret);
dev_err(&urb->dev->dev, "usb_set_interface error: inf %u alt "
"%u ret %d\n", interface, alternate, ret);
else
usbip_uinfo("set_interface done: inf %u alt %u\n",
interface, alternate);
dev_info(&urb->dev->dev, "usb_set_interface done: inf %u alt "
"%u\n", interface, alternate);

return ret;
}
Expand Down Expand Up @@ -160,9 +160,8 @@ static int tweak_set_configuration_cmd(struct urb *urb)
* A user may need to set a special configuration value before
* exporting the device.
*/
usbip_uinfo("set_configuration %d to %s\n",
config, dev_name(&urb->dev->dev));
usbip_uinfo("but, skip!\n");
dev_info(&urb->dev->dev, "usb_set_configuration %d to %s... skip!\n",
config, dev_name(&urb->dev->dev));

return 0;
/* return usb_driver_set_configuration(urb->dev, config); */
Expand All @@ -173,7 +172,7 @@ static int tweak_reset_device_cmd(struct urb *urb)
struct stub_priv *priv = (struct stub_priv *) urb->context;
struct stub_device *sdev = priv->sdev;

usbip_uinfo("reset_device %s\n", dev_name(&urb->dev->dev));
dev_info(&urb->dev->dev, "usb_queue_reset_device\n");

/*
* usb_lock_device_for_reset caused a deadlock: it causes the driver
Expand Down
17 changes: 9 additions & 8 deletions drivers/staging/usbip/stub_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,23 @@ void stub_complete(struct urb *urb)
/* OK */
break;
case -ENOENT:
usbip_uinfo("stopped by a call of usb_kill_urb() because of"
"cleaning up a virtual connection\n");
dev_info(&urb->dev->dev, "stopped by a call to usb_kill_urb() "
"because of cleaning up a virtual connection\n");
return;
case -ECONNRESET:
usbip_uinfo("unlinked by a call of usb_unlink_urb()\n");
dev_info(&urb->dev->dev, "unlinked by a call to "
"usb_unlink_urb()\n");
break;
case -EPIPE:
usbip_uinfo("endpoint %d is stalled\n",
usb_pipeendpoint(urb->pipe));
dev_info(&urb->dev->dev, "endpoint %d is stalled\n",
usb_pipeendpoint(urb->pipe));
break;
case -ESHUTDOWN:
usbip_uinfo("device removed?\n");
dev_info(&urb->dev->dev, "device removed?\n");
break;
default:
usbip_uinfo("urb completion with non-zero status %d\n",
urb->status);
dev_info(&urb->dev->dev, "urb completion with non-zero status "
"%d\n", urb->status);
break;
}

Expand Down
Loading

0 comments on commit 1a4b6f6

Please sign in to comment.