mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Himanshu Jha <himanshujha199640@gmail.com>
Cc: bianpan2016@163.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb: wusbcore: Use put_unaligned_le32
Date: Tue, 17 Oct 2017 11:51:14 +0200	[thread overview]
Message-ID: <20171017095114.GA19685@kroah.com> (raw)
In-Reply-To: <1507302487-4004-1-git-send-email-himanshujha199640@gmail.com>

On Fri, Oct 06, 2017 at 08:38:07PM +0530, Himanshu Jha wrote:
> 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>
> ---
> v2:
> * added correct header file.
> 
>  drivers/usb/wusbcore/security.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c
> index 170f2c3..256b56f 100644
> --- a/drivers/usb/wusbcore/security.c
> +++ b/drivers/usb/wusbcore/security.c
> @@ -22,6 +22,7 @@
>   *
>   * FIXME: docs
>   */
> +#include <asm/unaligned.h>

Ick, really?  asm/ ?  As the first include?  That feels wrong, at the
very least, it needs to be at the end of the include list please.

thanks,

greg k-h

  reply	other threads:[~2017-10-17  9:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 15:08 Himanshu Jha
2017-10-17  9:51 ` Greg KH [this message]
2017-10-17 11:50   ` Himanshu Jha
2017-10-17 12:01     ` Greg KH

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=20171017095114.GA19685@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bianpan2016@163.com \
    --cc=himanshujha199640@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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

Powered by JetHome