speedtch usbatm.h,1.11,1.12

Roman Kagan rkagan at mail.ru
Thu Apr 14 05:36:55 EDT 2005


On Thu, Apr 14, 2005 at 11:16:21AM +0200, Duncan Sands wrote:
> Hi Roman, what's the reason for the (void) instance?
> 
> > +	do { (void) instance; } while (0)

Frankly, I've copied this stuff from include/linux/device.h without much
thinking.  I guess there it's used to avoid warnings about unused
variables, when people cache dev in a local variable and only use it for
debugging.  We don't have this problem, so the updated patch is
attached.

Cheers,
  Roman.

Index: usbatm.h
===================================================================
RCS file: /home/cvs/usbatm/usbatm.h,v
retrieving revision 1.12
diff -u -p -r1.12 usbatm.h
--- usbatm.h	7 Apr 2005 21:52:43 -0000	1.12
+++ usbatm.h	14 Apr 2005 09:36:08 -0000
@@ -59,14 +59,24 @@
 #define usb_dbg(instance, format, arg...)	\
 	dev_dbg(&(instance)->usb_intf->dev , format , ## arg)
 
+/* FIXME: move to dev_* once ATM is driver model aware */
+#define atm_printk(level, instance, format, arg...)  \
+        printk(level "ATM dev %d: " format , (instance)->atm_dev->number, ## arg)
+
 #define atm_err(instance, format, arg...)	\
-	usb_err(instance, format, ## arg)
+	atm_printk(KERN_ERR, instance, format, ## arg)
 #define atm_info(instance, format, arg...)	\
-	usb_info(instance, format, ## arg)
+	atm_printk(KERN_INFO, instance, format, ## arg)
 #define atm_warn(instance, format, arg...)	\
-	usb_warn(instance, format, ## arg)
+	atm_printk(KERN_WARNING, instance, format, ## arg)
+#ifdef DEBUG
+#define atm_dbg(instance, format, arg...)	\
+	atm_printk(KERN_DEBUG, instance, format, ## arg)
+#else
 #define atm_dbg(instance, format, arg...)	\
-	usb_dbg(instance, format, ## arg)
+	do {} while (0)
+#endif
+
 
 /* mini driver */
 



More information about the Usbatm mailing list