[svn-commits] tzafrir: linux/trunk r10462 - /linux/trunk/drivers/dahdi/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Feb 22 06:11:26 CST 2012
Author: tzafrir
Date: Wed Feb 22 06:11:23 2012
New Revision: 10462
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10462
Log:
sysfs channels: refactor compat macros
* Refactor all kernel version compatibility macros that relate
to sysfs and device files to new header: dahdi-sysfs.h
* No functional change.
* Preparing for a refactor channel device file handling into a new
source file.
Signed-off-by: Oron Peled <oron.peled at xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Acked-by: Shaun Ruffell <sruffell at digium.com>
Added:
linux/trunk/drivers/dahdi/dahdi-sysfs.h (with props)
Modified:
linux/trunk/drivers/dahdi/dahdi-sysfs.c
Modified: linux/trunk/drivers/dahdi/dahdi-sysfs.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-sysfs.c?view=diff&rev=10462&r1=10461&r2=10462
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-sysfs.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-sysfs.c Wed Feb 22 06:11:23 2012
@@ -6,37 +6,7 @@
#include <linux/slab.h>
#include "dahdi.h"
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
-#define CLASS_DEV_CREATE(class, devt, device, name) \
- device_create(class, device, devt, NULL, "%s", name)
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
-#define CLASS_DEV_CREATE(class, devt, device, name) \
- device_create(class, device, devt, name)
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
-#define CLASS_DEV_CREATE(class, devt, device, name) \
- class_device_create(class, NULL, devt, device, name)
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
-#define CLASS_DEV_CREATE(class, devt, device, name) \
- class_device_create(class, devt, device, name)
-#else
-#define CLASS_DEV_CREATE(class, devt, device, name) \
- class_simple_device_add(class, devt, device, name)
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
-#define CLASS_DEV_DESTROY(class, devt) \
- device_destroy(class, devt)
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
-#define CLASS_DEV_DESTROY(class, devt) \
- class_device_destroy(class, devt)
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
-#define CLASS_DEV_DESTROY(class, devt) \
- class_simple_device_remove(devt)
-#else
-#define CLASS_DEV_DESTROY(class, devt) \
- class_simple_device_remove(class, devt)
-#endif
+#include "dahdi-sysfs.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
static struct class *dahdi_class;
@@ -45,65 +15,6 @@
#define class_create class_simple_create
#define class_destroy class_simple_destroy
#endif
-
-/*
- * Very old hotplug support
- */
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 9)
-#define OLD_HOTPLUG_SUPPORT /* for older kernels */
-#define OLD_HOTPLUG_SUPPORT_269
-#endif
-
-#ifdef OLD_HOTPLUG_SUPPORT_269
-/* Copy from new kernels lib/kobject_uevent.c */
-enum kobject_action {
- KOBJ_ADD,
- KOBJ_REMOVE,
- KOBJ_CHANGE,
- KOBJ_MOUNT,
- KOBJ_UMOUNT,
- KOBJ_OFFLINE,
- KOBJ_ONLINE,
-};
-#endif
-
-/*
- * Hotplug replaced with uevent in 2.6.16
- */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
-#define OLD_HOTPLUG_SUPPORT /* for older kernels */
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
-#define DEVICE_ATTR_READER(name, dev, buf) \
- 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)
-#define BUS_ATTR_WRITER(name, dev, buf, count) \
- ssize_t name(struct device *dev, \
- struct device_attribute *attr, \
- const char *buf, size_t count)
-#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)
-#define BUS_ATTR_WRITER(name, dev, buf, count) \
- ssize_t name(struct device *dev, const char *buf, size_t count)
-#endif
-
-#define DRIVER_ATTR_READER(name, drv, buf) \
- ssize_t name(struct device_driver *drv, char * buf)
static char *initdir = "/usr/share/dahdi";
Added: linux/trunk/drivers/dahdi/dahdi-sysfs.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-sysfs.h?view=auto&rev=10462
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-sysfs.h (added)
+++ linux/trunk/drivers/dahdi/dahdi-sysfs.h Wed Feb 22 06:11:23 2012
@@ -1,0 +1,98 @@
+#ifndef DAHDI_SYSFS_H
+#define DAHDI_SYSFS_H
+
+/*
+ * Very old hotplug support
+ */
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 9)
+#define OLD_HOTPLUG_SUPPORT /* for older kernels */
+#define OLD_HOTPLUG_SUPPORT_269
+#endif
+
+#ifdef OLD_HOTPLUG_SUPPORT_269
+/* Copy from new kernels lib/kobject_uevent.c */
+enum kobject_action {
+ KOBJ_ADD,
+ KOBJ_REMOVE,
+ KOBJ_CHANGE,
+ KOBJ_MOUNT,
+ KOBJ_UMOUNT,
+ KOBJ_OFFLINE,
+ KOBJ_ONLINE,
+};
+#endif
+
+/*
+ * Hotplug replaced with uevent in 2.6.16
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
+#define OLD_HOTPLUG_SUPPORT /* for older kernels */
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
+#define DEVICE_ATTR_READER(name, dev, buf) \
+ 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)
+#define BUS_ATTR_WRITER(name, dev, buf, count) \
+ ssize_t name(struct device *dev, \
+ struct device_attribute *attr, \
+ const char *buf, size_t count)
+#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)
+#define BUS_ATTR_WRITER(name, dev, buf, count) \
+ ssize_t name(struct device *dev, const char *buf, size_t count)
+#endif
+
+#define DRIVER_ATTR_READER(name, drv, buf) \
+ ssize_t name(struct device_driver *drv, char * buf)
+
+/* Device file creation macros */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+#define CLASS_DEV_CREATE(class, devt, device, name) \
+ device_create(class, device, devt, NULL, "%s", name)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+#define CLASS_DEV_CREATE(class, devt, device, name) \
+ device_create(class, device, devt, name)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
+#define CLASS_DEV_CREATE(class, devt, device, name) \
+ class_device_create(class, NULL, devt, device, name)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+#define CLASS_DEV_CREATE(class, devt, device, name) \
+ class_device_create(class, devt, device, name)
+#else
+#define CLASS_DEV_CREATE(class, devt, device, name) \
+ class_simple_device_add(class, devt, device, name)
+#endif
+
+/* Device file destruction macros */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+#define CLASS_DEV_DESTROY(class, devt) \
+ device_destroy(class, devt)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+#define CLASS_DEV_DESTROY(class, devt) \
+ class_device_destroy(class, devt)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
+#define CLASS_DEV_DESTROY(class, devt) \
+ class_simple_device_remove(devt)
+#else
+#define CLASS_DEV_DESTROY(class, devt) \
+ class_simple_device_remove(class, devt)
+#endif
+
+#endif /* DAHDI_SYSFS_H */
Propchange: linux/trunk/drivers/dahdi/dahdi-sysfs.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: linux/trunk/drivers/dahdi/dahdi-sysfs.h
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: linux/trunk/drivers/dahdi/dahdi-sysfs.h
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the svn-commits
mailing list