[svn-commits] kpfleming: linux/trunk r4522 - /linux/trunk/drivers/dahdi/dahdi-base.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Jul 2 13:23:12 CDT 2008
Author: kpfleming
Date: Wed Jul 2 13:23:11 2008
New Revision: 4522
URL: http://svn.digium.com/view/dahdi?view=rev&rev=4522
Log:
Linux kernel 2.6.26 is going to change the sysfs registration/destruction methods (again), so be prepared for it
(closes issue #12944)
Reported by: tzafrir
Modified:
linux/trunk/drivers/dahdi/dahdi-base.c
Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=4522&r1=4521&r2=4522
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Wed Jul 2 13:23:11 2008
@@ -155,12 +155,29 @@
static struct proc_dir_entry *proc_entries[DAHDI_MAX_SPANS];
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
+#if 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_device_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)
+#else
+#define CLASS_DEV_DESTROY(class, devt) \
+ class_simple_device_remove(class, devt)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
@@ -169,8 +186,6 @@
static struct class_simple *dahdi_class = NULL;
#define class_create class_simple_create
#define class_destroy class_simple_destroy
-#define class_device_create class_simple_device_add
-#define class_device_destroy(a, b) class_simple_device_remove(b)
#endif
static int deftaps = 64;
@@ -5252,7 +5267,7 @@
for (x = 0; x < span->channels; x++) {
if (span->chans[x]->channo < 250)
- class_device_destroy(dahdi_class, MKDEV(DAHDI_MAJOR, span->chans[x]->channo));
+ CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, span->chans[x]->channo));
}
spans[span->spanno] = NULL;
@@ -7633,7 +7648,7 @@
int dahdi_unregister_chardev(struct dahdi_chardev *dev)
{
- class_device_destroy(dahdi_class, MKDEV(DAHDI_MAJOR, dev->minor));
+ CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, dev->minor));
return 0;
}
@@ -7670,10 +7685,10 @@
static void __exit dahdi_cleanup(void) {
int x;
- class_device_destroy(dahdi_class, MKDEV(DAHDI_MAJOR, 253)); /* timer */
- class_device_destroy(dahdi_class, MKDEV(DAHDI_MAJOR, 254)); /* channel */
- class_device_destroy(dahdi_class, MKDEV(DAHDI_MAJOR, 255)); /* pseudo */
- class_device_destroy(dahdi_class, MKDEV(DAHDI_MAJOR, 0)); /* ctl */
+ CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 253)); /* timer */
+ CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 254)); /* channel */
+ CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 255)); /* pseudo */
+ CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 0)); /* ctl */
class_destroy(dahdi_class);
unregister_chrdev(DAHDI_MAJOR, "dahdi");
More information about the svn-commits
mailing list