Skip to contentSkip to conversation

compat: use macro for netdev_name() to support Debian kernel 2.6.32-5

PATCH Applied Pavel Roskin 2 participants 2 messages Jun 29, 2011 – Jun 30, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat: use macro for netdev_name() to support Debian kernel 2.6.32-5

Debian backports netdev_name as a function. As we cannot test if a function is present, use an equivalent macro.

Reported by Sivaraman V <[email protected]> and Alex <[email protected]>

---
 include/linux/compat-2.6.34.h |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
include/linux/compat-2.6.34.h +5 -6
index 9743d6c..bada700 100644
@@ -20,12 +20,11 @@
 
 /* netdev_printk helpers, similar to dev_printk */
 
-static inline const char *netdev_name(const struct net_device *dev)
-{
-	if (dev->reg_state != NETREG_REGISTERED)
-		return "(unregistered net_device)";
-	return dev->name;
-}
+#ifndef netdev_name
+#define netdev_name(__dev) \
+	((__dev->reg_state != NETREG_REGISTERED) ? \
+		"(unregistered net_device)" : __dev->name)
+#endif
 
 #define netdev_printk(level, netdev, format, args...)		\
 	dev_printk(level, (netdev)->dev.parent,			\