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

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

 



On Sun, Apr 27, 2014 at 9:00 AM, Javier Martinez Canillas
<javier@xxxxxxxxxxxx> 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@xxxxxxxxxx>
--
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