Introduce pet-projects dir
[lcapit-junk-code.git] / linux-kernel / PATCHES / serial-core-port-V0 / 0002-usbserial-Introduces-new-error-macro.patch
blob17b55b828cc1caccfcbfd132d1c746de492929c2
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
11 to the new one.
13 Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
14 ---
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);
26 if (result) {
27 - err("%s - registering bus driver failed", __FUNCTION__);
28 + err("registering bus driver failed");
29 goto exit_bus;
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);
35 if (result) {
36 - err("%s - tty_register_driver failed", __FUNCTION__);
37 + err("tty_register_driver failed");
38 goto exit_reg_driver;
41 /* register the USB driver */
42 result = usb_register(&usb_serial_driver);
43 if (result < 0) {
44 - err("%s - usb_register failed", __FUNCTION__);
45 + err("usb_register failed");
46 goto exit_tty;
49 /* register the generic driver, if we should */
50 result = usb_serial_generic_register(debug);
51 if (result < 0) {
52 - err("%s - registering generic driver failed", __FUNCTION__);
53 + err("registering generic driver failed");
54 goto exit_generic;
57 @@ -1085,7 +1085,7 @@ exit_reg_driver:
58 bus_unregister(&usb_serial_bus_type);
60 exit_bus:
61 - err ("%s - returning with error %d", __FUNCTION__, result);
62 + err ("returning with error %d", result);
63 put_tty_driver(usb_serial_tty_driver);
64 return result;
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 */
75 +/*
76 + * Our own dbg() and err() macros
77 + */
79 #undef dbg
80 #define dbg(format, arg...) do { \
81 if (debug) \
82 @@ -296,5 +299,10 @@ #define dbg(format, arg...) do { \
83 __FUNCTION__, ##arg); \
84 } while (0)
86 +#undef err
87 +#define err(format, arg...) do { \
88 + printk(KERN_ERR "%s: " format "\n", __FUNCTION__, ##arg); \
89 + } while (0)
91 #endif /* ifdef __LINUX_USB_SERIAL_H */
93 --
94 1.3.3.g0825d