[svn-commits] tzafrir: linux/trunk r5130 - /linux/trunk/drivers/dahdi/xpp/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Oct 27 10:49:10 CDT 2008


Author: tzafrir
Date: Mon Oct 27 10:49:09 2008
New Revision: 5130

URL: http://svn.digium.com/view/dahdi?view=rev&rev=5130
Log:
Fix xpp compile problems on kernel < 2.6.16

Support for kernels that use the older hotplug support rather than the
newer uevent.

Fixes the xpp issue from #13427.

Modified:
    linux/trunk/drivers/dahdi/xpp/card_bri.c
    linux/trunk/drivers/dahdi/xpp/card_fxo.c
    linux/trunk/drivers/dahdi/xpp/card_fxs.c
    linux/trunk/drivers/dahdi/xpp/card_pri.c
    linux/trunk/drivers/dahdi/xpp/xbus-core.h
    linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c
    linux/trunk/drivers/dahdi/xpp/xdefs.h

Modified: linux/trunk/drivers/dahdi/xpp/card_bri.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/xpp/card_bri.c?view=diff&rev=5130&r1=5129&r2=5130
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_bri.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_bri.c Mon Oct 27 10:49:09 2008
@@ -1505,7 +1505,9 @@
 	.type		= XPD_TYPE_BRI,
 	.driver		= {
 		.name = "bri",
+#ifndef OLD_HOTPLUG_SUPPORT
 		.owner = THIS_MODULE,
+#endif
 		.probe = bri_xpd_probe,
 		.remove = bri_xpd_remove
 	}

Modified: linux/trunk/drivers/dahdi/xpp/card_fxo.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/xpp/card_fxo.c?view=diff&rev=5130&r1=5129&r2=5130
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_fxo.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_fxo.c Mon Oct 27 10:49:09 2008
@@ -1341,7 +1341,9 @@
 	.type		= XPD_TYPE_FXO,
 	.driver		= {
 		.name = "fxo",
+#ifndef OLD_HOTPLUG_SUPPORT
 		.owner = THIS_MODULE,
+#endif
 		.probe = fxo_xpd_probe,
 		.remove = fxo_xpd_remove
 	}

Modified: linux/trunk/drivers/dahdi/xpp/card_fxs.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/xpp/card_fxs.c?view=diff&rev=5130&r1=5129&r2=5130
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_fxs.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_fxs.c Mon Oct 27 10:49:09 2008
@@ -1492,7 +1492,9 @@
 	.type		= XPD_TYPE_FXS,
 	.driver		= {
 		.name = "fxs",
+#ifndef OLD_HOTPLUG_SUPPORT
 		.owner = THIS_MODULE,
+#endif
 		.probe = fxs_xpd_probe,
 		.remove = fxs_xpd_remove
 	}

Modified: linux/trunk/drivers/dahdi/xpp/card_pri.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/xpp/card_pri.c?view=diff&rev=5130&r1=5129&r2=5130
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_pri.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_pri.c Mon Oct 27 10:49:09 2008
@@ -2138,7 +2138,9 @@
 	.type		= XPD_TYPE_PRI,
 	.driver		= {
 		.name = "pri",
+#ifndef OLD_HOTPLUG_SUPPORT
 		.owner = THIS_MODULE,
+#endif
 		.probe = pri_xpd_probe,
 		.remove = pri_xpd_remove
 	}

Modified: linux/trunk/drivers/dahdi/xpp/xbus-core.h
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/xpp/xbus-core.h?view=diff&rev=5130&r1=5129&r2=5130
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xbus-core.h (original)
+++ linux/trunk/drivers/dahdi/xpp/xbus-core.h Mon Oct 27 10:49:09 2008
@@ -319,6 +319,20 @@
 void	xpp_driver_exit(void);
 int	xbus_sysfs_create(xbus_t *xbus);
 void	xbus_sysfs_remove(xbus_t *xbus);
