USB's core err() macro doesn't print the function name making the call,
that way is necessary to pass __FUNCTION__ to every err() call.

This change introduces usbserial's own err() macro, which prints the
function name. Aditionally, usbserial module's err() calls are converted
to the new one.

Signed-off-by: Luiz Fernando N. Capitulino <[EMAIL PROTECTED]>
---
 drivers/usb/serial/usb-serial.c |   10 +++++-----
 drivers/usb/serial/usb-serial.h |   10 +++++++++-
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 9fa08c9..5d028c6 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1035,7 +1035,7 @@ static int __init usb_serial_init(void)
 
        result = bus_register(&usb_serial_bus_type);
        if (result) {
-               err("%s - registering bus driver failed", __FUNCTION__);
+               err("registering bus driver failed");
                goto exit_bus;
        }
 
@@ -1053,21 +1053,21 @@ static int __init usb_serial_init(void)
        tty_set_operations(usb_serial_tty_driver, &serial_ops);
        result = tty_register_driver(usb_serial_tty_driver);
        if (result) {
-               err("%s - tty_register_driver failed", __FUNCTION__);
+               err("tty_register_driver failed");
                goto exit_reg_driver;
        }
 
        /* register the USB driver */
        result = usb_register(&usb_serial_driver);
        if (result < 0) {
-               err("%s - usb_register failed", __FUNCTION__);
+               err("usb_register failed");
                goto exit_tty;
        }
 
        /* register the generic driver, if we should */
        result = usb_serial_generic_register(debug);
        if (result < 0) {
-               err("%s - registering generic driver failed", __FUNCTION__);
+               err("registering generic driver failed");
                goto exit_generic;
        }
 
@@ -1085,7 +1085,7 @@ exit_reg_driver:
        bus_unregister(&usb_serial_bus_type);
 
 exit_bus:
-       err ("%s - returning with error %d", __FUNCTION__, result);
+       err ("returning with error %d", result);
        put_tty_driver(usb_serial_tty_driver);
        return result;
 }
diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h
index af58879..40b660b 100644
--- a/drivers/usb/serial/usb-serial.h
+++ b/drivers/usb/serial/usb-serial.h
@@ -288,7 +288,10 @@ static inline void usb_serial_debug_data
        }
 }
 
-/* Use our own dbg macro */
+/*
+ * Our own dbg() and err() macros
+ */
+
 #undef dbg
 #define dbg(format, arg...) do { \
        if (debug) \
@@ -296,5 +299,10 @@ #define dbg(format, arg...) do { \
                       __FUNCTION__, ##arg); \
        } while (0)
 
+#undef err
+#define err(format, arg...) do { \
+       printk(KERN_ERR "%s: " format "\n", __FUNCTION__, ##arg); \
+       } while (0)
+
 #endif /* ifdef __LINUX_USB_SERIAL_H */
 
-- 
1.3.3.g0825d



_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to