ozwpan: slight optimization of addr compare
authordingtianhong <dingtianhong@huawei.com>
Thu, 26 Dec 2013 11:40:47 +0000 (19:40 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Dec 2013 18:31:34 +0000 (13:31 -0500)
Use possibly more efficient ether_addr_equal
instead of memcmp.

Cc: Rupesh Gujare <rupesh.gujare@atmel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/staging/ozwpan/ozcdev.c
drivers/staging/ozwpan/ozproto.c

index 6ce0af9977d8c0ccc053e98eb818a98ec8d990f7..5de5981b3bba9330c33dc1420deb011730bfefec 100644 (file)
@@ -448,7 +448,7 @@ int oz_cdev_start(struct oz_pd *pd, int resume)
        }
        spin_lock(&g_cdev.lock);
        if ((g_cdev.active_pd == NULL) &&
-               (memcmp(pd->mac_addr, g_cdev.active_addr, ETH_ALEN) == 0)) {
+               ether_addr_equal(pd->mac_addr, g_cdev.active_addr)) {
                oz_pd_get(pd);
                g_cdev.active_pd = pd;
                oz_dbg(ON, "Active PD arrived\n");
index 88714ec85705f3a771edb4ecc740d06a1a8bc452..19a2521ee17929893824ce74fe5d08b188225022 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/timer.h>
 #include <linux/sched.h>
 #include <linux/netdevice.h>
+#include <linux/etherdevice.h>
 #include <linux/errno.h>
 #include <linux/ieee80211.h>
 #include "ozdbg.h"
@@ -180,7 +181,7 @@ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt,
                spin_lock_bh(&g_polling_lock);
                list_for_each(e, &g_pd_list) {
                        pd2 = container_of(e, struct oz_pd, link);
-                       if (memcmp(pd2->mac_addr, pd_addr, ETH_ALEN) == 0) {
+                       if (ether_addr_equal(pd2->mac_addr, pd_addr)) {
                                free_pd = pd;
                                pd = pd2;
                                break;
@@ -597,7 +598,7 @@ struct oz_pd *oz_pd_find(const u8 *mac_addr)
        spin_lock_bh(&g_polling_lock);
        list_for_each(e, &g_pd_list) {
                pd = container_of(e, struct oz_pd, link);
-               if (memcmp(pd->mac_addr, mac_addr, ETH_ALEN) == 0) {
+               if (ether_addr_equal(pd->mac_addr, mac_addr)) {
                        atomic_inc(&pd->ref_count);
                        spin_unlock_bh(&g_polling_lock);
                        return pd;