Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e42e474 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller
Browse files

drivers/net: 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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 39f1d94d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1961,7 +1961,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
	write_lock_bh(&bond->lock);

	if (!bond->params.fail_over_mac) {
		if (!compare_ether_addr(bond_dev->dev_addr, slave->perm_hwaddr) &&
		if (ether_addr_equal(bond_dev->dev_addr, slave->perm_hwaddr) &&
		    bond->slave_cnt > 1)
			pr_warning("%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n",
				   bond_dev->name, slave_dev->name,
+2 −1
Original line number Diff line number Diff line
@@ -1079,7 +1079,8 @@ static int depca_rx(struct net_device *dev)
						} else {
							lp->pktStats.multicast++;
						}
					} else if (compare_ether_addr(buf, dev->dev_addr) == 0) {
					} else if (ether_addr_equal(buf,
								    dev->dev_addr)) {
						lp->pktStats.unicast++;
					}

+4 −8
Original line number Diff line number Diff line
@@ -944,8 +944,7 @@ static void enic_update_multicast_addr_list(struct enic *enic)

	for (i = 0; i < enic->mc_count; i++) {
		for (j = 0; j < mc_count; j++)
			if (compare_ether_addr(enic->mc_addr[i],
				mc_addr[j]) == 0)
			if (ether_addr_equal(enic->mc_addr[i], mc_addr[j]))
				break;
		if (j == mc_count)
			enic_dev_del_addr(enic, enic->mc_addr[i]);
@@ -953,8 +952,7 @@ static void enic_update_multicast_addr_list(struct enic *enic)

	for (i = 0; i < mc_count; i++) {
		for (j = 0; j < enic->mc_count; j++)
			if (compare_ether_addr(mc_addr[i],
				enic->mc_addr[j]) == 0)
			if (ether_addr_equal(mc_addr[i], enic->mc_addr[j]))
				break;
		if (j == enic->mc_count)
			enic_dev_add_addr(enic, mc_addr[i]);
@@ -999,8 +997,7 @@ static void enic_update_unicast_addr_list(struct enic *enic)

	for (i = 0; i < enic->uc_count; i++) {
		for (j = 0; j < uc_count; j++)
			if (compare_ether_addr(enic->uc_addr[i],
				uc_addr[j]) == 0)
			if (ether_addr_equal(enic->uc_addr[i], uc_addr[j]))
				break;
		if (j == uc_count)
			enic_dev_del_addr(enic, enic->uc_addr[i]);
@@ -1008,8 +1005,7 @@ static void enic_update_unicast_addr_list(struct enic *enic)

	for (i = 0; i < uc_count; i++) {
		for (j = 0; j < enic->uc_count; j++)
			if (compare_ether_addr(uc_addr[i],
				enic->uc_addr[j]) == 0)
			if (ether_addr_equal(uc_addr[i], enic->uc_addr[j]))
				break;
		if (j == enic->uc_count)
			enic_dev_add_addr(enic, uc_addr[i]);
+2 −1
Original line number Diff line number Diff line
@@ -1016,7 +1016,8 @@ static int ewrk3_rx(struct net_device *dev)
							} else {
								lp->pktStats.multicast++;
							}
						} else if (compare_ether_addr(p, dev->dev_addr) == 0) {
						} else if (ether_addr_equal(p,
									    dev->dev_addr)) {
							lp->pktStats.unicast++;
						}
						lp->pktStats.bins[0]++;		/* Duplicates stats.rx_packets */
+1 −1
Original line number Diff line number Diff line
@@ -1874,7 +1874,7 @@ de4x5_local_stats(struct net_device *dev, char *buf, int pkt_len)
	} else {
	    lp->pktStats.multicast++;
	}
    } else if (compare_ether_addr(buf, dev->dev_addr) == 0) {
    } else if (ether_addr_equal(buf, dev->dev_addr)) {
        lp->pktStats.unicast++;
    }

Loading