]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
batman-adv: main, Convert is_my_mac() to bool
authorMarkus Pargmann <mpa@pengutronix.de>
Fri, 26 Dec 2014 11:41:38 +0000 (12:41 +0100)
committerAntonio Quartulli <antonio@meshcoding.com>
Wed, 3 Jun 2015 13:57:24 +0000 (15:57 +0200)
It is much clearer to see a bool type as return value than 'int' for
functions that are supposed to return true or false.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
net/batman-adv/main.c
net/batman-adv/main.h

index fd9333dffc97182631c29fc91d0b9357c7804d32..a22247a61d3ef185741b8d6aa7793597f769d4f9 100644 (file)
@@ -209,10 +209,13 @@ void batadv_mesh_free(struct net_device *soft_iface)
  * interfaces in the current mesh
  * @bat_priv: the bat priv with all the soft interface information
  * @addr: the address to check
+ *
+ * Returns 'true' if the mac address was found, false otherwise.
  */
-int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr)
+bool batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr)
 {
        const struct batadv_hard_iface *hard_iface;
+       bool is_my_mac = false;
 
        rcu_read_lock();
        list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
@@ -223,12 +226,12 @@ int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr)
                        continue;
 
                if (batadv_compare_eth(hard_iface->net_dev->dev_addr, addr)) {
-                       rcu_read_unlock();
-                       return 1;
+                       is_my_mac = true;
+                       break;
                }
        }
        rcu_read_unlock();
-       return 0;
+       return is_my_mac;
 }
 
 /**
index 026ba37f31a6b061b2831d604124df0c5ddc4ce8..96876d29f952d76dc0ee843a756c9a1bf043170e 100644 (file)
@@ -195,7 +195,7 @@ extern struct workqueue_struct *batadv_event_workqueue;
 
 int batadv_mesh_init(struct net_device *soft_iface);
 void batadv_mesh_free(struct net_device *soft_iface);
-int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr);
+bool batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr);
 struct batadv_hard_iface *
 batadv_seq_print_text_primary_if_get(struct seq_file *seq);
 int batadv_max_header_len(void);