[PATCH 0/4] use BIT() macro instead manually shifting bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux