* [PATCH v1 0/2] gpio: More cleanups to legacy header
@ 2025-05-31 19:55 Andy Shevchenko
2025-05-31 19:55 ` [PATCH v1 1/2] gpio: Remove unused 'struct gpio' definition Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-05-31 19:55 UTC (permalink / raw)
To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski
If I'm not missing anything the 'struct gpio' is not used and
GPIO_DYNAMIC_* constants nowadays are private to gpiolib.c.
Hence this series.
Note, this seems already the case for the upcoming v6.16 cycle, hence
I would like to route these patches as fixes to it to prevent any possible
use of the mentioned definitions in a new code.
Andy Shevchenko (2):
gpio: Remove unused 'struct gpio' definition
gpiolib: Move GPIO_DYNAMIC_* constants to its only user
drivers/gpio/gpiolib.c | 13 +++++++++++++
include/linux/gpio.h | 25 -------------------------
2 files changed, 13 insertions(+), 25 deletions(-)
--
2.47.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 1/2] gpio: Remove unused 'struct gpio' definition
2025-05-31 19:55 [PATCH v1 0/2] gpio: More cleanups to legacy header Andy Shevchenko
@ 2025-05-31 19:55 ` Andy Shevchenko
2025-06-05 13:31 ` Linus Walleij
2025-05-31 19:55 ` [PATCH v1 2/2] gpiolib: Move GPIO_DYNAMIC_* constants to its only user Andy Shevchenko
2025-06-10 8:11 ` [PATCH v1 0/2] gpio: More cleanups to legacy header Bartosz Golaszewski
2 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2025-05-31 19:55 UTC (permalink / raw)
To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski
There is no user for the legacy 'struct gpio', remove it for good.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
include/linux/gpio.h | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index c1ec62c11ed3..1893e5d4c0c9 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -21,18 +21,6 @@ struct device;
#define GPIOF_OUT_INIT_LOW ((0 << 0) | (0 << 1))
#define GPIOF_OUT_INIT_HIGH ((0 << 0) | (1 << 1))
-/**
- * struct gpio - a structure describing a GPIO with configuration
- * @gpio: the GPIO number
- * @flags: GPIO configuration as specified by GPIOF_*
- * @label: a literal description string of this GPIO
- */
-struct gpio {
- unsigned gpio;
- unsigned long flags;
- const char *label;
-};
-
#ifdef CONFIG_GPIOLIB
#include <linux/gpio/consumer.h>
--
2.47.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1 2/2] gpiolib: Move GPIO_DYNAMIC_* constants to its only user
2025-05-31 19:55 [PATCH v1 0/2] gpio: More cleanups to legacy header Andy Shevchenko
2025-05-31 19:55 ` [PATCH v1 1/2] gpio: Remove unused 'struct gpio' definition Andy Shevchenko
@ 2025-05-31 19:55 ` Andy Shevchenko
2025-06-05 13:32 ` Linus Walleij
2025-06-10 8:11 ` [PATCH v1 0/2] gpio: More cleanups to legacy header Bartosz Golaszewski
2 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2025-05-31 19:55 UTC (permalink / raw)
To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski
There is no need to export GPIO_DYNAMIC_* constants, especially via
legacy header which is subject to remove. Move the mentioned constants
to its only user, i.e. gpiolib.c.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpiolib.c | 13 +++++++++++++
include/linux/gpio.h | 13 -------------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 839948b859e3..85296419a514 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -74,6 +74,19 @@ static const struct bus_type gpio_bus_type = {
.match = gpio_bus_match,
};
+/*
+ * At the end we want all GPIOs to be dynamically allocated from 0.
+ * However, some legacy drivers still perform fixed allocation.
+ * Until they are all fixed, leave 0-512 space for them.
+ */
+#define GPIO_DYNAMIC_BASE 512
+/*
+ * Define the maximum of the possible GPIO in the global numberspace.
+ * While the GPIO base and numbers are positive, we limit it with signed
+ * maximum as a lot of code is using negative values for special cases.
+ */
+#define GPIO_DYNAMIC_MAX INT_MAX
+
/*
* Number of GPIOs to use for the fast path in set array
*/
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 1893e5d4c0c9..d105a207eaa2 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -45,19 +45,6 @@ static inline bool gpio_is_valid(int number)
* extra memory (for code and for per-GPIO table entries).
*/
-/*
- * At the end we want all GPIOs to be dynamically allocated from 0.
- * However, some legacy drivers still perform fixed allocation.
- * Until they are all fixed, leave 0-512 space for them.
- */
-#define GPIO_DYNAMIC_BASE 512
-/*
- * Define the maximum of the possible GPIO in the global numberspace.
- * While the GPIO base and numbers are positive, we limit it with signed
- * maximum as a lot of code is using negative values for special cases.
- */
-#define GPIO_DYNAMIC_MAX INT_MAX
-
/* Always use the library code for GPIO management calls,
* or when sleeping may be involved.
*/
--
2.47.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/2] gpio: Remove unused 'struct gpio' definition
2025-05-31 19:55 ` [PATCH v1 1/2] gpio: Remove unused 'struct gpio' definition Andy Shevchenko
@ 2025-06-05 13:31 ` Linus Walleij
0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2025-06-05 13:31 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel,
Bartosz Golaszewski
On Sat, May 31, 2025 at 9:58 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> There is no user for the legacy 'struct gpio', remove it for good.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Good riddance.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 2/2] gpiolib: Move GPIO_DYNAMIC_* constants to its only user
2025-05-31 19:55 ` [PATCH v1 2/2] gpiolib: Move GPIO_DYNAMIC_* constants to its only user Andy Shevchenko
@ 2025-06-05 13:32 ` Linus Walleij
0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2025-06-05 13:32 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel,
Bartosz Golaszewski
On Sat, May 31, 2025 at 9:58 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> There is no need to export GPIO_DYNAMIC_* constants, especially via
> legacy header which is subject to remove. Move the mentioned constants
> to its only user, i.e. gpiolib.c.
>
> 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] 6+ messages in thread
* Re: [PATCH v1 0/2] gpio: More cleanups to legacy header
2025-05-31 19:55 [PATCH v1 0/2] gpio: More cleanups to legacy header Andy Shevchenko
2025-05-31 19:55 ` [PATCH v1 1/2] gpio: Remove unused 'struct gpio' definition Andy Shevchenko
2025-05-31 19:55 ` [PATCH v1 2/2] gpiolib: Move GPIO_DYNAMIC_* constants to its only user Andy Shevchenko
@ 2025-06-10 8:11 ` Bartosz Golaszewski
2 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2025-06-10 8:11 UTC (permalink / raw)
To: linux-gpio, linux-kernel, Andy Shevchenko
Cc: Bartosz Golaszewski, Linus Walleij, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Sat, 31 May 2025 22:55:42 +0300, Andy Shevchenko wrote:
> If I'm not missing anything the 'struct gpio' is not used and
> GPIO_DYNAMIC_* constants nowadays are private to gpiolib.c.
> Hence this series.
>
> Note, this seems already the case for the upcoming v6.16 cycle, hence
> I would like to route these patches as fixes to it to prevent any possible
> use of the mentioned definitions in a new code.
>
> [...]
Applied, thanks!
[1/2] gpio: Remove unused 'struct gpio' definition
https://git.kernel.org/brgl/linux/c/9b4d4c952e28f97c5e653c8b9453690f7e63cc5a
[2/2] gpiolib: Move GPIO_DYNAMIC_* constants to its only user
https://git.kernel.org/brgl/linux/c/6595ea2761df191c2ec500d5f54b57592b969f5c
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-06-10 8:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-31 19:55 [PATCH v1 0/2] gpio: More cleanups to legacy header Andy Shevchenko
2025-05-31 19:55 ` [PATCH v1 1/2] gpio: Remove unused 'struct gpio' definition Andy Shevchenko
2025-06-05 13:31 ` Linus Walleij
2025-05-31 19:55 ` [PATCH v1 2/2] gpiolib: Move GPIO_DYNAMIC_* constants to its only user Andy Shevchenko
2025-06-05 13:32 ` Linus Walleij
2025-06-10 8:11 ` [PATCH v1 0/2] gpio: More cleanups to legacy header 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).