Skip to contentSkip to conversation

gpiolib: finish the legacy cleanup

PATCH Superseded Arnd Bergmann 5 participants 8 messages Sep 7 – Sep 16

Subsystems (6)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v7 cover gpiolib: finish the legacy cleanup

From: Arnd Bergmann <[email protected]>

These two patches are left from my cleanup series, finishing off the work to turn off CONFIG_GPIOLIB_LEGACY by default, and removing the include/linux/gpio.h header.

I had originally planned to send these during the merge window after all the prerequisites made it in, but didn't finish that before my vacation, so I'm sending it now. I suppose this makes them 7.4 material now, but at least the first one could stil be fast-tracked to 7.3 if there is a good reason.

The second patch has to remove a few more leftover <linux/gpio.h> inclusions that made it into 7.3-rc1 either from new code or from conflicts with other changes.

Arnd Bergmann (2):
gpiolib: turn off legacy interface by default
gpiolib: remove linux/gpio.h

 MAINTAINERS                                  |  1 -
 arch/mips/txx9/rbtx4927/setup.c              |  2 +-
 arch/sh/boards/mach-rsk/devices-rsk7203.c    |  2 +-
 drivers/gpio/Kconfig                         |  9 +++++++-
 drivers/gpio/TODO                            |  4 +---
 drivers/gpio/gpiolib-cdev.c                  |  2 +-
 drivers/gpio/gpiolib-legacy.c                |  3 +--
 drivers/gpio/gpiolib.c                       |  2 +-
 drivers/net/wireless/morsemicro/mm81x/hw.c   |  1 -
 drivers/net/wireless/morsemicro/mm81x/yaps.c |  1 -
 include/linux/gpio.h                         | 22 --------------------
 11 files changed, 14 insertions(+), 35 deletions(-)
 delete mode 100644 include/linux/gpio.h
Signature · 11 lines
2.53.0

Cc: Thomas Bogendoerfer <[email protected]>
Cc: John Paul Adrian Glaubitz <[email protected]>
Cc: Kent Gibson <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
#1 lore raw

PATCH v7 1/2 gpiolib: turn off legacy interface by default

From: Arnd Bergmann <[email protected]>

All users of the legacy interface now select CONFIG_GPIOLIB_LEGACY, so it can be turned off by default and only get built on platforms that still have one unconverted driver.

Allow turning it on manually for compile testing, in order to keep the build coverage of the legacy drivers in allmodconfig and randconfig.

---
 drivers/gpio/Kconfig | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpio/Kconfig +8 -1
index a48586bb8edb..2b1f6f4c7446 100644
@@ -4,7 +4,14 @@
 #
 
 config GPIOLIB_LEGACY
-	def_bool y
+	bool "Legacy GPIO interfaces" if COMPILE_TEST
+	help
+	  There are a few legacy platforms that use the traditional GPIO
+	  number based interfaces instead of GPIO descriptors.
+	  Say Y here to enable build testing drivers that are specific
+	  to those platforms.
+
+	  If unsure, say N.
 
 config HAVE_SHARED_GPIOS
 	bool
Signature · 1 line
2.53.0
Reviewed-by on v7 1/2
#2 lore raw

Re: [PATCH 1/2 v7] gpiolib: turn off legacy interface by default

Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

All users of the legacy interface now select CONFIG_GPIOLIB_LEGACY, so it can be turned off by default and only get built on platforms that still have one unconverted driver.

Quoted 7 lines

Allow turning it on manually for compile testing, in order to keep the build coverage of the legacy drivers in allmodconfig and randconfig.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw

PATCH v7 2/2 gpiolib: remove linux/gpio.h

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

After all other drivers have converted to linux/gpio/consumer.h or linux/gpio/legacy.h, remove the final leftover bits here.

---
 MAINTAINERS                                  |  1 -
 arch/mips/txx9/rbtx4927/setup.c              |  2 +-
 arch/sh/boards/mach-rsk/devices-rsk7203.c    |  2 +-
 drivers/gpio/TODO                            |  4 +---
 drivers/gpio/gpiolib-cdev.c                  |  2 +-
 drivers/gpio/gpiolib-legacy.c                |  3 +--
 drivers/gpio/gpiolib.c                       |  2 +-
 drivers/net/wireless/morsemicro/mm81x/hw.c   |  1 -
 drivers/net/wireless/morsemicro/mm81x/yaps.c |  1 -
 include/linux/gpio.h                         | 22 --------------------
 10 files changed, 6 insertions(+), 34 deletions(-)
 delete mode 100644 include/linux/gpio.h
MAINTAINERS +0 -1
index 3a19da74d00c..ee06d678cd59 100644
@@ -11255,7 +11255,6 @@ F:	Documentation/devicetree/bindings/gpio/
 F:	Documentation/driver-api/gpio/
 F:	drivers/gpio/
 F:	include/dt-bindings/gpio/
-F:	include/linux/gpio.h
 F:	include/linux/gpio/
 K:	(devm_)?gpio_(request|free|direction|get|set)
 K:	GPIOD_FLAGS_BIT_NONEXCLUSIVE
arch/mips/txx9/rbtx4927/setup.c +1 -1
index 223889c03186..fdbe2bd87979 100644
@@ -48,7 +48,7 @@
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/gpio/machine.h>
 #include <linux/leds.h>
 #include <asm/io.h>
arch/sh/boards/mach-rsk/devices-rsk7203.c +1 -1
index e6b05d4588b7..eb56b57812bd 100644
@@ -10,7 +10,7 @@
 #include <linux/interrupt.h>
 #include <linux/smsc911x.h>
 #include <linux/input.h>
