* [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_*
@ 2024-08-28 14:23 Andy Shevchenko
2024-08-28 14:23 ` [PATCH v1 1/2] gpiolib: legacy: Kill GPIOF_INIT_* definitions Andy Shevchenko
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Andy Shevchenko @ 2024-08-28 14:23 UTC (permalink / raw)
To: Linus Walleij, Andy Shevchenko, linux-arm-kernel, linux-kernel,
linux-mips, linux-gpio
Cc: Hartley Sweeten, Alexander Sverdlin, Russell King,
Thomas Bogendoerfer, Bartosz Golaszewski
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(-)
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 1/2] gpiolib: legacy: Kill GPIOF_INIT_* definitions
2024-08-28 14:23 [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_* Andy Shevchenko
@ 2024-08-28 14:23 ` Andy Shevchenko
2024-08-30 22:35 ` Linus Walleij
2024-08-28 14:23 ` [PATCH v1 2/2] gpiolib: legacy: Kill GPIOF_DIR_* definitions Andy Shevchenko
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2024-08-28 14:23 UTC (permalink / raw)
To: Linus Walleij, Andy Shevchenko, linux-arm-kernel, linux-kernel,
linux-mips, linux-gpio
Cc: Hartley Sweeten, Alexander Sverdlin, Russell King,
Thomas Bogendoerfer, Bartosz Golaszewski
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.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
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(-)
diff --git a/arch/arm/mach-ep93xx/vision_ep9307.c b/arch/arm/mach-ep93xx/vision_ep9307.c
index 9471938df64c..02c5a4724192 100644
--- a/arch/arm/mach-ep93xx/vision_ep9307.c
+++ b/arch/arm/mach-ep93xx/vision_ep9307.c
@@ -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;
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 99f321b6e417..9cc8fbf218a5 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -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,
diff --git a/drivers/gpio/gpiolib-legacy.c b/drivers/gpio/gpiolib-legacy.c
index d27142418f9f..51d5fe203111 100644
--- a/drivers/gpio/gpiolib-legacy.c
+++ b/drivers/gpio/gpiolib-legacy.c
@@ -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;
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 063f71b18a7c..4af8ad114557 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -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)
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v1 2/2] gpiolib: legacy: Kill GPIOF_DIR_* definitions
2024-08-28 14:23 [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_* Andy Shevchenko
2024-08-28 14:23 ` [PATCH v1 1/2] gpiolib: legacy: Kill GPIOF_INIT_* definitions Andy Shevchenko
@ 2024-08-28 14:23 ` Andy Shevchenko
2024-08-30 22:35 ` Linus Walleij
2024-08-28 15:11 ` [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_* Andy Shevchenko
` (2 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2024-08-28 14:23 UTC (permalink / raw)
To: Linus Walleij, Andy Shevchenko, linux-arm-kernel, linux-kernel,
linux-mips, linux-gpio
Cc: Hartley Sweeten, Alexander Sverdlin, Russell King,
Thomas Bogendoerfer, Bartosz Golaszewski
Besides 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.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
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(-)
diff --git a/arch/arm/mach-ep93xx/vision_ep9307.c b/arch/arm/mach-ep93xx/vision_ep9307.c
index 02c5a4724192..85f0dd7255a9 100644
--- a/arch/arm/mach-ep93xx/vision_ep9307.c
+++ b/arch/arm/mach-ep93xx/vision_ep9307.c
@@ -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));
diff --git a/drivers/gpio/gpiolib-legacy.c b/drivers/gpio/gpiolib-legacy.c
index 51d5fe203111..087fe3227e35 100644
--- a/drivers/gpio/gpiolib-legacy.c
+++ b/drivers/gpio/gpiolib-legacy.c
@@ -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));
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 4af8ad114557..2d105be7bbc3 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -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)
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_*
2024-08-28 14:23 [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_* Andy Shevchenko
2024-08-28 14:23 ` [PATCH v1 1/2] gpiolib: legacy: Kill GPIOF_INIT_* definitions Andy Shevchenko
2024-08-28 14:23 ` [PATCH v1 2/2] gpiolib: legacy: Kill GPIOF_DIR_* definitions Andy Shevchenko
@ 2024-08-28 15:11 ` Andy Shevchenko
2024-08-28 17:05 ` Alexander Sverdlin
2024-09-02 9:47 ` Bartosz Golaszewski
4 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2024-08-28 15:11 UTC (permalink / raw)
To: Linus Walleij, linux-arm-kernel, linux-kernel, linux-mips,
linux-gpio
Cc: Hartley Sweeten, Alexander Sverdlin, Russell King,
Thomas Bogendoerfer, Bartosz Golaszewski
On Wed, Aug 28, 2024 at 05:23:56PM +0300, Andy Shevchenko wrote:
> 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.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_*
2024-08-28 14:23 [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_* Andy Shevchenko
` (2 preceding siblings ...)
2024-08-28 15:11 ` [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_* Andy Shevchenko
@ 2024-08-28 17:05 ` Alexander Sverdlin
2024-09-02 9:47 ` Bartosz Golaszewski
4 siblings, 0 replies; 8+ messages in thread
From: Alexander Sverdlin @ 2024-08-28 17:05 UTC (permalink / raw)
To: Andy Shevchenko, Linus Walleij, linux-arm-kernel, linux-kernel,
linux-mips, linux-gpio
Cc: Hartley Sweeten, Russell King, Thomas Bogendoerfer,
Bartosz Golaszewski
Hi Andy,
On Wed, 2024-08-28 at 17:23 +0300, Andy Shevchenko wrote:
> 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 ++----
for the mach-ep93xx part,
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
and in general, for the whole series,
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> 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(-)
--
Alexander Sverdlin.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/2] gpiolib: legacy: Kill GPIOF_INIT_* definitions
2024-08-28 14:23 ` [PATCH v1 1/2] gpiolib: legacy: Kill GPIOF_INIT_* definitions Andy Shevchenko
@ 2024-08-30 22:35 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2024-08-30 22:35 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-arm-kernel, linux-kernel, linux-mips, linux-gpio,
Hartley Sweeten, Alexander Sverdlin, Russell King,
Thomas Bogendoerfer, Bartosz Golaszewski
On Wed, Aug 28, 2024 at 4:26 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> 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.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Excellent, thanks Andy.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 2/2] gpiolib: legacy: Kill GPIOF_DIR_* definitions
2024-08-28 14:23 ` [PATCH v1 2/2] gpiolib: legacy: Kill GPIOF_DIR_* definitions Andy Shevchenko
@ 2024-08-30 22:35 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2024-08-30 22:35 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-arm-kernel, linux-kernel, linux-mips, linux-gpio,
Hartley Sweeten, Alexander Sverdlin, Russell King,
Thomas Bogendoerfer, Bartosz Golaszewski
On Wed, Aug 28, 2024 at 4:26 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Besides 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.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_*
2024-08-28 14:23 [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_* Andy Shevchenko
` (3 preceding siblings ...)
2024-08-28 17:05 ` Alexander Sverdlin
@ 2024-09-02 9:47 ` Bartosz Golaszewski
4 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2024-09-02 9:47 UTC (permalink / raw)
To: Linus Walleij, linux-arm-kernel, linux-kernel, linux-mips,
linux-gpio, Andy Shevchenko
Cc: Bartosz Golaszewski, Hartley Sweeten, Alexander Sverdlin,
Russell King, Thomas Bogendoerfer, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Wed, 28 Aug 2024 17:23:56 +0300, Andy Shevchenko wrote:
> 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: 8c045ca534d03bab1ce4b4de49d29a36276a1e35
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-09-02 9:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28 14:23 [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_* Andy Shevchenko
2024-08-28 14:23 ` [PATCH v1 1/2] gpiolib: legacy: Kill GPIOF_INIT_* definitions Andy Shevchenko
2024-08-30 22:35 ` Linus Walleij
2024-08-28 14:23 ` [PATCH v1 2/2] gpiolib: legacy: Kill GPIOF_DIR_* definitions Andy Shevchenko
2024-08-30 22:35 ` Linus Walleij
2024-08-28 15:11 ` [PATCH v1 0/2] gpiolib:legacy: Kill GPIOF_DIR_* and GPIOF_INIT_* Andy Shevchenko
2024-08-28 17:05 ` Alexander Sverdlin
2024-09-02 9:47 ` Bartosz Golaszewski
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).