[PATCH 42/49] drivers/staging/usbip: Convert printks to pr_<level>
Joe Perches
joe at perches.com
Wed Oct 14 18:54:26 PDT 2009
Signed-off-by: Joe Perches <joe at perches.com>
---
drivers/staging/usbip/stub_main.c | 11 ++++++-----
drivers/staging/usbip/usbip_common.c | 12 +++++-------
drivers/staging/usbip/usbip_common.h | 15 ++++++++-------
drivers/staging/usbip/usbip_event.c | 7 ++++---
drivers/staging/usbip/vhci_hcd.c | 16 ++++++++--------
5 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/drivers/staging/usbip/stub_main.c b/drivers/staging/usbip/stub_main.c
index ba1678f..c016fcf 100644
--- a/drivers/staging/usbip/stub_main.c
+++ b/drivers/staging/usbip/stub_main.c
@@ -17,6 +17,7 @@
* USA.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "usbip_common.h"
#include "stub.h"
@@ -245,20 +246,20 @@ static int __init usb_stub_init(void)
SLAB_HWCACHE_ALIGN, NULL);
if (!stub_priv_cache) {
- printk(KERN_ERR KBUILD_MODNAME
+ pr_err(KBUILD_MODNAME
": 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",
+ pr_err(KBUILD_MODNAME ": usb_register failed %d\n",
ret);
goto error_usb_register;
}
- printk(KERN_INFO KBUILD_MODNAME ":"
- DRIVER_DESC ":" DRIVER_VERSION "\n");
+ pr_info(KBUILD_MODNAME ":"
+ DRIVER_DESC ":" DRIVER_VERSION "\n");
memset(busid_table, 0, sizeof(busid_table));
spin_lock_init(&busid_table_lock);
@@ -267,7 +268,7 @@ static int __init usb_stub_init(void)
&driver_attr_match_busid);
if (ret) {
- printk(KERN_ERR KBUILD_MODNAME ": create driver sysfs\n");
+ pr_err(KBUILD_MODNAME ": create driver sysfs\n");
goto error_create_file;
}
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
index ddb6f5f..32ac9bd 100644
--- a/drivers/staging/usbip/usbip_common.c
+++ b/drivers/staging/usbip/usbip_common.c
@@ -414,14 +414,12 @@ int usbip_start_threads(struct usbip_device *ud)
th = kthread_run(usbip_thread, (void *)&ud->tcp_rx, "usbip");
if (IS_ERR(th)) {
- printk(KERN_WARNING
- "Unable to start control thread\n");
+ pr_warning("Unable to start control thread\n");
return PTR_ERR(th);
}
th = kthread_run(usbip_thread, (void *)&ud->tcp_tx, "usbip");
if (IS_ERR(th)) {
- printk(KERN_WARNING
- "Unable to start control thread\n");
+ pr_warning("Unable to start control thread\n");
return PTR_ERR(th);
}
@@ -479,7 +477,7 @@ int usbip_xmit(int send, struct socket *sock, char *buf,
usbip_dbg_xmit("enter\n");
if (!sock || !buf || !size) {
- printk(KERN_ERR "%s: invalid arg, sock %p buff %p size %d\n",
+ pr_err("%s: invalid arg, sock %p buff %p size %d\n",
__func__, sock, buf, size);
return -EINVAL;
}
@@ -620,7 +618,7 @@ struct socket *sockfd_to_socket(unsigned int sockfd)
file = fget(sockfd);
if (!file) {
- printk(KERN_ERR "%s: invalid sockfd\n", __func__);
+ pr_err("%s: invalid sockfd\n", __func__);
return NULL;
}
@@ -981,7 +979,7 @@ EXPORT_SYMBOL_GPL(usbip_recv_xbuff);
static int __init usbip_common_init(void)
{
- printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "" DRIVER_VERSION);
+ pr_info(KBUILD_MODNAME ": " DRIVER_DESC "" DRIVER_VERSION);
return 0;
}
diff --git a/drivers/staging/usbip/usbip_common.h b/drivers/staging/usbip/usbip_common.h
index 1ca3eab..476c994 100644
--- a/drivers/staging/usbip/usbip_common.h
+++ b/drivers/staging/usbip/usbip_common.h
@@ -49,7 +49,8 @@
#else /* CONFIG_USB_DEBUG */
-#define usbip_udbg(fmt, args...) do { } while (0)
+#define usbip_udbg(fmt, args...) \
+ do { if (0) printk(KERN_DEBUG fmt, ##arg); } while (0)
#endif /* CONFIG_USB_DEBUG */
@@ -125,9 +126,9 @@ extern struct device_attribute dev_attr_usbip_debug;
*/
#define usbip_uerr(fmt, args...) \
do { \
- printk(KERN_ERR "%-10s: ***ERROR*** (%s,%d) %s: " fmt, \
- (in_interrupt() ? "interrupt" : (current)->comm),\
- __FILE__, __LINE__, __func__, ##args); \
+ pr_err("%-10s: ***ERROR*** (%s,%d) %s: " fmt, \
+ (in_interrupt() ? "interrupt" : (current)->comm), \
+ __FILE__, __LINE__, __func__, ##args); \
} while (0)
/**
@@ -135,9 +136,9 @@ extern struct device_attribute dev_attr_usbip_debug;
* @fmt:
* @args:
*/
-#define usbip_uinfo(fmt, args...) \
- do { \
- printk(KERN_INFO "usbip: " fmt , ## args); \
+#define usbip_uinfo(fmt, args...) \
+ do { \
+ pr_info(fmt , ## args); \
} while (0)
diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c
index 6da1021..a583dc4 100644
--- a/drivers/staging/usbip/usbip_event.c
+++ b/drivers/staging/usbip/usbip_event.c
@@ -17,6 +17,8 @@
* USA.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include "usbip_common.h"
#include <linux/kthread.h>
@@ -65,7 +67,7 @@ static int event_handler(struct usbip_device *ud)
}
/* NOTREACHED */
- printk(KERN_ERR "%s: unknown event\n", __func__);
+ pr_err("%s: unknown event\n", __func__);
return -1;
}
@@ -103,8 +105,7 @@ int usbip_start_eh(struct usbip_device *ud)
th = kthread_run(usbip_thread, (void *)eh, "usbip");
if (IS_ERR(th)) {
- printk(KERN_WARNING
- "Unable to start control thread\n");
+ pr_warning("Unable to start control thread\n");
return PTR_ERR(th);
}
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
index 6e91fc2..1097187 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -17,6 +17,7 @@
* USA.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "usbip_common.h"
#include "vhci.h"
@@ -278,8 +279,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
usbip_dbg_vhci_rh("typeReq %x wValue %x wIndex %x\n", typeReq, wValue,
wIndex);
if (wIndex > VHCI_NPORTS)
- printk(KERN_ERR "%s: invalid port number %d\n", __func__,
- wIndex);
+ pr_err("%s: invalid port number %d\n",
+ __func__, wIndex);
rhport = ((__u8)(wIndex & 0x00ff)) - 1;
dum = hcd_to_vhci(hcd);
@@ -347,7 +348,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
case GetPortStatus:
usbip_dbg_vhci_rh(" GetPortStatus port %x\n", wIndex);
if (wIndex > VHCI_NPORTS || wIndex < 1) {
- printk(KERN_ERR "%s: invalid port number %d\n",
+ pr_err("%s: invalid port number %d\n",
__func__, wIndex);
retval = -EPIPE;
}
@@ -358,7 +359,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
* complete it!!
* */
if (dum->resuming && time_after(jiffies, dum->re_timeout)) {
- printk(KERN_ERR "%s: not yet\n", __func__);
+ pr_err("%s: not yet\n", __func__);
dum->port_status[rhport] |=
(1 << USB_PORT_FEAT_C_SUSPEND);
dum->port_status[rhport] &=
@@ -431,7 +432,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
case USB_PORT_FEAT_SUSPEND:
usbip_dbg_vhci_rh(" SetPortFeature: "
"USB_PORT_FEAT_SUSPEND\n");
- printk(KERN_ERR "%s: not yet\n", __func__);
+ pr_err("%s: not yet\n", __func__);
#if 0
dum->port_status[rhport] |=
(1 << USB_PORT_FEAT_SUSPEND);
@@ -472,7 +473,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
break;
default:
- printk(KERN_ERR "%s: default: no such request\n", __func__);
+ pr_err("%s: default: no such request\n", __func__);
/* dev_dbg (hardware,
* "hub control req%04x v%04x i%04x l%d\n",
* typeReq, wValue, wIndex, wLength); */
@@ -1251,8 +1252,7 @@ static int __init vhci_init(void)
if (usb_disabled())
return -ENODEV;
- printk(KERN_INFO KBUILD_MODNAME ": %s, %s\n", driver_name,
- DRIVER_VERSION);
+ pr_info("%s, %s\n", driver_name, DRIVER_VERSION);
ret = platform_driver_register(&vhci_driver);
if (ret < 0)
--
1.6.5.rc3.dirty
More information about the devel
mailing list