]> git.openfabrics.org - ~emulex/compat.git/commitdiff
compat: backport __netdev_printk()
authorLuis R. Rodriguez <mcgrof@frijolero.org>
Tue, 31 Jan 2012 22:44:41 +0000 (14:44 -0800)
committerLuis R. Rodriguez <mcgrof@frijolero.org>
Sat, 4 Feb 2012 02:06:34 +0000 (18:06 -0800)
This was added in v3.2, and will be used by the new
shiny alx Ethernet driver which is not yet upstream.
This now has some fixes for 2.6.35.

Tested with ckmake.

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
compat/Makefile
compat/compat-3.2.c [new file with mode: 0644]
include/linux/compat-3.2.h

index fa9c6cb9479e3a8c839ba3849b02d11cf7b1ded8..3c72ef9bf1e735872b9efdfab64c28ec6f1a2252 100644 (file)
@@ -34,6 +34,7 @@ compat-$(CONFIG_COMPAT_KERNEL_2_6_39) += \
        compat-2.6.39.o \
        kstrtox.o
 compat-$(CONFIG_COMPAT_KERNEL_3_0) += compat-3.0.o
+compat-$(CONFIG_COMPAT_KERNEL_3_2) += compat-3.2.o
 
 compat-$(CONFIG_COMPAT_CORDIC) += cordic.o
 compat-$(CONFIG_COMPAT_CRC8) += crc8.o
diff --git a/compat/compat-3.2.c b/compat/compat-3.2.c
new file mode 100644 (file)
index 0000000..80f5597
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2012  Luis R. Rodriguez <mcgrof@frijolero.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Compatibility file for Linux wireless for kernels 3.2.
+ */
+
+#include <linux/kernel.h>
+#include <linux/device.h>
+
+int __netdev_printk(const char *level, const struct net_device *dev,
+                          struct va_format *vaf)
+{
+       int r;
+
+       if (dev && dev->dev.parent)
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35))
+               r = dev_printk(level, dev->dev.parent, "%s: %pV",
+                              netdev_name(dev), vaf);
+#else
+               /* XXX: this could likely be done better but I'm lazy */
+               r = printk("%s%s: %pV", level, netdev_name(dev), vaf);
+#endif
+       else if (dev)
+               r = printk("%s%s: %pV", level, netdev_name(dev), vaf);
+       else
+               r = printk("%s(NULL net_device): %pV", level, vaf);
+
+       return r;
+}
+EXPORT_SYMBOL(__netdev_printk);
index a17c4adf21583f20504ef17d7b4d615113a0e495..cb14f0b12042cc2d43ff057dc9b6fa4c5bc68389 100644 (file)
@@ -73,6 +73,9 @@ static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
        return ret;
 }
 
+extern int __netdev_printk(const char *level, const struct net_device *dev,
+                          struct va_format *vaf);
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) */
 
 #endif /* LINUX_3_2_COMPAT_H */