[v2,02/12] batman-adv: compat.h: Add workaround for get_link_net()

Message ID 1461970765-24615-3-git-send-email-andrew@lunn.ch (mailing list archive)
State Superseded, archived
Delegated to: Marek Lindner
Headers

Commit Message

Andrew Lunn April 29, 2016, 10:59 p.m. UTC
  Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 compat.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Comments

Sven Eckelmann April 30, 2016, 10 a.m. UTC | #1
On Saturday 30 April 2016 00:59:15 Andrew Lunn wrote:
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  compat.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/compat.h b/compat.h
> index 5a5f478..f746163 100644
> --- a/compat.h
> +++ b/compat.h
> @@ -137,9 +137,15 @@ static int __batadv_interface_kill_vid(struct
> net_device *dev, __be16 proto,\ #warning cfg80211 based throughput metric
> is only supported with Linux 3.15+
> 
>  #endif
> -
>  #endif /* < KERNEL_VERSION(3, 15, 0) */
> 
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
> +
> +/* WARNING for batadv_getlink_net */
> +#define get_link_net get_xstats_size || 1 ||
> netdev->rtnl_link_ops->get_xstats_size +
> +#endif /* < KERNEL_VERSION(4, 0, 0) */
> +
>  #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
> 
>  #define IFF_NO_QUEUE	0; dev->tx_queue_len = 0

This cannot work because you've modified the initial patch
and used parts of your old patch again.

    /qemu-batman/batman-adv/net/batman-adv/hard-interface.c: In function ‘batadv_getlink_net’:
    /qemu-batman/batman-adv/net/batman-adv/hard-interface.c:104:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
      return netdev->rtnl_link_ops->get_link_net(netdev);
             ^
    /qemu-batman/batman-adv/net/batman-adv/hard-interface.c: In function ‘batadv_mutual_parents’:
    /qemu-batman/batman-adv/net/batman-adv/hard-interface.c:131:26: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
      if (dev1->rtnl_link_ops && dev1->rtnl_link_ops->get_link_net)
                              ^
    In file included from <command-line>:0:0:
    /qemu-batman/batman-adv/compat.h:151:46: error: ‘netdev’ undeclared (first use in this function)
     #define get_link_net get_xstats_size || 1 || netdev->rtnl_link_ops->get_xstats_size
                                                  ^
    /qemu-batman/batman-adv/net/batman-adv/hard-interface.c:131:50: note: in expansion of macro ‘get_link_net’
      if (dev1->rtnl_link_ops && dev1->rtnl_link_ops->get_link_net)
                                                      ^
    /qemu-batman/batman-adv/compat.h:151:46: note: each undeclared identifier is reported only once for each function it appears in
     #define get_link_net get_xstats_size || 1 || netdev->rtnl_link_ops->get_xstats_size
                                                  ^
    /qemu-batman/batman-adv/net/batman-adv/hard-interface.c:131:50: note: in expansion of macro ‘get_link_net’
      if (dev1->rtnl_link_ops && dev1->rtnl_link_ops->get_link_net)
                                                      ^
    /qemu-batman/batman-adv/net/batman-adv/hard-interface.c:133:26: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
      if (dev2->rtnl_link_ops && dev2->rtnl_link_ops->get_link_net)
                              ^
    /qemu-batman/batman-adv/net/batman-adv/hard-interface.c: In function ‘batadv_is_on_batman_iface’:
    /qemu-batman/batman-adv/net/batman-adv/hard-interface.c:174:29: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
      if (net_dev->rtnl_link_ops && net_dev->rtnl_link_ops->get_link_net)
                                 ^
    In file included from <command-line>:0:0:
    /qemu-batman/batman-adv/compat.h:151:46: error: ‘netdev’ undeclared (first use in this function)
     #define get_link_net get_xstats_size || 1 || netdev->rtnl_link_ops->get_xstats_size
                                                  ^
    /qemu-batman/batman-adv/net/batman-adv/hard-interface.c:174:56: note: in expansion of macro ‘get_link_net’
      if (net_dev->rtnl_link_ops && net_dev->rtnl_link_ops->get_link_net

Kind regards,
	Sven
  
Sven Eckelmann April 30, 2016, 10:04 a.m. UTC | #2
On Saturday 30 April 2016 00:59:15 Andrew Lunn wrote:
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
[...]
> --- a/compat.h
> +++ b/compat.h
> @@ -137,9 +137,15 @@ static int __batadv_interface_kill_vid(struct
> net_device *dev, __be16 proto,\ #warning cfg80211 based throughput metric
> is only supported with Linux 3.15+
> 
>  #endif
> -
>  #endif /* < KERNEL_VERSION(3, 15, 0) */

And this line removal is also most likely just an accident.

Kind regards,
	Sven
  

Patch

diff --git a/compat.h b/compat.h
index 5a5f478..f746163 100644
--- a/compat.h
+++ b/compat.h
@@ -137,9 +137,15 @@  static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
 #warning cfg80211 based throughput metric is only supported with Linux 3.15+
 
 #endif
-
 #endif /* < KERNEL_VERSION(3, 15, 0) */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
+
+/* WARNING for batadv_getlink_net */
+#define get_link_net get_xstats_size || 1 || netdev->rtnl_link_ops->get_xstats_size
+
+#endif /* < KERNEL_VERSION(4, 0, 0) */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
 
 #define IFF_NO_QUEUE	0; dev->tx_queue_len = 0