diff mbox series

[v1,2/2] gpiolib: Move GPIO_DYNAMIC_* constants to its only user

Message ID 20250531195801.3632110-3-andriy.shevchenko@linux.intel.com
State New
Headers show
Series gpio: More cleanups to legacy header | expand

Commit Message

Andy Shevchenko May 31, 2025, 7:55 p.m. UTC
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(-)

Comments

Linus Walleij June 5, 2025, 1:32 p.m. UTC | #1
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
diff mbox series

Patch

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.
  */