Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756953AbaAHQEz (ORCPT ); Wed, 8 Jan 2014 11:04:55 -0500 Received: from eusmtp01.atmel.com ([212.144.249.242]:36855 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755750AbaAHQEx (ORCPT ); Wed, 8 Jan 2014 11:04:53 -0500 Message-ID: <52CD771B.4030201@atmel.com> Date: Wed, 8 Jan 2014 16:04:43 +0000 From: Rupesh Gujare User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Ding Tianhong , Greg Kroah-Hartman , , Netdev , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3.6 08/19] ozwpan: slight optimization of addr compare References: <52CCBDB0.9060709@huawei.com> In-Reply-To: <52CCBDB0.9060709@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.161.30.18] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/01/14 02:53, Ding Tianhong wrote: > Use possibly more efficient ether_addr_equal > instead of memcmp. > > Cc: Rupesh Gujare > Cc: Greg Kroah-Hartman > Cc: devel@driverdev.osuosl.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Tan Xiaojun > Signed-off-by: Ding Tianhong > --- > drivers/staging/ozwpan/ozcdev.c | 2 +- > drivers/staging/ozwpan/ozproto.c | 5 +++-- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c > index 6ce0af9..c363f66 100644 > --- a/drivers/staging/ozwpan/ozcdev.c > +++ b/drivers/staging/ozwpan/ozcdev.c > @@ -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"); > diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c > index 88714ec..19a2521 100644 > --- a/drivers/staging/ozwpan/ozproto.c > +++ b/drivers/staging/ozwpan/ozproto.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include > #include > #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; Acked-by: Rupesh Gujare Thanks, -- Regards, Rupesh Gujare -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/