linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] use BIT() macro instead manually shifting bits
@ 2014-04-27  0:00 Javier Martinez Canillas
  2014-04-27  0:00 ` [PATCH 1/4] gpio: em: " Javier Martinez Canillas
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2014-04-27  0:00 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Courbot, Santosh Shilimkar, linux-gpio, inux-omap,
	Javier Martinez Canillas

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.

Javier Martinez Canillas (4):
  gpio: em: use BIT() macro instead manually shifting bits
  gpio: kempld: use BIT() macro instead manually shifting bits
  gpio: omap: use BIT() macro instead manually shifting bits
  gpio: pl061: use BIT() macro instead manually shifting bits

 drivers/gpio/gpio-em.c     |  2 +-
 drivers/gpio/gpio-kempld.c |  2 +-
 drivers/gpio/gpio-omap.c   | 50 +++++++++++++++++++++++-----------------------
 drivers/gpio/gpio-pl061.c  | 26 ++++++++++++------------
 4 files changed, 40 insertions(+), 40 deletions(-)

I've only tested the changes on a OMAP3 board but the changes are very
straightforward and that's the advantage of using coccinelle after all.

Best regards,
Javier

-- 
1.9.1


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

end of thread, other threads:[~2014-05-05 11:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 0/4] " Alexandre Courbot
2014-04-27 10:46   ` 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

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