netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 08/19] ozwpan: slight optimization of addr compare
@ 2013-12-25  3:28 Ding Tianhong
  2013-12-25 10:54 ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Ding Tianhong @ 2013-12-25  3:28 UTC (permalink / raw)
  To: Rupesh Gujare, Greg Kroah-Hartman, devel, Netdev,
	linux-kernel@vger.kernel.org

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>
---
 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 <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;
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 08/19] ozwpan: slight optimization of addr compare
  2013-12-25  3:28 [PATCH v3 08/19] ozwpan: slight optimization of addr compare Ding Tianhong
@ 2013-12-25 10:54 ` Sergei Shtylyov
  2013-12-26  8:35   ` Ding Tianhong
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2013-12-25 10:54 UTC (permalink / raw)
  To: Ding Tianhong, Rupesh Gujare, Greg Kroah-Hartman, devel, Netdev,
	linux-kernel@vger.kernel.org

Hello.

On 25-12-2013 7:28, Ding Tianhong wrote:

> 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>
> ---
>   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))) {

    There's no point in enclosing function call into parens.

WBR, Sergei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 08/19] ozwpan: slight optimization of addr compare
  2013-12-25 10:54 ` Sergei Shtylyov
@ 2013-12-26  8:35   ` Ding Tianhong
  0 siblings, 0 replies; 3+ messages in thread
From: Ding Tianhong @ 2013-12-26  8:35 UTC (permalink / raw)
  To: Sergei Shtylyov, Rupesh Gujare, Greg Kroah-Hartman, devel, Netdev,
	linux-kernel@vger.kernel.org

On 2013/12/25 18:54, Sergei Shtylyov wrote:
> Hello.
> 
> On 25-12-2013 7:28, Ding Tianhong wrote:
> 
>> 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>
>> ---
>>   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))) {
> 
>    There's no point in enclosing function call into parens.
> 
> WBR, Sergei
> 

ok, thanks.

Regards
Ding
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-26  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-25  3:28 [PATCH v3 08/19] ozwpan: slight optimization of addr compare Ding Tianhong
2013-12-25 10:54 ` Sergei Shtylyov
2013-12-26  8:35   ` Ding Tianhong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).