Netdev List
 help / color / mirror / Atom feed
From: Himanshu Jha <himanshujha199640@gmail.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: amitkarwar@gmail.com, nishants@marvell.com, gbhat@marvell.com,
	huxm@marvell.com, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mwifiex: Use put_unaligned_le32
Date: Thu, 5 Oct 2017 14:04:33 +0530	[thread overview]
Message-ID: <20171005083433.GA11485@himanshu-Vostro-3559> (raw)
In-Reply-To: <874lre5a86.fsf@codeaurora.org>

On Thu, Oct 05, 2017 at 10:23:37AM +0300, Kalle Valo wrote:
> Himanshu Jha <himanshujha199640@gmail.com> writes:
> 
> > Use put_unaligned_le32 rather than using byte ordering function and
> > memcpy which makes code clear.
> > Also, add the header file where it is declared.
> >
> > Done using Coccinelle and semantic patch used is :
> >
> > @ rule1 @
> > identifier tmp; expression ptr,x; type T;
> > @@
> >
> > - tmp = cpu_to_le32(x);
> >
> >   <+... when != tmp
> > - memcpy(ptr, (T)&tmp, ...);
> > + put_unaligned_le32(x,ptr);
> >   ...+>
> >
> > @ depends on rule1 @
> > type j; identifier tmp;
> > @@
> >
> > - j tmp;
> >   ...when != tmp
> >
> > Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> > ---
> >  drivers/net/wireless/marvell/mwifiex/cmdevt.c | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> > index 0edc5d6..e28e119 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> > +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> > @@ -17,6 +17,7 @@
> >   * this warranty disclaimer.
> >   */
> >  
> > +#include <linux/unaligned/access_ok.h>
> 
> I don't think this is correct. Should it be asm/unaligned.h?

Would mind explainig me as to why it is incorrect! Also, it defined in
both the header files but, why is asm/unaligned.h preferred ?

Thanks

> -- 
> Kalle Valo

  reply	other threads:[~2017-10-05  8:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04 18:28 [PATCH] mwifiex: Use put_unaligned_le32 Himanshu Jha
2017-10-05  7:23 ` Kalle Valo
2017-10-05  8:34   ` Himanshu Jha [this message]
2017-10-05  8:41     ` Kalle Valo
2017-10-05 15:22       ` Himanshu Jha
2017-10-05 18:02         ` Brian Norris
2017-10-05 19:07           ` Himanshu Jha
2017-10-05 21:54             ` Igor Mitsyanko
2017-10-06 13:31             ` Kalle Valo
2017-10-07  3:31 ` kbuild test robot
2017-10-07  5:17 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171005083433.GA11485@himanshu-Vostro-3559 \
    --to=himanshujha199640@gmail.com \
    --cc=amitkarwar@gmail.com \
    --cc=gbhat@marvell.com \
    --cc=huxm@marvell.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nishants@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox