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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun May 30 09:31:43 CDT 2010


Author: tzafrir
Date: Sun May 30 09:31:40 2010
New Revision: 8713

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8713
Log:
Make it compile on 2.6.9 kernels

* Not tested (we currently don't have any installed computer)
* Added definition of kobject_action for these old kernels.
* Removed assignment to non-existing 'dev->devt', and 'dev->class'
  It seems this is not required (though should be tested when we
  have a real 2.6.9 box)
* Use class_destroy (previously unused) to match class_create(), instead
  of class_unregister().
* Removed constness from file_operations passed to functions.
* Also commented out few messages
* Also removed unused #if 0 block

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

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c?view=diff&rev=8713&r1=8712&r2=8713
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c Sun May 30 09:31:40 2010
@@ -58,6 +58,9 @@
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17)
 #define create_dev_file(class, devt, name, ...) \
 	class_device_create(class, NULL, devt, NULL, name, ## __VA_ARGS__)
+#else
+#define create_dev_file(class, devt, name, ...) \
+	class_simple_device_add(class, devt, NULL, name, ## __VA_ARGS__)
 #endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
@@ -66,6 +69,12 @@
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
 #define destroy_dev_file(class, devt) \
 	class_device_destroy(class, devt)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
+#define destroy_dev_file(class, devt) \
+	class_simple_device_remove(devt)
+#else
+#define destroy_dev_file(class, devt) \
+	class_simple_device_remove(class, devt)
 #endif
 
 /*--------- Sysfs channel handling ----*/
@@ -203,8 +212,10 @@
 	devt = MKDEV(MAJOR(dahdi_channels_devt), chan->channo);
 	chan_dbg(DEVICES, chan, "SYSFS\n");
 	dev = &chan->chan_device;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
 	dev->devt = devt;
 	dev->class = NULL;
+#endif
 	dev->bus = &chan_bus_type;
 	dev->parent = &span->span_device;
 	/*
@@ -256,7 +267,7 @@
 
 /*--------- Sysfs Device handling ----*/
 
-int __init dahdi_driver_chan_init(const struct file_operations *fops)
+int __init dahdi_driver_chan_init(struct file_operations *fops)
 {
 	int	res;
 
@@ -285,7 +296,6 @@
 	if (res) {
 		dahdi_err("%s: Failed allocating chrdev for %d channels (%d)",
 			__func__, DAHDI_MAX_CHANNELS, res);
-		class_unregister(chan_class);
 		driver_unregister(&chan_driver);
 		goto failed_chrdev_region;
 	}
@@ -312,7 +322,7 @@
 failed_cdev_add:
 	unregister_chrdev_region(dahdi_channels_devt, DAHDI_MAX_CHANNELS);
 failed_chrdev_region:
-	class_unregister(chan_class);
+	class_destroy(chan_class);
 failed_class:
 	driver_unregister(&chan_driver);
 failed_driver:
@@ -331,7 +341,7 @@
 	destroy_dev_file(chan_class, MKDEV(DAHDI_MAJOR, DAHDI_TIMER));
 	cdev_del(&dahdi_channels_cdev);
 	unregister_chrdev_region(dahdi_channels_devt, DAHDI_MAX_CHANNELS);
-	class_unregister(chan_class);
+	class_destroy(chan_class);
 	driver_unregister(&chan_driver);
 	bus_unregister(&chan_bus_type);
 }

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c?view=diff&rev=8713&r1=8712&r2=8713
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c Sun May 30 09:31:40 2010
@@ -49,7 +49,7 @@
 
 static int span_match(struct device *dev, struct device_driver *driver)
 {
-	dev_info(dev, "SYSFS MATCH: driver->name = %s\n", driver->name);
+	//dev_info(dev, "SYSFS MATCH: driver->name = %s\n", driver->name);
 	return 1;
 }
 
@@ -267,36 +267,6 @@
 };
 
 
-#if 0
-void span_uevent_send(xbus_t *xbus, enum kobject_action act)
-{
-	struct kobject	*kobj;
-
-	kobj = &xbus->astribank.kobj;
-	XBUS_DBG(DEVICES, xbus, "SYFS bus_id=%s action=%d\n",
-		xbus->astribank.bus_id, act);
-
-#ifdef	OLD_HOTPLUG_SUPPORT
-	{
-		/* Copy from new kernels lib/kobject_uevent.c */
-		static const char	*str[] = {
-			[KOBJ_ADD]	"add",
-			[KOBJ_REMOVE]	"remove",
-			[KOBJ_CHANGE]	"change",
-			[KOBJ_MOUNT]	"mount",
-			[KOBJ_UMOUNT]	"umount",
-			[KOBJ_OFFLINE]	"offline",
-			[KOBJ_ONLINE]	"online"
-		};
-		kobject_hotplug(str[act], kobj);
-	}
-#else
-	kobject_uevent(kobj, act);
-#endif
-}
-
-#endif
-
 static struct driver_attribute dahdi_attrs[] = {
 	__ATTR_NULL,
 };
@@ -319,7 +289,7 @@
 	struct dahdi_span *span;
 
 	span = dev_to_span(dev);
-	dev_info(dev, "span %d\n", span->spanno);
+	//dev_info(dev, "span %d\n", span->spanno);
 	return 0;
 }
 
@@ -328,7 +298,7 @@
 	struct dahdi_span *span;
 
 	span = dev_to_span(dev);
-	dev_info(dev, "span %d\n", span->spanno);
+	//dev_info(dev, "span %d\n", span->spanno);
 	return 0;
 }
 
@@ -446,7 +416,7 @@
 	return res;
 }
 
-int __init dahdi_driver_init(const struct file_operations *fops)
+int __init dahdi_driver_init(struct file_operations *fops)
 {
 	int	res;
 

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.h?view=diff&rev=8713&r1=8712&r2=8713
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.h (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.h Sun May 30 09:31:40 2010
@@ -1,5 +1,26 @@
 #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
@@ -35,9 +56,9 @@
 		ssize_t name(struct device_driver *drv, char * buf)
 
 /* Global */
-int __init dahdi_driver_init(const struct file_operations *fops);
+int __init dahdi_driver_init(struct file_operations *fops);
 void dahdi_driver_exit(void);
-int __init dahdi_driver_chan_init(const struct file_operations *fops);
+int __init dahdi_driver_chan_init(struct file_operations *fops);
 void dahdi_driver_chan_exit(void);
 
 /* per-span */




More information about the svn-commits mailing list