+
+#ifdef	OLD_HOTPLUG_SUPPORT
+/* 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
+
 void	astribank_uevent_send(xbus_t *xbus, enum kobject_action act);
 
 #endif	/* XBUS_CORE_H */

Modified: linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c?view=diff&rev=5130&r1=5129&r2=5130
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c (original)
+++ linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c Mon Oct 27 10:49:09 2008
@@ -49,14 +49,6 @@
 /* Command line parameters */
 extern int debug;
 
-/* Kernel versions... */
-/*
- * Hotplug replaced with uevent in 2.6.16
- */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
-#define	OLD_HOPLUG_SUPPORT	// for older kernels
-#endif
-
 /*--------- Sysfs Bus handling ----*/
 static DEVICE_ATTR_READER(xbus_state_show, dev, buf)
 {
@@ -198,7 +190,8 @@
 	return len;
 }
 
-#define xbus_attr(field, format_string)                              \
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
+#define xbus_attr(field, format_string)                                    \
 static ssize_t                                                             \
 field##_show(struct device *dev, struct device_attribute *attr, char *buf) \
 {                                                                          \
@@ -207,6 +200,17 @@
         xbus = dev_to_xbus(dev);                                           \
         return sprintf (buf, format_string, xbus->field);                  \
 }
+#else
+#define xbus_attr(field, format_string)                                    \
+static ssize_t                                                             \
+field##_show(struct device *dev, char *buf)                                \
+{                                                                          \
+        xbus_t	*xbus;                                                     \
+                                                                           \
+        xbus = dev_to_xbus(dev);                                           \
+        return sprintf (buf, format_string, xbus->field);                  \
+}
+#endif
 
 xbus_attr(connector, "%s\n");
 xbus_attr(label, "%s\n");
@@ -233,7 +237,7 @@
 	return 1;
 }
 
-#ifdef OLD_HOPLUG_SUPPORT
+#ifdef OLD_HOTPLUG_SUPPORT
 static int astribank_hotplug(struct device *dev, char **envp, int envnum, char *buff, int bufsize)
 {
 	xbus_t	*xbus;
@@ -305,6 +309,8 @@
 
 #endif
 
+#endif	/* OLD_HOTPLUG_SUPPORT */
+
 void astribank_uevent_send(xbus_t *xbus, enum kobject_action act)
 {
 	struct kobject	*kobj;
@@ -312,10 +318,25 @@
 	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	/* OLD_HOPLUG_SUPPORT */
+#endif
+}
 
 static void xpp_release(struct device *dev)
 {
@@ -340,7 +361,7 @@
 static struct bus_type toplevel_bus_type = {
 	.name           = "astribanks",
 	.match          = astribank_match,
-#ifdef OLD_HOPLUG_SUPPORT
+#ifdef OLD_HOTPLUG_SUPPORT
 	.hotplug 	= astribank_hotplug,
 #else
 	.uevent         = astribank_uevent,
@@ -376,7 +397,7 @@
 	.bus		= &toplevel_bus_type,
 	.probe		= astribank_probe,
 	.remove		= astribank_remove,
-#ifndef OLD_HOPLUG_SUPPORT
+#ifndef OLD_HOTPLUG_SUPPORT
 	.owner		= THIS_MODULE
 #endif
 };

Modified: linux/trunk/drivers/dahdi/xpp/xdefs.h
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/xpp/xdefs.h?view=diff&rev=5130&r1=5129&r2=5130
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xdefs.h (original)
+++ linux/trunk/drivers/dahdi/xpp/xdefs.h Mon Oct 27 10:49:09 2008
@@ -101,6 +101,7 @@
 typedef unsigned char		byte;
 #ifdef __KERNEL__
 
+/* Kernel versions... */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) 
 #define	KMEM_CACHE_T	kmem_cache_t
 #else 
@@ -112,6 +113,13 @@
 					memset((p), 0, sizeof(*(p)));	\
 					kfree(p);			\
 				} while(0);
+
+/*
+ * 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)	\




More information about the svn-commits mailing list