]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
batman-adv: Reduce preprocessor checks in multicast.c
authorSven Eckelmann <sven@narfation.org>
Wed, 22 Feb 2017 16:16:39 +0000 (17:16 +0100)
committerSimon Wunderlich <sw@simonwunderlich.de>
Thu, 16 Mar 2017 20:14:50 +0000 (21:14 +0100)
It is not necessary to disable these code sections in case other kernel
features are disabled. Instead the IS_ENABLED tests can be added directly
in the code and the compiler can remove the unnecessary code parts during
its optimization run.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/multicast.c

index 952ba81a565b611ee0a83fc0bbfb719b54187407..d327670641ac336a14f0ecc85dd848d4952e8e6e 100644 (file)
@@ -494,9 +494,8 @@ static bool batadv_mcast_mla_tvlv_update(struct batadv_priv *bat_priv)
        if (!bridged)
                goto update;
 
-#if !IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING)
-       pr_warn_once("No bridge IGMP snooping compiled - multicast optimizations disabled\n");
-#endif
+       if (!IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING))
+               pr_warn_once("No bridge IGMP snooping compiled - multicast optimizations disabled\n");
 
        querier4.exists = br_multicast_has_querier_anywhere(dev, ETH_P_IP);
        querier4.shadowing = br_multicast_has_querier_adjacent(dev, ETH_P_IP);
@@ -671,7 +670,6 @@ static int batadv_mcast_forw_mode_check_ipv4(struct batadv_priv *bat_priv,
        return 0;
 }
 
-#if IS_ENABLED(CONFIG_IPV6)
 /**
  * batadv_mcast_is_report_ipv6 - check for MLD reports
  * @skb: the ethernet frame destined for the mesh
@@ -736,7 +734,6 @@ static int batadv_mcast_forw_mode_check_ipv6(struct batadv_priv *bat_priv,
 
        return 0;
 }
-#endif
 
 /**
  * batadv_mcast_forw_mode_check - check for optimized forwarding potential
@@ -765,11 +762,12 @@ static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv,
        case ETH_P_IP:
                return batadv_mcast_forw_mode_check_ipv4(bat_priv, skb,
                                                         is_unsnoopable);
-#if IS_ENABLED(CONFIG_IPV6)
        case ETH_P_IPV6:
+               if (!IS_ENABLED(CONFIG_IPV6))
+                       return -EINVAL;
+
                return batadv_mcast_forw_mode_check_ipv6(bat_priv, skb,
                                                         is_unsnoopable);
-#endif
        default:
                return -EINVAL;
        }