1 From de1dc65f599b8971eceac4001647c59802a7aaaf Mon Sep 17 00:00:00 2001
2 From: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
3 Date: Tue, 23 May 2006 22:45:40 -0300
4 Subject: [PATCH 2/11] usbserial: Introduces new error macro.
6 USB's core err() macro doesn't print the function name making the call,
7 that way is necessary to pass __FUNCTION__ to every err() call.
9 This change introduces usbserial's own err() macro, which prints the
10 function name. Aditionally, usbserial module's err() calls are converted
13 Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
15 drivers/usb/serial/usb-serial.c | 10 +++++-----
16 drivers/usb/serial/usb-serial.h | 10 +++++++++-
17 2 files changed, 14 insertions(+), 6 deletions(-)
19 diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
20 index 9fa08c9..5d028c6 100644
21 --- a/drivers/usb/serial/usb-serial.c
22 +++ b/drivers/usb/serial/usb-serial.c
23 @@ -1035,7 +1035,7 @@ static int __init usb_serial_init(void)
25 result = bus_register(&usb_serial_bus_type);
27 - err("%s - registering bus driver failed", __FUNCTION__);
28 + err("registering bus driver failed");
32 @@ -1053,21 +1053,21 @@ static int __init usb_serial_init(void)
33 tty_set_operations(usb_serial_tty_driver, &serial_ops);
34 result = tty_register_driver(usb_serial_tty_driver);
36 - err("%s - tty_register_driver failed", __FUNCTION__);
37 + err("tty_register_driver failed");
41 /* register the USB driver */
42 result = usb_register(&usb_serial_driver);
44 - err("%s - usb_register failed", __FUNCTION__);
45 + err("usb_register failed");
49 /* register the generic driver, if we should */
50 result = usb_serial_generic_register(debug);
52 - err("%s - registering generic driver failed", __FUNCTION__);
53 + err("registering generic driver failed");
57 @@ -1085,7 +1085,7 @@ exit_reg_driver:
58 bus_unregister(&usb_serial_bus_type);
61 - err ("%s - returning with error %d", __FUNCTION__, result);
62 + err ("returning with error %d", result);
63 put_tty_driver(usb_serial_tty_driver);
66 diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h
67 index af58879..40b660b 100644
68 --- a/drivers/usb/serial/usb-serial.h
69 +++ b/drivers/usb/serial/usb-serial.h
70 @@ -288,7 +288,10 @@ static inline void usb_serial_debug_data
74 -/* Use our own dbg macro */
76 + * Our own dbg() and err() macros
80 #define dbg(format, arg...) do { \
82 @@ -296,5 +299,10 @@ #define dbg(format, arg...) do { \
83 __FUNCTION__, ##arg); \
87 +#define err(format, arg...) do { \
88 + printk(KERN_ERR "%s: " format "\n", __FUNCTION__, ##arg); \
91 #endif /* ifdef __LINUX_USB_SERIAL_H */