Commit 8feedbb4a710784d2858acba5c90e903e93e36eb

Authored by Joe Perches
Committed by David S. Miller
1 parent 4c764729ab

dsa: Convert compare_ether_addr to ether_addr_equal

Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.

Done via cocci script:

$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
-	!compare_ether_addr(a, b)
+	ether_addr_equal(a, b)

@@
expression a,b;
@@
-	compare_ether_addr(a, b)
+	!ether_addr_equal(a, b)

@@
expression a,b;
@@
-	!ether_addr_equal(a, b) == 0
+	ether_addr_equal(a, b)

@@
expression a,b;
@@
-	!ether_addr_equal(a, b) != 0
+	!ether_addr_equal(a, b)

@@
expression a,b;
@@
-	ether_addr_equal(a, b) == 0
+	!ether_addr_equal(a, b)

@@
expression a,b;
@@
-	ether_addr_equal(a, b) != 0
+	ether_addr_equal(a, b)

@@
expression a,b;
@@
-	!!ether_addr_equal(a, b)
+	ether_addr_equal(a, b)

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 5 additions and 5 deletions Side-by-side Diff

... ... @@ -66,7 +66,7 @@
66 66 if (!(master->flags & IFF_UP))
67 67 return -ENETDOWN;
68 68  
69   - if (compare_ether_addr(dev->dev_addr, master->dev_addr)) {
  69 + if (!ether_addr_equal(dev->dev_addr, master->dev_addr)) {
70 70 err = dev_uc_add(master, dev->dev_addr);
71 71 if (err < 0)
72 72 goto out;
... ... @@ -89,7 +89,7 @@
89 89 if (dev->flags & IFF_ALLMULTI)
90 90 dev_set_allmulti(master, -1);
91 91 del_unicast:
92   - if (compare_ether_addr(dev->dev_addr, master->dev_addr))
  92 + if (!ether_addr_equal(dev->dev_addr, master->dev_addr))
93 93 dev_uc_del(master, dev->dev_addr);
94 94 out:
95 95 return err;
... ... @@ -107,7 +107,7 @@
107 107 if (dev->flags & IFF_PROMISC)
108 108 dev_set_promiscuity(master, -1);
109 109  
110   - if (compare_ether_addr(dev->dev_addr, master->dev_addr))
  110 + if (!ether_addr_equal(dev->dev_addr, master->dev_addr))
111 111 dev_uc_del(master, dev->dev_addr);
112 112  
113 113 return 0;
114 114  
... ... @@ -146,13 +146,13 @@
146 146 if (!(dev->flags & IFF_UP))
147 147 goto out;
148 148  
149   - if (compare_ether_addr(addr->sa_data, master->dev_addr)) {
  149 + if (!ether_addr_equal(addr->sa_data, master->dev_addr)) {
150 150 err = dev_uc_add(master, addr->sa_data);
151 151 if (err < 0)
152 152 return err;
153 153 }
154 154  
155   - if (compare_ether_addr(dev->dev_addr, master->dev_addr))
  155 + if (!ether_addr_equal(dev->dev_addr, master->dev_addr))
156 156 dev_uc_del(master, dev->dev_addr);
157 157  
158 158 out: