[v2] batman-adv: fix compat for Debian Wheezy kernel v3.2.39

Message ID 01f2a6ce4ab512c60760ce0275100750c5cd59bc.1363431558.git.mschiffer@universe-factory.net (mailing list archive)
State Superseded, archived
Headers

Commit Message

Matthias Schiffer March 16, 2013, 10:59 a.m. UTC
  Starting with kernel v3.2.39, a Debian specific patch defines
eth_hw_addr_random() in include/linux/etherdevice.h, causing the build of
batman-adv to fail.

This patch fixes the build on these kernels while keeping compatiblity with
unpatched kernels by replacing batman-adv's compat definition of the
eth_hw_addr_random() function with a #define macro.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
---
v2: fix commit message

 compat.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
  

Comments

Marek Lindner March 16, 2013, 11:10 a.m. UTC | #1
On Saturday, March 16, 2013 18:59:55 Matthias Schiffer wrote:
> @@ -174,10 +174,7 @@ static inline void skb_reset_mac_len(struct sk_buff
> *skb) 
>  #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
>  
> -static inline void eth_hw_addr_random(struct net_device *dev)
> -{
> -       random_ether_addr(dev->dev_addr);
> -}
> +#define eth_hw_addr_random(dev) random_ether_addr((dev)->dev_addr)
>  
>  #endif /* < KERNEL_VERSION(3, 4, 0) */

How about re-defining the function name and keep the static inline ? There are 
numerous examples of this in the compat.h file, for instance 
batadv_this_cpu_add().

We also might want a comment there that we do this for Debian compat. 

Cheers,
Marek
  

Patch

diff --git a/compat.h b/compat.h
index e1c6cd2..46baf6c 100644
--- a/compat.h
+++ b/compat.h
@@ -174,10 +174,7 @@  static inline void skb_reset_mac_len(struct sk_buff *skb)
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
 
-static inline void eth_hw_addr_random(struct net_device *dev)
-{
-	random_ether_addr(dev->dev_addr);
-}
+#define eth_hw_addr_random(dev) random_ether_addr((dev)->dev_addr)
 
 #endif /* < KERNEL_VERSION(3, 4, 0) */