gpio: 74xx-mmio: Use bits instead of plain numbers for flags
PATCH 1/1 gpio: 74xx-mmio: Use bits instead of plain numbers for flags
The initial code was misleading to use bitwise AND against plain number, and the commit d3054ba1db62 ("gpio: 74xx-mmio: Check MMIO_74XX_DIR_IN flag in mmio_74xx_dir_in()") missed that. Switch definitions to be defined bits for the correct comparison.
Fixes d3054ba1db62 ("gpio: 74xx-mmio: Check MMIO_74XX_DIR_IN flag in mmio_74xx_dir_in()")
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/gpio/gpio-74xx-mmio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-74xx-mmio.c +2 -2
@@ -13,8 +13,8 @@#include <linux/platform_device.h> #include <linux/property.h> -#define MMIO_74XX_DIR_IN (0 << 8) -#define MMIO_74XX_DIR_OUT (1 << 8) +#define MMIO_74XX_DIR_IN BIT(8) +#define MMIO_74XX_DIR_OUT BIT(9)#define MMIO_74XX_BIT_CNT (x) ((x) & GENMASK(7, 0))struct mmio_74xx_gpio_priv {
Signature · 1 line
2.35.1
Bartosz Golaszewski
AppliedQuoted 29 lines · Andy Shevchenko
The initial code was misleading to use bitwise AND against plain number, and the commit
d3054ba1db62("gpio: 74xx-mmio: CheckMMIO_74XX_DIR_INflag inmmio_74xx_dir_in()") missed that. Switch definitions to be defined bits for the correct comparison.Fixes d3054ba1db62 ("gpio: 74xx-mmio: Check MMIO_74XX_DIR_IN flag in mmio_74xx_dir_in()")Reported-by Dan Carpenter <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpio/gpio-74xx-mmio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpio/gpio-74xx-mmio.c +2
-3@@ -13,8 +13,8 @@#include <linux/platform_device.h> #include <linux/property.h> -#define MMIO_74XX_DIR_IN (0 << 8) -#define MMIO_74XX_DIR_OUT (1 << 8) +#define MMIO_74XX_DIR_IN BIT(8) +#define MMIO_74XX_DIR_OUT BIT(9)#define MMIO_74XX_BIT_CNT (x) ((x) & GENMASK(7, 0))struct mmio_74xx_gpio_priv { --
Quoted 2 lines
2.35.1
Applied, thanks!
Bart