[svn-commits] tzafrir: branch linux/tzafrir/sysfs r5747 - /linux/team/tzafrir/sysfs/drivers...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jan 19 12:42:17 CST 2009


Author: tzafrir
Date: Mon Jan 19 12:42:17 2009
New Revision: 5747

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=5747
Log:
Simplfy decleration of a bus reader attribute.

Modified:
    linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c?view=diff&rev=5747&r1=5746&r2=5747
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c Mon Jan 19 12:42:17 2009
@@ -47,11 +47,15 @@
 		ssize_t name(struct device *dev, struct device_attribute *attr, char *buf)
 #define	DEVICE_ATTR_WRITER(name,dev,buf, count)	\
 		ssize_t name(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+#define BUS_ATTR_READER(name,dev,buf) \
+   ssize_t name(struct device *dev, struct device_attribute *attr, char *buf)
 #else
 #define	DEVICE_ATTR_READER(name,dev,buf)	\
 		ssize_t name(struct device *dev, char *buf)
 #define	DEVICE_ATTR_WRITER(name,dev,buf, count)	\
 		ssize_t name(struct device *dev, const char *buf, size_t count)
+#define BUS_ATTR_READER(name,dev,buf) \
+   ssize_t name(struct device *dev, char *buf)
 #endif
 
 static const char rcsid[] = "$Id$";
@@ -225,27 +229,14 @@
 }
 #endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
 #define span_attr(field, format_string)                                    \
-static ssize_t                                                             \
-field##_show(struct device *dev, struct device_attribute *attr, char *buf) \
+static BUS_ATTR_READER(field##_show,dev,buf)                               \
 {                                                                          \
         struct dahdi_span	*span;                                     \
                                                                            \
         span = dev_to_span(dev);                                           \
         return sprintf (buf, format_string, span->field);                  \
 }
-#else
-#define span_attr(field, format_string)                                    \
-static ssize_t                                                             \
-field##_show(struct device *dev, char *buf)                                \
-{                                                                          \
-        struct dahdi_span	*span;                                     \
-                                                                           \
-        span = dev_to_span(dev);                                           \
-        return sprintf (buf, format_string, span->field);                  \
-}
-#endif
 
 span_attr(name, "%s\n");
 span_attr(desc, "%s\n");




More information about the svn-commits mailing list