diff options
author | Andrew Lunn <andrew@lunn.ch> | 2010-01-02 11:30:50 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-03 16:42:36 -0800 |
commit | b9b27e4ef6313449a6b40a21e0e9a1bdd9a1d8ce (patch) | |
tree | 0d2e1b9b1e7ae93cf0444e3e0bb5152cc939ec42 /drivers/staging/batman-adv/compat.h | |
parent | a9c2910aa15c5b2559e80d1406176f8456d3e34e (diff) | |
download | linux-b9b27e4ef6313449a6b40a21e0e9a1bdd9a1d8ce.tar.bz2 |
Staging: batman-adv: Use printk(%pM) for MAC addresses
printk() since kernel version 2.6.29 has supported printing MAC
addresses directly, as an extension to the %p processing. This patch
makes use of this for printk() and bat_dbg(). This will remove the
overhead of using addr_to_string() which is normally never actually
output.
Fixed a typo found by Gus Wirth.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv/compat.h')
-rw-r--r-- | drivers/staging/batman-adv/compat.h | 82 |
1 files changed, 64 insertions, 18 deletions
diff --git a/drivers/staging/batman-adv/compat.h b/drivers/staging/batman-adv/compat.h index f4e0a4564ba7..ded1e6e15240 100644 --- a/drivers/staging/batman-adv/compat.h +++ b/drivers/staging/batman-adv/compat.h @@ -35,41 +35,87 @@ #define list_first_entry(ptr, type, member) \ list_entry((ptr)->next, type, member) -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) */ +#define skb_mac_header(_skb) \ + ((_skb)->mac.raw) +#define skb_network_header(_skb) \ + ((_skb)->nh.raw) + +#define skb_mac_header(_skb) \ + ((_skb)->mac.raw) + +#endif /* < KERNEL_VERSION(2,6,22) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) + +static inline int skb_clone_writable(struct sk_buff *skb, unsigned int len) +{ + /* skb->hdr_len not available, just "not writable" to enforce a copy */ + return 0; +} + +#define cancel_delayed_work_sync(wq) cancel_rearming_delayed_work(wq) + +#endif /* < KERNEL_VERSION(2, 6, 23) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) + +#define strict_strtoul(cp, base, res) \ + ({ \ + int ret = 0; \ + char *endp; \ + *res = simple_strtoul(cp, &endp, base); \ + if (cp == endp) \ + ret = -EINVAL; \ + ret; \ +}) + +#endif /* < KERNEL_VERSION(2, 6, 25) */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) +static const char hex_asc[] = "0123456789abcdef"; +#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] +#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4] +static inline char *pack_hex_byte(char *buf, u8 byte) +{ + *buf++ = hex_asc_hi(byte); + *buf++ = hex_asc_lo(byte); + return buf; +} + #define device_create(_cls, _parent, _devt, _device, _fmt) \ class_device_create(_cls, _parent, _devt, _device, _fmt) #define device_destroy(_cls, _device) \ class_device_destroy(_cls, _device) -#else +#endif /* < KERNEL_VERSION(2, 6, 26) */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +#ifndef dereference_function_descriptor +#define dereference_function_descriptor(p) (p) +#endif + +#ifndef device_create #define device_create(_cls, _parent, _devt, _device, _fmt) \ device_create_drvdata(_cls, _parent, _devt, _device, _fmt) +#endif -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) */ +#endif /* < KERNEL_VERSION(2, 6, 27) */ -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) +asmlinkage int bat_printk(const char *fmt, ...); +#define printk bat_printk -#define cancel_delayed_work_sync(wq) cancel_rearming_delayed_work(wq) +static inline struct net_device_stats *dev_get_stats(struct net_device *dev) +{ + if (dev->get_stats) + return dev->get_stats(dev); + else + return NULL; +} -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) -#define strict_strtoul(cp, base, res) \ - ({ \ - int ret = 0; \ - char *endp; \ - *res = simple_strtoul(cp, &endp, base); \ - if (cp == endp) \ - ret = -EINVAL; \ - ret; \ -}) -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) */ +#endif /* < KERNEL_VERSION(2, 6, 29) */ |