[dahdi-commits] sruffell: linux/trunk r10561 - /linux/trunk/include/dahdi/kernel.h

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Wed Mar 21 13:56:16 CDT 2012


Author: sruffell
Date: Wed Mar 21 13:56:12 2012
New Revision: 10561

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10561
Log:
dahdi: Update dev_set_name / dev_name for RHEL 5.6+.

This is needed because dev_name() is mapped to kobject_name() in a backport,
but the kobject name isn't set until after device_add().  The result would be
parentless devices would fail since dahdi would not think a name was set for
these devices.

For these systems, we'll set both the bus_id string and the underlying
kobject_name.

Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

Modified:
    linux/trunk/include/dahdi/kernel.h

Modified: linux/trunk/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/include/dahdi/kernel.h?view=diff&rev=10561&r1=10560&r2=10561
==============================================================================
--- linux/trunk/include/dahdi/kernel.h (original)
+++ linux/trunk/include/dahdi/kernel.h Wed Mar 21 13:56:12 2012
@@ -79,16 +79,25 @@
 #define DAHDI_IRQ_DISABLED IRQF_DISABLED
 #define DAHDI_IRQ_SHARED_DISABLED IRQF_SHARED | IRQF_DISABLED
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
 #  ifdef RHEL_RELEASE_VERSION
 #    if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5, 6)
 #define dev_name(dev)		((dev)->bus_id)
+#define dev_set_name(dev, format, ...) \
+	snprintf((dev)->bus_id, BUS_ID_SIZE, format, ## __VA_ARGS__)
+#    else
+#define dev_set_name(dev, format, ...) \
+	do { \
+		kobject_set_name(&(dev)->kobj, format, ## __VA_ARGS__); \
+		snprintf((dev)->bus_id, BUS_ID_SIZE, \
+			kobject_name(&(dev)->kobj));	\
+	} while (0)
 #    endif
 #  else
 #define dev_name(dev)		((dev)->bus_id)
-#  endif
 #define dev_set_name(dev, format, ...) \
 	snprintf((dev)->bus_id, BUS_ID_SIZE, format, ## __VA_ARGS__)
+#  endif
 #endif
 
 /*! Default chunk size for conferences and such -- static right now, might make




More information about the dahdi-commits mailing list