From: Luis R. Rodriguez Date: Tue, 31 Jan 2012 22:44:41 +0000 (-0800) Subject: compat: backport __netdev_printk() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=fd3a74e12f687509da0a996b4e01c4fa6ca32ff8;p=openwrt%2Fstaging%2Fblogic.git compat: backport __netdev_printk() This was added in v3.2, and will be used by the new shiny alx Ethernet driver which is not yet upstream. Signed-off-by: Luis R. Rodriguez --- diff --git a/compat/Makefile b/compat/Makefile index fa9c6cb9479e..3c72ef9bf1e7 100644 --- a/compat/Makefile +++ b/compat/Makefile @@ -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 index 000000000000..2e4902fed0f0 --- /dev/null +++ b/compat/compat-3.2.c @@ -0,0 +1,26 @@ +/* + * Copyright 2012 Luis R. Rodriguez + * + * 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. + */ + +int __netdev_printk(const char *level, const struct net_device *dev, + struct va_format *vaf) +{ + int r; + + if (dev && dev->dev.parent) + r = dev_printk(level, dev->dev.parent, "%s: %pV", + netdev_name(dev), vaf); + 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); diff --git a/include/linux/compat-3.2.h b/include/linux/compat-3.2.h index a17c4adf2158..cb14f0b12042 100644 --- a/include/linux/compat-3.2.h +++ b/include/linux/compat-3.2.h @@ -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 */