bluetooth: 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>
This commit is contained in:
Joe Perches 2012-05-08 18:56:51 +00:00 committed by David S. Miller
parent 150238ebb4
commit c47fc9814c

View File

@ -69,7 +69,7 @@ static struct bnep_session *__bnep_get_session(u8 *dst)
BT_DBG(""); BT_DBG("");
list_for_each_entry(s, &bnep_session_list, list) list_for_each_entry(s, &bnep_session_list, list)
if (!compare_ether_addr(dst, s->eh.h_source)) if (ether_addr_equal(dst, s->eh.h_source))
return s; return s;
return NULL; return NULL;
@ -422,10 +422,10 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
iv[il++] = (struct kvec) { &type, 1 }; iv[il++] = (struct kvec) { &type, 1 };
len++; len++;
if (compress_src && !compare_ether_addr(eh->h_dest, s->eh.h_source)) if (compress_src && ether_addr_equal(eh->h_dest, s->eh.h_source))
type |= 0x01; type |= 0x01;
if (compress_dst && !compare_ether_addr(eh->h_source, s->eh.h_dest)) if (compress_dst && ether_addr_equal(eh->h_source, s->eh.h_dest))
type |= 0x02; type |= 0x02;
if (type) if (type)