diff options
author | Joe Perches <joe@perches.com> | 2012-05-08 14:56:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-09 20:49:19 -0400 |
commit | 8feedbb4a710784d2858acba5c90e903e93e36eb (patch) | |
tree | d8a23fc9414b5ce994bd23426844a56afecb3fc5 /net/dsa | |
parent | 4c764729aba365796c09d988f53043891f822acb (diff) |
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>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 56cf9b8e1c7c..e32083d5d8f8 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -66,7 +66,7 @@ static int dsa_slave_open(struct net_device *dev) | |||
66 | if (!(master->flags & IFF_UP)) | 66 | if (!(master->flags & IFF_UP)) |
67 | return -ENETDOWN; | 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 | err = dev_uc_add(master, dev->dev_addr); | 70 | err = dev_uc_add(master, dev->dev_addr); |
71 | if (err < 0) | 71 | if (err < 0) |
72 | goto out; | 72 | goto out; |
@@ -89,7 +89,7 @@ clear_allmulti: | |||
89 | if (dev->flags & IFF_ALLMULTI) | 89 | if (dev->flags & IFF_ALLMULTI) |
90 | dev_set_allmulti(master, -1); | 90 | dev_set_allmulti(master, -1); |
91 | del_unicast: | 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 | dev_uc_del(master, dev->dev_addr); | 93 | dev_uc_del(master, dev->dev_addr); |
94 | out: | 94 | out: |
95 | return err; | 95 | return err; |
@@ -107,7 +107,7 @@ static int dsa_slave_close(struct net_device *dev) | |||
107 | if (dev->flags & IFF_PROMISC) | 107 | if (dev->flags & IFF_PROMISC) |
108 | dev_set_promiscuity(master, -1); | 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 | dev_uc_del(master, dev->dev_addr); | 111 | dev_uc_del(master, dev->dev_addr); |
112 | 112 | ||
113 | return 0; | 113 | return 0; |
@@ -146,13 +146,13 @@ static int dsa_slave_set_mac_address(struct net_device *dev, void *a) | |||
146 | if (!(dev->flags & IFF_UP)) | 146 | if (!(dev->flags & IFF_UP)) |
147 | goto out; | 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 | err = dev_uc_add(master, addr->sa_data); | 150 | err = dev_uc_add(master, addr->sa_data); |
151 | if (err < 0) | 151 | if (err < 0) |
152 | return err; | 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 | dev_uc_del(master, dev->dev_addr); | 156 | dev_uc_del(master, dev->dev_addr); |
157 | 157 | ||
158 | out: | 158 | out: |