gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_*
Subsystems (5)
cover gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_*
Shrink the legacy API and definition surface by killing the (internal) definitions. This, in particular, will fix a couple of drivers that took it wrong.
This is assumed to go via BPIOLIB tree as this is quite small series and most of the changes related to it.
Andy Shevchenko (2):
gpiolib: legacy: Kill GPIOF_INIT_* definitions
gpiolib: legacy: Kill GPIOF_DIR_* definitions
arch/arm/mach-ep93xx/vision_ep9307.c | 6 ++---- arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- drivers/gpio/gpiolib-legacy.c | 5 ++--- include/linux/gpio.h | 12 +++--------- 4 files changed, 8 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH 1/2 gpiolib: legacy: Kill GPIOF_INIT_* definitions
Besides the fact that (old) drivers use wrong definitions, e.g., GPIOF_INIT_HIGH instead of GPIOF_OUT_INIT_HIGH, shrink the legacy definitions by killing those GPIOF_INIT_* completely.
--- arch/arm/mach-ep93xx/vision_ep9307.c | 3 +-- arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- drivers/gpio/gpiolib-legacy.c | 3 +-- include/linux/gpio.h | 7 ++----- 4 files changed, 5 insertions(+), 10 deletions(-)
arch/arm/mach-ep93xx/vision_ep9307.c +1 -2
@@ -76,8 +76,7 @@ static int vision_lcd_setup(struct platform_device *pdev) {int err; - err =gpio_request_one (VISION_LCD_ENABLE ,GPIOF_INIT_HIGH , -dev_name (&pdev->dev)); + err =gpio_request_one (VISION_LCD_ENABLE ,GPIOF_OUT_INIT_HIGH ,dev_name (&pdev->dev));if (err)return err;
arch/mips/bcm63xx/boards/board_bcm963xx.c +1 -1
@@ -42,7 +42,7 @@ static struct board_info __initdata board_cvg834g = { .expected_cpu_id = 0x3368, .ephy_reset_gpio = 36, - .ephy_reset_gpio_flags = GPIOF_INIT_HIGH, + .ephy_reset_gpio_flags = GPIOF_OUT_INIT_HIGH, .has_pci = 1, .has_uart0 = 1, .has_uart1 = 1,
drivers/gpio/gpiolib-legacy.c +1 -2
@@ -46,8 +46,7 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)if (flags &GPIOF_DIR_IN ) err =gpiod_direction_input (desc);else - err =gpiod_direction_output_raw (desc, - (flags &GPIOF_INIT_HIGH ) ?1 :0 ); + err =gpiod_direction_output_raw (desc, !!(flags &GPIOF_OUT_INIT_HIGH ));if (err) goto free_gpio;
include/linux/gpio.h +2 -5
@@ -20,12 +20,9 @@ struct device;#define GPIOF_DIR_OUT (0 << 0)#define GPIOF_DIR_IN (1 << 0) -#define GPIOF_INIT_LOW (0 << 1) -#define GPIOF_INIT_HIGH (1 << 1) -#define GPIOF_IN (GPIOF_DIR_IN) -#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) -#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) +#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | (0 << 1)) +#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | (1 << 1))/* Gpio pin is active-low */ #define GPIOF_ACTIVE_LOW (1 << 2)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 1/2] gpiolib: legacy: Kill GPIOF_INIT_* definitions
Quoted 5 lines · Andy Shevchenko
Besides the fact that (old) drivers use wrong definitions, e.g.,
GPIOF_INIT_HIGHinstead ofGPIOF_OUT_INIT_HIGH, shrink the legacy definitions by killing those GPIOF_INIT_* completely.Signed-off-by Andy Shevchenko <[email protected]>
Excellent, thanks Andy.
Yours,
Linus Walleij
PATCH 2/2 gpiolib: legacy: Kill GPIOF_DIR_* definitions
In reply to Andy ShevchenkoBesides the fact that (old) drivers use wrong definitions, e.g., GPIOF_DIR_IN instead of GPIOF_IN, shrink the legacy definitions by killing those GPIOF_DIR_* completely.
--- arch/arm/mach-ep93xx/vision_ep9307.c | 3 +-- drivers/gpio/gpiolib-legacy.c | 2 +- include/linux/gpio.h | 9 +++------ 3 files changed, 5 insertions(+), 9 deletions(-)
arch/arm/mach-ep93xx/vision_ep9307.c +1 -2
@@ -292,8 +292,7 @@ static void __init vision_init_machine(void)* Request the gpio expander's interrupt gpio line now to prevent * the kernel from doing a WARN in gpiolib:gpio_ensure_requested(). */ -if (gpio_request_one (EP93XX_GPIO_LINE_F (7 ),GPIOF_DIR_IN , -"pca9539:74" )) +if (gpio_request_one (EP93XX_GPIO_LINE_F (7 ),GPIOF_IN ,"pca9539:74" ))pr_warn ("cannot request interrupt gpio for pca9539:74\n" ); vision_i2c_info[1 ].irq =gpio_to_irq (EP93XX_GPIO_LINE_F (7 ));
drivers/gpio/gpiolib-legacy.c +1 -1
@@ -43,7 +43,7 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)if (flags &GPIOF_ACTIVE_LOW )set_bit (FLAG_ACTIVE_LOW , &desc->flags); -if (flags &GPIOF_DIR_IN ) +if (flags &GPIOF_IN ) err =gpiod_direction_input (desc);else err =gpiod_direction_output_raw (desc, !!(flags &GPIOF_OUT_INIT_HIGH ));
include/linux/gpio.h +3 -6
@@ -17,12 +17,9 @@struct device ;/* make these flag values available regardless of GPIO kconfig options */ -#define GPIOF_DIR_OUT (0 << 0) -#define GPIOF_DIR_IN (1 << 0) - -#define GPIOF_IN (GPIOF_DIR_IN) -#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | (0 << 1)) -#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | (1 << 1)) +#define GPIOF_IN ((1 << 0)) +#define GPIOF_OUT_INIT_LOW ((0 << 0) | (0 << 1)) +#define GPIOF_OUT_INIT_HIGH ((0 << 0) | (1 << 1))/* Gpio pin is active-low */ #define GPIOF_ACTIVE_LOW (1 << 2)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 2/2] gpiolib: legacy: Kill GPIOF_DIR_* definitions
Quoted 5 lines · Andy Shevchenko
Besides the fact that (old) drivers use wrong definitions, e.g.,
GPIOF_DIR_INinstead ofGPIOF_IN, shrink the legacy definitions by killing those GPIOF_DIR_* completely.Signed-off-by Andy Shevchenko <[email protected]>
Yours,
Linus Walleij
Quoted 6 lines · Andy Shevchenko
Shrink the legacy API and definition surface by killing the (internal) definitions. This, in particular, will fix a couple of drivers that took it wrong.
This is assumed to go via BPIOLIB tree as this is quite small series and most of the changes related to it.
Hmm... LKP complained that it can't apply them on top of Linux Next, however I don't see any issues as my branch based on next-20240828.
Tell me if I need to resend.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi Andy,
Quoted 4 lines · Andy Shevchenko
Shrink the legacy API and definition surface by killing the (internal) definitions. This, in particular, will fix a couple of drivers that took it wrong.
Quoted 8 lines
This is assumed to go via BPIOLIB tree as this is quite small series and most of the changes related to it.
Andy Shevchenko (2):
gpiolib: legacy: Kill GPIOF_INIT_* definitions
gpiolib: legacy: Kill GPIOF_DIR_* definitionsarch/arm/mach-ep93xx/vision_ep9307.c | 6 ++----
for the mach-ep93xx part,
and in general, for the whole series,
Quoted 4 lines
arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- drivers/gpio/gpiolib-legacy.c | 5 ++--- include/linux/gpio.h | 12 +++---------
4 files changed, 8 insertions(+), 17 deletions(-)
Signature · 1 line
Alexander Sverdlin.
Bartosz Golaszewski
AppliedFrom: Bartosz Golaszewski <[email protected]>
Quoted 8 lines · Andy Shevchenko
Shrink the legacy API and definition surface by killing the (internal) definitions. This, in particular, will fix a couple of drivers that took it wrong.
This is assumed to go via BPIOLIB tree as this is quite small series and most of the changes related to it.
[...]
Applied, thanks!
[1/2] gpiolib: legacy: Kill GPIOF_INIT_* definitions
commit: 4b2b0a2ce8153d65d0829e45e73bf6acdc291344
[2/2] gpiolib: legacy: Kill GPIOF_DIR_* definitions
commit: 8c045ca534d03bab1ce4b4de49d29a36276a1e35Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>