-#include <linux/gpio.h>
+#include <linux/gpio/legacy.h>
 #include <linux/gpio_keys.h>
 #include <linux/leds.h>
 #include <asm/machvec.h>
drivers/gpio/TODO +1 -3
index 7ce80fde1f17..4fce4a7e4704 100644
@@ -52,9 +52,7 @@ Work items:
   base can be made dynamic (set to -1) if CONFIG_GPIO_SYSFS is disabled.
 
 - When this work is complete (will require some of the items in the
-  following ongoing work as well) we can delete the old global
-  numberspace accessors from <linux/gpio.h> and eventually delete
-  <linux/gpio.h> altogether.
+  following ongoing work as well) we can delete <linux/gpio/legacy.h>.
 
 -------------------------------------------------------------------------------
 
drivers/gpio/gpiolib-cdev.c +1 -1
index 9f3b628d5793..1c2c94387b77 100644
@@ -11,7 +11,7 @@
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/file.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/gpio/driver.h>
 #include <linux/hte.h>
 #include <linux/interrupt.h>
drivers/gpio/gpiolib-legacy.c +1 -2
index ef3f2ef30cf2..33e5a45e720b 100644
@@ -7,8 +7,7 @@
 
 #include <linux/gpio/consumer.h>
 #include <linux/gpio/driver.h>
-
-#include <linux/gpio.h>
+#include <linux/gpio/legacy.h>
 
 #include "gpiolib.h"
 
drivers/gpio/gpiolib.c +1 -1
index ef8ccaf17c9c..c9c517488e0a 100644
@@ -29,7 +29,7 @@
 #include <linux/string.h>
 #include <linux/string_choices.h>
 
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/gpio/driver.h>
 #include <linux/gpio/machine.h>
 
drivers/net/wireless/morsemicro/mm81x/hw.c +0 -1
index 9293f4094db1..e48eaf151faa 100644
@@ -7,7 +7,6 @@
 #include <linux/stringify.h>
 #include <linux/types.h>
 #include <linux/unaligned.h>
-#include <linux/gpio.h>
 #include "hif.h"
 #include "mac.h"
 #include "bus.h"
drivers/net/wireless/morsemicro/mm81x/yaps.c +0 -1
index e98a2a58726f..252116425bc3 100644
@@ -2,7 +2,6 @@
 /*
  * Copyright (c) 2017-2026 Morse Micro
  */
-#include <linux/gpio.h>
 #include <linux/random.h>
 #include <linux/timer.h>
 #include <linux/bitops.h>
include/linux/gpio.h deleted +0 -22
deleted file mode 100644
index b0d4942a65de..000000000000
@@ -1,22 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * NOTE: This header *must not* be included.
- *
- * If you're implementing a GPIO driver, only include <linux/gpio/driver.h>
- * If you're implementing a GPIO consumer, only include <linux/gpio/consumer.h>
- * If you're using the legacy interfaces, include <linux/gpio/legacy.h>
- */
-
-#ifndef __LINUX_GPIO_H
-#define __LINUX_GPIO_H
-
-#include <linux/types.h>
-#ifdef CONFIG_GPIOLIB
-#include <linux/gpio/consumer.h>
-#endif
-
-#ifdef CONFIG_GPIOLIB_LEGACY
-#include <linux/gpio/legacy.h>
-#endif /* CONFIG_GPIOLIB_LEGACY */
-
-#endif /* __LINUX_GPIO_H */
Signature · 1 line
2.53.0
Reviewed-by on v7 2/2
#4 lore raw

Re: [PATCH 2/2 v7] gpiolib: remove linux/gpio.h

Quoted 7 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

After all other drivers have converted to linux/gpio/consumer.h or linux/gpio/legacy.h, remove the final leftover bits here.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer Acked-by on v7 2/2
#5 lore raw

Re: [PATCH 2/2 v7] gpiolib: remove linux/gpio.h

In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

After all other drivers have converted to linux/gpio/consumer.h or linux/gpio/legacy.h, remove the final leftover bits here.

---
 MAINTAINERS                                  |  1 -
 arch/mips/txx9/rbtx4927/setup.c              |  2 +-
Quoted 10 lines
 arch/sh/boards/mach-rsk/devices-rsk7203.c    |  2 +-
 drivers/gpio/TODO                            |  4 +---
 drivers/gpio/gpiolib-cdev.c                  |  2 +-
 drivers/gpio/gpiolib-legacy.c                |  3 +--
 drivers/gpio/gpiolib.c                       |  2 +-
 drivers/net/wireless/morsemicro/mm81x/hw.c   |  1 -
 drivers/net/wireless/morsemicro/mm81x/yaps.c |  1 -
 include/linux/gpio.h                         | 22 --------------------
 10 files changed, 6 insertions(+), 34 deletions(-)
 delete mode 100644 include/linux/gpio.h
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
#7 lore raw
In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

These two patches are left from my cleanup series, finishing off the work to turn off CONFIG_GPIOLIB_LEGACY by default, and removing the include/linux/gpio.h header.

I had originally planned to send these during the merge window after all the prerequisites made it in, but didn't finish that before my vacation, so I'm sending it now. I suppose this makes them 7.4 material now, but at least the first one could stil be fast-tracked to 7.3 if there is a good reason.

Quoted 4 lines

The second patch has to remove a few more leftover <linux/gpio.h> inclusions that made it into 7.3-rc1 either from new code or from conflicts with other changes.

With acks from SH and MIPS maintainers, I can take it for v7.4 through the GPIO tree.

Bart