linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Courbot <gnurou@gmail.com>
To: Javier Martinez Canillas <javier@dowhile0.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	inux-omap@vger.kernel.org
Subject: Re: [PATCH 0/4] use BIT() macro instead manually shifting bits
Date: Sun, 27 Apr 2014 19:16:52 +0900	[thread overview]
Message-ID: <CAAVeFu+-XiOGu4Bpm_Naa+GDd4t8xiMwKGQxzpgCKCdmtjOMyA@mail.gmail.com> (raw)
In-Reply-To: <1398556850-27751-1-git-send-email-javier@dowhile0.org>

On Sun, Apr 27, 2014 at 9:00 AM, Javier Martinez Canillas
<javier@dowhile0.org> wrote:
> Hello Linus and Alexandre,
>
> While learning coccinelle towards doing the big gpio_chip/gpio_chip_ops
> split refactoring I wrote this trivial semantic patch that replaces a
> manual bit shift by using the BIT macro from <linux/bitops.h>
>
>     @hasbitops@
>     @@
>
>     #include <linux/bitops.h>
>
>     @depends on hasbitops@
>     expression E;
>     @@
>
>     - 1 << E
>     + BIT(E)
>
>     @depends on hasbitops@
>     expression E;
>     @@
>
>     - BIT((E))
>     + BIT(E)
>
> When applying to the drivers/gpio subdirectory I got
> the following clean up patches for some GPIO drivers.

I personally find "1 << n" easier to read than a macro, but you are
right that the macro is less error-prone. Nice use of Coccinelle btw,
I should really spend the time to learn it.

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

  parent reply	other threads:[~2014-04-27 10:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-27  0:00 [PATCH 0/4] use BIT() macro instead manually shifting bits Javier Martinez Canillas
2014-04-27  0:00 ` [PATCH 1/4] gpio: em: " Javier Martinez Canillas
2014-04-27  0:00 ` [PATCH 2/4] gpio: kempld: " Javier Martinez Canillas
2014-04-27  0:00 ` [PATCH 3/4] gpio: omap: " Javier Martinez Canillas
2014-04-27  0:00 ` [PATCH 4/4] gpio: pl061: " Javier Martinez Canillas
2014-04-27 10:16 ` Alexandre Courbot [this message]
2014-04-27 10:46   ` [PATCH 0/4] " Javier Martinez Canillas
2014-04-27 11:16     ` Alexandre Courbot
2014-04-27 11:48       ` Javier Martinez Canillas
2014-05-03 19:15 ` Linus Walleij
2014-05-05 11:02   ` Javier Martinez Canillas

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=CAAVeFu+-XiOGu4Bpm_Naa+GDd4t8xiMwKGQxzpgCKCdmtjOMyA@mail.gmail.com \
    --to=gnurou@gmail.com \
    --cc=inux-omap@vger.kernel.org \
    --cc=javier@dowhile0.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=santosh.shilimkar@ti.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;
as well as URLs for NNTP newsgroup(s).