* [PATCH 00/21] gpiolib: fence off legacy interfaces
@ 2025-08-08 15:17 Arnd Bergmann
2025-08-08 15:17 ` [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
` (5 more replies)
0 siblings, 6 replies; 15+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio
Cc: Arnd Bergmann, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement, Russell King, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Krzysztof Kozlowski, Alim Akhtar,
Geert Uytterhoeven, Thomas Bogendoerfer, Yoshinori Sato,
Rich Felker, John Paul Adrian Glaubitz, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
Dmitry Torokhov, Lee Jones, Pavel Machek, Mauro Carvalho Chehab,
Matti Vaittinen, Florian Fainelli, Jeff Johnson, Hans de Goede,
Ilpo Järvinen, Greg Kroah-Hartman, Jaroslav Kysela,
Takashi Iwai, Liam Girdwood, Mark Brown, Andy Shevchenko,
Dr. David Alan Gilbert, linux-arm-kernel, linux-kernel,
linux-samsung-soc, linux-m68k, linux-mips, linux-sh, linux-input,
linux-leds, linux-media, patches, netdev, linux-wireless, ath10k,
platform-driver-x86, linux-usb, linux-sound
From: Arnd Bergmann <arnd@arndb.de>
Commit 678bae2eaa81 ("gpiolib: make legacy interfaces optional") was
merged for linux-6.17, so now it is possible to use the legacy interfaces
conditionally and eventually have the support left out of the kernel
whenever it is not needed.
I created six patches to force-enable CONFIG_GPIOLIB_LEGACY on the
few (mostly ancient) platforms that still require this, plus a set of
patches to either add the corresponding Kconfig dependencies that make
the device drivers conditional on that symbol, or change them to no
longer require it.
The final patch ends up turning the Kconfig symbol off by default,
which of course depends on everything else getting merged first to avoid
build errors.
I would suggest that patches 1-20 can just get merged through the
respective maintainer trees independently when they are deemed ready,
and the final patch can wait another merge window.
Arnd
Arnd Bergmann (21):
ARM: select legacy gpiolib interfaces where used
m68k: coldfire: select legacy gpiolib interface for mcfqspi
mips: select legacy gpiolib interfaces where used
sh: select legacy gpiolib interface
x86/platform: select legacy gpiolib interfaces where used
x86/olpc: select GPIOLIB_LEGACY
mfd: wm8994: remove dead legacy-gpio code
ASoC: add GPIOLIB_LEGACY dependency where needed
input: gpio-keys: make legacy gpiolib optional
leds: gpio: make legacy gpiolib interface optional
media: em28xx: add special case for legacy gpiolib interface
mfd: arizona: make legacy gpiolib interface optional
mfd: si476x: add GPIOLIB_LEGACY dependency
mfd: aat2870: add GPIOLIB_LEGACY dependency
dsa: b53: hide legacy gpiolib usage on non-mips
ath10k: remove gpio number assignment
nfc: marvell: convert to gpio descriptors
nfc: s3fwrn5: convert to gpio descriptors
usb: udc: pxa: remove unused platform_data
ASoC: pxa: add GPIOLIB_LEGACY dependency
gpiolib: turn off legacy interface by default
arch/arm/mach-mv78xx0/Kconfig | 1 +
arch/arm/mach-orion5x/Kconfig | 1 +
arch/arm/mach-pxa/Kconfig | 1 +
arch/arm/mach-pxa/devices.c | 7 --
arch/arm/mach-pxa/gumstix.c | 1 -
arch/arm/mach-pxa/udc.h | 8 --
arch/arm/mach-s3c/Kconfig.s3c64xx | 1 +
arch/arm/mach-sa1100/Kconfig | 1 +
arch/m68k/Kconfig.cpu | 1 +
arch/mips/Kconfig | 5 +
arch/mips/alchemy/Kconfig | 1 -
arch/mips/txx9/Kconfig | 1 +
arch/sh/Kconfig | 1 +
arch/sh/boards/Kconfig | 8 ++
arch/sh/boards/mach-highlander/Kconfig | 1 +
arch/sh/boards/mach-rsk/Kconfig | 3 +
arch/x86/Kconfig | 1 +
drivers/gpio/Kconfig | 11 ++-
drivers/input/keyboard/gpio_keys.c | 5 +-
drivers/input/keyboard/gpio_keys_polled.c | 2 +
drivers/input/misc/Kconfig | 3 +
drivers/leds/leds-gpio.c | 8 +-
drivers/media/usb/em28xx/Kconfig | 1 +
drivers/media/usb/em28xx/em28xx-dvb.c | 4 +-
drivers/mfd/Kconfig | 2 +
drivers/mfd/arizona-irq.c | 5 +-
drivers/mfd/rohm-bd71828.c | 2 +
drivers/mfd/rohm-bd718x7.c | 2 +
drivers/mfd/wm8994-irq.c | 94 +------------------
drivers/net/dsa/b53/b53_common.c | 17 +---
drivers/net/dsa/b53/b53_priv.h | 24 +++--
drivers/net/wireless/ath/ath10k/leds.c | 3 +-
drivers/nfc/nfcmrvl/main.c | 47 +++-------
drivers/nfc/nfcmrvl/nfcmrvl.h | 5 +-
drivers/nfc/nfcmrvl/uart.c | 5 -
drivers/nfc/nfcmrvl/usb.c | 1 -
drivers/nfc/s3fwrn5/i2c.c | 42 +++------
drivers/nfc/s3fwrn5/phy_common.c | 12 +--
drivers/nfc/s3fwrn5/phy_common.h | 4 +-
drivers/nfc/s3fwrn5/uart.c | 30 ++----
drivers/platform/x86/Kconfig | 3 +
.../platform/x86/x86-android-tablets/Kconfig | 1 +
drivers/usb/gadget/udc/pxa25x_udc.c | 41 +++-----
drivers/usb/gadget/udc/pxa25x_udc.h | 2 +-
drivers/usb/gadget/udc/pxa27x_udc.c | 35 +------
drivers/usb/gadget/udc/pxa27x_udc.h | 2 -
include/linux/gpio_keys.h | 2 +
include/linux/leds.h | 2 +
include/linux/mfd/arizona/pdata.h | 6 ++
include/linux/mfd/wm8994/pdata.h | 5 -
include/linux/platform_data/pxa2xx_udc.h | 15 ---
sound/pci/Kconfig | 1 +
sound/soc/codecs/Kconfig | 4 +
sound/soc/codecs/arizona-jack.c | 17 +++-
sound/soc/pxa/Kconfig | 4 +-
55 files changed, 192 insertions(+), 320 deletions(-)
delete mode 100644 arch/arm/mach-pxa/udc.h
--
2.39.5
Cc: Linus Walleij <linus.walleij@linaro.org> (maintainer:GPIO SUBSYSTEM,commit_signer:1/2=50%)
Cc: Bartosz Golaszewski <brgl@bgdev.pl> (maintainer:GPIO SUBSYSTEM,commit_signer:1/7=14%,commit_signer:1/2=50%)
Cc: linux-gpio@vger.kernel.org (open list:GPIO SUBSYSTEM)
Cc: Andrew Lunn <andrew@lunn.ch> (maintainer:ARM/Marvell Dove/MV78xx0/Orion SOC support)
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> (maintainer:ARM/Marvell Dove/MV78xx0/Orion SOC support)
Cc: Gregory Clement <gregory.clement@bootlin.com> (maintainer:ARM/Marvell Dove/MV78xx0/Orion SOC support)
Cc: Russell King <linux@armlinux.org.uk> (maintainer:ARM PORT)
Cc: Daniel Mack <daniel@zonque.org> (maintainer:PXA2xx/PXA3xx SUPPORT)
Cc: Haojian Zhuang <haojian.zhuang@gmail.com> (maintainer:PXA2xx/PXA3xx SUPPORT)
Cc: Robert Jarzmik <robert.jarzmik@free.fr> (maintainer:PXA2xx/PXA3xx SUPPORT)
Cc: Krzysztof Kozlowski <krzk@kernel.org> (maintainer:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,commit_signer:1/2=50%)
Cc: Alim Akhtar <alim.akhtar@samsung.com> (reviewer:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES)
Cc: Geert Uytterhoeven <geert@linux-m68k.org> (maintainer:M68K ARCHITECTURE,commit_signer:1/4=25%,authored:1/4=25%,added_lines:2/13=15%,removed_lines:2/6=33%)
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> (maintainer:MIPS)
Cc: Yoshinori Sato <ysato@users.sourceforge.jp> (maintainer:SUPERH)
Cc: Rich Felker <dalias@libc.org> (maintainer:SUPERH)
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> (maintainer:SUPERH,commit_signer:2/4=50%)
Cc: Thomas Gleixner <tglx@linutronix.de> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),added_lines:4/36=11%,removed_lines:6/49=12%)
Cc: Ingo Molnar <mingo@redhat.com> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: Borislav Petkov <bp@alien8.de> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: Dave Hansen <dave.hansen@linux.intel.com> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: "H. Peter Anvin" <hpa@zytor.com> (reviewer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> (maintainer:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,commit_signer:5/7=71%,authored:1/7=14%,added_lines:17/36=47%,removed_lines:27/49=55%,commit_signer:1/2=50%,commit_signer:3/5=60%)
Cc: Lee Jones <lee@kernel.org> (maintainer:LED SUBSYSTEM,commit_signer:2/5=40%)
Cc: Pavel Machek <pavel@kernel.org> (maintainer:LED SUBSYSTEM)
Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (maintainer:EM28XX VIDEO4LINUX DRIVER)
Cc: Matti Vaittinen <mazziesaccount@gmail.com> (maintainer:ROHM POWER MANAGEMENT IC DEVICE DRIVERS)
Cc: Florian Fainelli <florian.fainelli@broadcom.com> (maintainer:BROADCOM B53/SF2 ETHERNET SWITCH DRIVER)
Cc: Jeff Johnson <jjohnson@kernel.org> (maintainer:QUALCOMM ATHEROS ATH10K WIRELESS DRIVER)
Cc: Hans de Goede <hansg@kernel.org> (maintainer:X86 PLATFORM DRIVERS,commit_signer:1/7=14%)
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com> (maintainer:X86 PLATFORM DRIVERS)
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (maintainer:USB SUBSYSTEM)
Cc: Jaroslav Kysela <perex@perex.cz> (maintainer:SOUND)
Cc: Takashi Iwai <tiwai@suse.com> (maintainer:SOUND,commit_signer:1/3=33%,authored:1/3=33%,removed_lines:2/2=100%)
Cc: Liam Girdwood <lgirdwood@gmail.com> (maintainer:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...)
Cc: Mark Brown <broonie@kernel.org> (maintainer:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,commit_signer:26/29=90%,commit_signer:1/3=33%)
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> (authored:1/7=14%,added_lines:4/36=11%,removed_lines:6/49=12%,commit_signer:1/2=50%,authored:1/2=50%,added_lines:5/7=71%,removed_lines:7/7=100%,added_lines:7/7=100%,removed_lines:2/7=29%)
Cc: "Dr. David Alan Gilbert" <linux@treblig.org> (commit_signer:1/5=20%,authored:1/5=20%,removed_lines:7/10=70%)
Cc: linux-arm-kernel@lists.infradead.org (moderated list:ARM/Marvell Dove/MV78xx0/Orion SOC support)
Cc: linux-kernel@vger.kernel.org (open list)
Cc: linux-samsung-soc@vger.kernel.org (open list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES)
Cc: linux-m68k@lists.linux-m68k.org (open list:M68K ARCHITECTURE)
Cc: linux-mips@vger.kernel.org (open list:MIPS)
Cc: linux-sh@vger.kernel.org (open list:SUPERH)
Cc: linux-input@vger.kernel.org (open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...)
Cc: linux-leds@vger.kernel.org (open list:LED SUBSYSTEM)
Cc: linux-media@vger.kernel.org (open list:EM28XX VIDEO4LINUX DRIVER)
Cc: patches@opensource.cirrus.com (open list:WOLFSON MICROELECTRONICS DRIVERS)
Cc: netdev@vger.kernel.org (open list:BROADCOM B53/SF2 ETHERNET SWITCH DRIVER)
Cc: linux-wireless@vger.kernel.org (open list:QUALCOMM ATHEROS ATH10K WIRELESS DRIVER)
Cc: ath10k@lists.infradead.org (open list:QUALCOMM ATHEROS ATH10K WIRELESS DRIVER)
Cc: platform-driver-x86@vger.kernel.org (open list:X86 PLATFORM DRIVERS)
Cc: linux-usb@vger.kernel.org (open list:USB SUBSYSTEM)
Cc: linux-sound@vger.kernel.org (open list:SOUND)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-09 10:01 ` Jonas Gorski
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
` (4 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Florian Fainelli,
Andrew Lunn, Vladimir Oltean, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Arnd Bergmann, Jonas Gorski, Álvaro Fernández Rojas,
Kyle Hendry, Russell King (Oracle), netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The MIPS bcm53xx platform still uses the legacy gpiolib interfaces based
on gpio numbers, but other platforms do not.
Hide these interfaces inside of the existing #ifdef block and use the
modern interfaces in the common parts of the driver to allow building
it when the gpio_set_value() is left out of the kernel.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/dsa/b53/b53_common.c | 17 +++++------------
drivers/net/dsa/b53/b53_priv.h | 24 ++++++++++++++++++------
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 9942fb6f7f4b..cb57bcc56c63 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -19,7 +19,7 @@
#include <linux/delay.h>
#include <linux/export.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/math.h>
#include <linux/minmax.h>
@@ -948,17 +948,17 @@ EXPORT_SYMBOL(b53_configure_vlan);
static void b53_switch_reset_gpio(struct b53_device *dev)
{
- int gpio = dev->reset_gpio;
+ struct gpio_desc *gpio = dev->reset_gpio;
- if (gpio < 0)
+ if (IS_ERR(gpio))
return;
/* Reset sequence: RESET low(50ms)->high(20ms)
*/
- gpio_set_value(gpio, 0);
+ gpiod_set_value(gpio, 0);
mdelay(50);
- gpio_set_value(gpio, 1);
+ gpiod_set_value(gpio, 1);
mdelay(20);
dev->current_page = 0xff;
@@ -2925,7 +2925,6 @@ static int b53_switch_init(struct b53_device *dev)
{
u32 chip_id = dev->chip_id;
unsigned int i;
- int ret;
if (is63xx(dev))
chip_id = BCM63XX_DEVICE_ID;
@@ -3005,12 +3004,6 @@ static int b53_switch_init(struct b53_device *dev)
return -ENOMEM;
dev->reset_gpio = b53_switch_get_reset_gpio(dev);
- if (dev->reset_gpio >= 0) {
- ret = devm_gpio_request_one(dev->dev, dev->reset_gpio,
- GPIOF_OUT_INIT_HIGH, "robo_reset");
- if (ret)
- return ret;
- }
return 0;
}
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
index 458775f95164..16e82653a7c6 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -136,7 +136,7 @@ struct b53_device {
u8 duplex_reg;
u8 jumbo_pm_reg;
u8 jumbo_size_reg;
- int reset_gpio;
+ struct gpio_desc *reset_gpio;
u8 num_arl_bins;
u16 num_arl_buckets;
enum dsa_tag_protocol tag_protocol;
@@ -375,22 +375,34 @@ static inline void b53_arl_from_entry_25(u64 *mac_vid,
#include <linux/bcm47xx_nvram.h>
#include <bcm47xx_board.h>
-static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
+static inline gpio_desc *b53_switch_get_reset_gpio(struct b53_device *dev)
{
enum bcm47xx_board board = bcm47xx_board_get();
+ int gpio, ret;
switch (board) {
case BCM47XX_BOARD_LINKSYS_WRT300NV11:
case BCM47XX_BOARD_LINKSYS_WRT310NV1:
- return 8;
+ gpio = 8;
+ break;
default:
- return bcm47xx_nvram_gpio_pin("robo_reset");
+ gpio = bcm47xx_nvram_gpio_pin("robo_reset");
}
+
+ if (!gpio_is_valid(gpio))
+ return ERR_PTR(-EINVAL);
+
+ ret = devm_gpiod_request_one(dev->dev, gpio,
+ GPIOF_OUT_INIT_HIGH, "robo_reset");
+ if (ret)
+ return ERR_PTR(ret);
+
+ return gpio_to_desc(gpio);
}
#else
-static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
+static inline struct gpio_desc *b53_switch_get_reset_gpio(struct b53_device *dev)
{
- return -ENOENT;
+ return ERR_PTR(-ENODEV);
}
#endif
--
2.39.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
2025-08-08 15:17 ` [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
@ 2025-08-08 15:18 ` Arnd Bergmann
2025-08-09 10:09 ` Andy Shevchenko
` (2 more replies)
2025-08-08 15:18 ` [PATCH 18/21] nfc: s3fwrn5: " Arnd Bergmann
` (3 subsequent siblings)
5 siblings, 3 replies; 15+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:18 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski
Cc: Arnd Bergmann, Jakub Kicinski, Andy Shevchenko, netdev,
linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The only reason this driver seems to still use the legacy gpio
numbers is for the module parameter that lets users pass a different
reset gpio.
Since the fixed numbers are on their way out, and none of the platforms
this driver is used on would have them any more, remove the module
parameter and instead just use the reset information from firmware.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/nfc/nfcmrvl/main.c | 47 +++++++++++------------------------
drivers/nfc/nfcmrvl/nfcmrvl.h | 5 ++--
drivers/nfc/nfcmrvl/uart.c | 5 ----
drivers/nfc/nfcmrvl/usb.c | 1 -
4 files changed, 18 insertions(+), 40 deletions(-)
diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c
index 141bc4b66dcb..1b465a19a262 100644
--- a/drivers/nfc/nfcmrvl/main.c
+++ b/drivers/nfc/nfcmrvl/main.c
@@ -6,7 +6,7 @@
*/
#include <linux/module.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/delay.h>
#include <linux/of_gpio.h>
#include <linux/nfc.h>
@@ -112,14 +112,10 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
memcpy(&priv->config, pdata, sizeof(*pdata));
- if (gpio_is_valid(priv->config.reset_n_io)) {
- rc = gpio_request_one(priv->config.reset_n_io,
- GPIOF_OUT_INIT_LOW,
- "nfcmrvl_reset_n");
- if (rc < 0) {
- priv->config.reset_n_io = -EINVAL;
- nfc_err(dev, "failed to request reset_n io\n");
- }
+ priv->reset_n_io = gpiod_get_optional(dev, "reset-n-io", GPIOD_OUT_LOW);
+ if (IS_ERR(priv->reset_n_io)) {
+ nfc_err(dev, "failed to get reset_n gpio\n");
+ return ERR_CAST(priv->reset_n_io);
}
if (phy == NFCMRVL_PHY_SPI) {
@@ -172,8 +168,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
error_free_dev:
nci_free_device(priv->ndev);
error_free_gpio:
- if (gpio_is_valid(priv->config.reset_n_io))
- gpio_free(priv->config.reset_n_io);
+ gpiod_put(priv->reset_n_io);
kfree(priv);
return ERR_PTR(rc);
}
@@ -189,8 +184,7 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
nfcmrvl_fw_dnld_deinit(priv);
- if (gpio_is_valid(priv->config.reset_n_io))
- gpio_free(priv->config.reset_n_io);
+ gpiod_put(priv->reset_n_io);
nci_free_device(ndev);
kfree(priv);
@@ -232,35 +226,24 @@ void nfcmrvl_chip_reset(struct nfcmrvl_private *priv)
{
/* Reset possible fault of previous session */
clear_bit(NFCMRVL_PHY_ERROR, &priv->flags);
+ if (!priv->reset_n_io)
+ return;
- if (gpio_is_valid(priv->config.reset_n_io)) {
- nfc_info(priv->dev, "reset the chip\n");
- gpio_set_value(priv->config.reset_n_io, 0);
- usleep_range(5000, 10000);
- gpio_set_value(priv->config.reset_n_io, 1);
- } else
- nfc_info(priv->dev, "no reset available on this interface\n");
+ nfc_info(priv->dev, "reset the chip\n");
+ gpiod_set_value(priv->reset_n_io, 0);
+ usleep_range(5000, 10000);
+ gpiod_set_value(priv->reset_n_io, 1);
}
void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
{
- if (gpio_is_valid(priv->config.reset_n_io))
- gpio_set_value(priv->config.reset_n_io, 0);
+ if (priv->reset_n_io)
+ gpiod_set_value(priv->reset_n_io, 0);
}
int nfcmrvl_parse_dt(struct device_node *node,
struct nfcmrvl_platform_data *pdata)
{
- int reset_n_io;
-
- reset_n_io = of_get_named_gpio(node, "reset-n-io", 0);
- if (reset_n_io < 0) {
- pr_info("no reset-n-io config\n");
- } else if (!gpio_is_valid(reset_n_io)) {
- pr_err("invalid reset-n-io GPIO\n");
- return reset_n_io;
- }
- pdata->reset_n_io = reset_n_io;
pdata->hci_muxed = of_property_read_bool(node, "hci-muxed");
return 0;
diff --git a/drivers/nfc/nfcmrvl/nfcmrvl.h b/drivers/nfc/nfcmrvl/nfcmrvl.h
index f61a99e553db..156f46e1581f 100644
--- a/drivers/nfc/nfcmrvl/nfcmrvl.h
+++ b/drivers/nfc/nfcmrvl/nfcmrvl.h
@@ -53,8 +53,6 @@ struct nfcmrvl_platform_data {
* Generic
*/
- /* GPIO that is wired to RESET_N signal */
- int reset_n_io;
/* Tell if transport is muxed in HCI one */
bool hci_muxed;
@@ -83,6 +81,9 @@ struct nfcmrvl_private {
/* Platform configuration */
struct nfcmrvl_platform_data config;
+ /* RESET_N GPIO line */
+ struct gpio_desc *reset_n_io;
+
/* Parent dev */
struct nci_dev *ndev;
diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c
index 2037cd6d4f4f..cb2da7a1d91f 100644
--- a/drivers/nfc/nfcmrvl/uart.c
+++ b/drivers/nfc/nfcmrvl/uart.c
@@ -20,7 +20,6 @@
static unsigned int hci_muxed;
static unsigned int flow_control;
static unsigned int break_control;
-static int reset_n_io = -EINVAL;
/*
* NFCMRVL NCI OPS
@@ -113,7 +112,6 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu)
if (!pdata) {
pr_info("No platform data / DT -> fallback to module params\n");
config.hci_muxed = hci_muxed;
- config.reset_n_io = reset_n_io;
config.flow_control = flow_control;
config.break_control = break_control;
pdata = &config;
@@ -201,6 +199,3 @@ MODULE_PARM_DESC(break_control, "Tell if UART driver must drive break signal.");
module_param(hci_muxed, uint, 0);
MODULE_PARM_DESC(hci_muxed, "Tell if transport is muxed in HCI one.");
-
-module_param(reset_n_io, int, 0);
-MODULE_PARM_DESC(reset_n_io, "GPIO that is wired to RESET_N signal.");
diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c
index ea7309453096..4cf19433fde1 100644
--- a/drivers/nfc/nfcmrvl/usb.c
+++ b/drivers/nfc/nfcmrvl/usb.c
@@ -294,7 +294,6 @@ static int nfcmrvl_probe(struct usb_interface *intf,
/* No configuration for USB */
memset(&config, 0, sizeof(config));
- config.reset_n_io = -EINVAL;
nfc_info(&udev->dev, "intf %p id %p\n", intf, id);
--
2.39.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 18/21] nfc: s3fwrn5: convert to gpio descriptors
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
2025-08-08 15:17 ` [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
@ 2025-08-08 15:18 ` Arnd Bergmann
2025-08-11 22:08 ` Dmitry Torokhov
2025-08-11 13:10 ` [PATCH 00/21] gpiolib: fence off legacy interfaces Bartosz Golaszewski
` (2 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:18 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski
Cc: Arnd Bergmann, Sumanth Gavini, Jakub Kicinski, netdev,
linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
There is no need for this driver to still use the legacy interfaces,
so convert all the legacy calls into their modern equivalents.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/nfc/s3fwrn5/i2c.c | 42 +++++++++-----------------------
drivers/nfc/s3fwrn5/phy_common.c | 12 ++++-----
drivers/nfc/s3fwrn5/phy_common.h | 4 +--
drivers/nfc/s3fwrn5/uart.c | 30 ++++++-----------------
4 files changed, 28 insertions(+), 60 deletions(-)
diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c
index 110d086cfe5b..411be709b397 100644
--- a/drivers/nfc/s3fwrn5/i2c.c
+++ b/drivers/nfc/s3fwrn5/i2c.c
@@ -8,7 +8,7 @@
#include <linux/clk.h>
#include <linux/i2c.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/delay.h>
#include <linux/of_gpio.h>
#include <linux/of_irq.h>
@@ -149,29 +149,22 @@ static irqreturn_t s3fwrn5_i2c_irq_thread_fn(int irq, void *phy_id)
static int s3fwrn5_i2c_parse_dt(struct i2c_client *client)
{
struct s3fwrn5_i2c_phy *phy = i2c_get_clientdata(client);
- struct device_node *np = client->dev.of_node;
+ struct device *dev = &client->dev;
- if (!np)
- return -ENODEV;
-
- phy->common.gpio_en = of_get_named_gpio(np, "en-gpios", 0);
- if (!gpio_is_valid(phy->common.gpio_en)) {
+ phy->common.gpio_en = devm_gpiod_get(dev, "en", GPIOD_OUT_HIGH);
+ if (IS_ERR(phy->common.gpio_en)) {
/* Support also deprecated property */
- phy->common.gpio_en = of_get_named_gpio(np,
- "s3fwrn5,en-gpios",
- 0);
- if (!gpio_is_valid(phy->common.gpio_en))
- return -ENODEV;
+ phy->common.gpio_en = devm_gpiod_get(dev, "s3fwrn5,en", GPIOD_OUT_HIGH);
+ if (IS_ERR(phy->common.gpio_en))
+ return PTR_ERR(phy->common.gpio_en);
}
- phy->common.gpio_fw_wake = of_get_named_gpio(np, "wake-gpios", 0);
- if (!gpio_is_valid(phy->common.gpio_fw_wake)) {
+ phy->common.gpio_fw_wake = devm_gpiod_get(dev, "wake", GPIOD_OUT_LOW);
+ if (IS_ERR(phy->common.gpio_fw_wake)) {
/* Support also deprecated property */
- phy->common.gpio_fw_wake = of_get_named_gpio(np,
- "s3fwrn5,fw-gpios",
- 0);
- if (!gpio_is_valid(phy->common.gpio_fw_wake))
- return -ENODEV;
+ phy->common.gpio_fw_wake = devm_gpiod_get(dev, "s3fwrn5,fw", GPIOD_OUT_LOW);
+ if (IS_ERR(phy->common.gpio_fw_wake))
+ return PTR_ERR(phy->common.gpio_en);
}
return 0;
@@ -197,17 +190,6 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client)
if (ret < 0)
return ret;
- ret = devm_gpio_request_one(&phy->i2c_dev->dev, phy->common.gpio_en,
- GPIOF_OUT_INIT_HIGH, "s3fwrn5_en");
- if (ret < 0)
- return ret;
-
- ret = devm_gpio_request_one(&phy->i2c_dev->dev,
- phy->common.gpio_fw_wake,
- GPIOF_OUT_INIT_LOW, "s3fwrn5_fw_wake");
- if (ret < 0)
- return ret;
-
/*
* S3FWRN5 depends on a clock input ("XI" pin) to function properly.
* Depending on the hardware configuration this could be an always-on
diff --git a/drivers/nfc/s3fwrn5/phy_common.c b/drivers/nfc/s3fwrn5/phy_common.c
index deb2c039f0fd..e802b4e609c8 100644
--- a/drivers/nfc/s3fwrn5/phy_common.c
+++ b/drivers/nfc/s3fwrn5/phy_common.c
@@ -8,7 +8,7 @@
* Bongsu Jeon <bongsu.jeon@samsung.com>
*/
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/delay.h>
#include <linux/module.h>
@@ -19,7 +19,7 @@ void s3fwrn5_phy_set_wake(void *phy_id, bool wake)
struct phy_common *phy = phy_id;
mutex_lock(&phy->mutex);
- gpio_set_value(phy->gpio_fw_wake, wake);
+ gpiod_set_value(phy->gpio_fw_wake, wake);
if (wake)
msleep(S3FWRN5_EN_WAIT_TIME);
mutex_unlock(&phy->mutex);
@@ -33,14 +33,14 @@ bool s3fwrn5_phy_power_ctrl(struct phy_common *phy, enum s3fwrn5_mode mode)
phy->mode = mode;
- gpio_set_value(phy->gpio_en, 1);
- gpio_set_value(phy->gpio_fw_wake, 0);
+ gpiod_set_value(phy->gpio_en, 1);
+ gpiod_set_value(phy->gpio_fw_wake, 0);
if (mode == S3FWRN5_MODE_FW)
- gpio_set_value(phy->gpio_fw_wake, 1);
+ gpiod_set_value(phy->gpio_fw_wake, 1);
if (mode != S3FWRN5_MODE_COLD) {
msleep(S3FWRN5_EN_WAIT_TIME);
- gpio_set_value(phy->gpio_en, 0);
+ gpiod_set_value(phy->gpio_en, 0);
msleep(S3FWRN5_EN_WAIT_TIME);
}
diff --git a/drivers/nfc/s3fwrn5/phy_common.h b/drivers/nfc/s3fwrn5/phy_common.h
index 9cef25436bf9..5451f46f7e27 100644
--- a/drivers/nfc/s3fwrn5/phy_common.h
+++ b/drivers/nfc/s3fwrn5/phy_common.h
@@ -21,8 +21,8 @@
struct phy_common {
struct nci_dev *ndev;
- int gpio_en;
- int gpio_fw_wake;
+ struct gpio_desc *gpio_en;
+ struct gpio_desc *gpio_fw_wake;
struct mutex mutex;
diff --git a/drivers/nfc/s3fwrn5/uart.c b/drivers/nfc/s3fwrn5/uart.c
index 9c09c10c2a46..39e3a64c4f4c 100644
--- a/drivers/nfc/s3fwrn5/uart.c
+++ b/drivers/nfc/s3fwrn5/uart.c
@@ -15,7 +15,7 @@
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/serdev.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/of_gpio.h>
#include "phy_common.h"
@@ -91,18 +91,15 @@ MODULE_DEVICE_TABLE(of, s3fwrn82_uart_of_match);
static int s3fwrn82_uart_parse_dt(struct serdev_device *serdev)
{
struct s3fwrn82_uart_phy *phy = serdev_device_get_drvdata(serdev);
- struct device_node *np = serdev->dev.of_node;
+ struct device *dev = &serdev->dev;
- if (!np)
- return -ENODEV;
+ phy->common.gpio_en = devm_gpiod_get(dev, "en", GPIOD_OUT_HIGH);
+ if (IS_ERR(phy->common.gpio_en))
+ return PTR_ERR(phy->common.gpio_en);
- phy->common.gpio_en = of_get_named_gpio(np, "en-gpios", 0);
- if (!gpio_is_valid(phy->common.gpio_en))
- return -ENODEV;
-
- phy->common.gpio_fw_wake = of_get_named_gpio(np, "wake-gpios", 0);
- if (!gpio_is_valid(phy->common.gpio_fw_wake))
- return -ENODEV;
+ phy->common.gpio_fw_wake = devm_gpiod_get(dev, "wake", GPIOD_OUT_LOW);
+ if (IS_ERR(phy->common.gpio_fw_wake))
+ return PTR_ERR(phy->common.gpio_fw_wake);
return 0;
}
@@ -144,17 +141,6 @@ static int s3fwrn82_uart_probe(struct serdev_device *serdev)
if (ret < 0)
goto err_serdev;
- ret = devm_gpio_request_one(&phy->ser_dev->dev, phy->common.gpio_en,
- GPIOF_OUT_INIT_HIGH, "s3fwrn82_en");
- if (ret < 0)
- goto err_serdev;
-
- ret = devm_gpio_request_one(&phy->ser_dev->dev,
- phy->common.gpio_fw_wake,
- GPIOF_OUT_INIT_LOW, "s3fwrn82_fw_wake");
- if (ret < 0)
- goto err_serdev;
-
ret = s3fwrn5_probe(&phy->common.ndev, phy, &phy->ser_dev->dev,
&uart_phy_ops);
if (ret < 0)
--
2.39.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips
2025-08-08 15:17 ` [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
@ 2025-08-09 10:01 ` Jonas Gorski
2025-08-09 20:55 ` Arnd Bergmann
0 siblings, 1 reply; 15+ messages in thread
From: Jonas Gorski @ 2025-08-09 10:01 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, Florian Fainelli,
Andrew Lunn, Vladimir Oltean, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Arnd Bergmann,
Álvaro Fernández Rojas, Kyle Hendry,
Russell King (Oracle), netdev, linux-kernel
Hi,
On Fri, Aug 8, 2025 at 5:23 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The MIPS bcm53xx platform still uses the legacy gpiolib interfaces based
> on gpio numbers, but other platforms do not.
>
> Hide these interfaces inside of the existing #ifdef block and use the
> modern interfaces in the common parts of the driver to allow building
> it when the gpio_set_value() is left out of the kernel.
Looks reasonable, but doesn't compile:
CC drivers/net/dsa/b53/b53_spi.o
In file included from drivers/net/dsa/b53/b53_spi.c:27:
drivers/net/dsa/b53/b53_priv.h:378:15: error: unknown type name 'gpio_desc'
378 | static inline gpio_desc *b53_switch_get_reset_gpio(struct
b53_device *dev)
| ^~~~~~~~~
drivers/net/dsa/b53/b53_priv.h: In function 'b53_switch_get_reset_gpio':
drivers/net/dsa/b53/b53_priv.h:392:14: error: implicit declaration of
function 'gpio_is_valid'; did you mean 'uuid_is_valid'?
[-Wimplicit-function-declaration]
392 | if (!gpio_is_valid(gpio))
| ^~~~~~~~~~~~~
| uuid_is_valid
drivers/net/dsa/b53/b53_priv.h:395:15: error: implicit declaration of
function 'devm_gpiod_request_one' [-Wimplicit-function-declaration]
395 | ret = devm_gpiod_request_one(dev->dev, gpio,
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/b53/b53_priv.h:396:38: error: 'GPIOF_OUT_INIT_HIGH'
undeclared (first use in this function); did you mean
'GPIOD_OUT_HIGH'?
396 | GPIOF_OUT_INIT_HIGH, "robo_reset");
| ^~~~~~~~~~~~~~~~~~~
| GPIOD_OUT_HIGH
drivers/net/dsa/b53/b53_priv.h:396:38: note: each undeclared
identifier is reported only once for each function it appears in
drivers/net/dsa/b53/b53_priv.h:400:16: error: returning 'struct
gpio_desc *' from a function with incompatible return type 'int *'
[-Wincompatible-pointer-types]
400 | return gpio_to_desc(gpio);
| ^~~~~~~~~~~~~~~~~~
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/net/dsa/b53/b53_common.c | 17 +++++------------
> drivers/net/dsa/b53/b53_priv.h | 24 ++++++++++++++++++------
> 2 files changed, 23 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index 9942fb6f7f4b..cb57bcc56c63 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -19,7 +19,7 @@
>
> #include <linux/delay.h>
> #include <linux/export.h>
> -#include <linux/gpio.h>
this include is now needed for b53_priv.h.
> +#include <linux/gpio/consumer.h>
> #include <linux/kernel.h>
> #include <linux/math.h>
> #include <linux/minmax.h>
> @@ -948,17 +948,17 @@ EXPORT_SYMBOL(b53_configure_vlan);
>
> static void b53_switch_reset_gpio(struct b53_device *dev)
> {
> - int gpio = dev->reset_gpio;
> + struct gpio_desc *gpio = dev->reset_gpio;
>
> - if (gpio < 0)
> + if (IS_ERR(gpio))
> return;
>
> /* Reset sequence: RESET low(50ms)->high(20ms)
> */
> - gpio_set_value(gpio, 0);
> + gpiod_set_value(gpio, 0);
> mdelay(50);
>
> - gpio_set_value(gpio, 1);
> + gpiod_set_value(gpio, 1);
> mdelay(20);
>
> dev->current_page = 0xff;
> @@ -2925,7 +2925,6 @@ static int b53_switch_init(struct b53_device *dev)
> {
> u32 chip_id = dev->chip_id;
> unsigned int i;
> - int ret;
>
> if (is63xx(dev))
> chip_id = BCM63XX_DEVICE_ID;
> @@ -3005,12 +3004,6 @@ static int b53_switch_init(struct b53_device *dev)
> return -ENOMEM;
>
> dev->reset_gpio = b53_switch_get_reset_gpio(dev);
> - if (dev->reset_gpio >= 0) {
> - ret = devm_gpio_request_one(dev->dev, dev->reset_gpio,
> - GPIOF_OUT_INIT_HIGH, "robo_reset");
> - if (ret)
> - return ret;
> - }
>
> return 0;
> }
> diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
> index 458775f95164..16e82653a7c6 100644
> --- a/drivers/net/dsa/b53/b53_priv.h
> +++ b/drivers/net/dsa/b53/b53_priv.h
> @@ -136,7 +136,7 @@ struct b53_device {
> u8 duplex_reg;
> u8 jumbo_pm_reg;
> u8 jumbo_size_reg;
> - int reset_gpio;
> + struct gpio_desc *reset_gpio;
> u8 num_arl_bins;
> u16 num_arl_buckets;
> enum dsa_tag_protocol tag_protocol;
> @@ -375,22 +375,34 @@ static inline void b53_arl_from_entry_25(u64 *mac_vid,
>
> #include <linux/bcm47xx_nvram.h>
> #include <bcm47xx_board.h>
> -static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
> +static inline gpio_desc *b53_switch_get_reset_gpio(struct b53_device *dev)
s/gpio_desc/struct gpio_desc/
> {
> enum bcm47xx_board board = bcm47xx_board_get();
> + int gpio, ret;
>
> switch (board) {
> case BCM47XX_BOARD_LINKSYS_WRT300NV11:
> case BCM47XX_BOARD_LINKSYS_WRT310NV1:
> - return 8;
> + gpio = 8;
> + break;
> default:
> - return bcm47xx_nvram_gpio_pin("robo_reset");
> + gpio = bcm47xx_nvram_gpio_pin("robo_reset");
> }
> +
> + if (!gpio_is_valid(gpio))
> + return ERR_PTR(-EINVAL);
> +
> + ret = devm_gpiod_request_one(dev->dev, gpio,
s/devm_gpiod_request_one/devm_gpio_request_one/
> + GPIOF_OUT_INIT_HIGH, "robo_reset");
> + if (ret)
> + return ERR_PTR(ret);
> +
> + return gpio_to_desc(gpio);
> }
> #else
> -static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
> +static inline struct gpio_desc *b53_switch_get_reset_gpio(struct b53_device *dev)
> {
> - return -ENOENT;
> + return ERR_PTR(-ENODEV);
> }
> #endif
Can't really test this (no matching hardware), but with the code issues fixed
Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Best regards,
Jonas
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
@ 2025-08-09 10:09 ` Andy Shevchenko
2025-08-11 21:43 ` Dmitry Torokhov
2025-08-11 7:49 ` Bartosz Golaszewski
2025-08-13 7:48 ` Krzysztof Kozlowski
2 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2025-08-09 10:09 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski, Arnd Bergmann, Jakub Kicinski, netdev,
linux-kernel
On Fri, Aug 08, 2025 at 05:18:01PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The only reason this driver seems to still use the legacy gpio
> numbers is for the module parameter that lets users pass a different
> reset gpio.
>
> Since the fixed numbers are on their way out, and none of the platforms
> this driver is used on would have them any more, remove the module
> parameter and instead just use the reset information from firmware.
This patch is my love in the series, thanks for doing it!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
But note some comments below.
...
> - if (gpio_is_valid(priv->config.reset_n_io)) {
> - rc = gpio_request_one(priv->config.reset_n_io,
> - GPIOF_OUT_INIT_LOW,
> - "nfcmrvl_reset_n");
> - if (rc < 0) {
> - priv->config.reset_n_io = -EINVAL;
> - nfc_err(dev, "failed to request reset_n io\n");
> - }
> + priv->reset_n_io = gpiod_get_optional(dev, "reset-n-io", GPIOD_OUT_LOW);
> + if (IS_ERR(priv->reset_n_io)) {
> + nfc_err(dev, "failed to get reset_n gpio\n");
> + return ERR_CAST(priv->reset_n_io);
> }
This also needs a call to gpiod_set_consumer_name(), IIRC the API name.
...
> - if (gpio_is_valid(priv->config.reset_n_io)) {
> - nfc_info(priv->dev, "reset the chip\n");
> - gpio_set_value(priv->config.reset_n_io, 0);
> - usleep_range(5000, 10000);
> - gpio_set_value(priv->config.reset_n_io, 1);
> - } else
> - nfc_info(priv->dev, "no reset available on this interface\n");
> + nfc_info(priv->dev, "reset the chip\n");
> + gpiod_set_value(priv->reset_n_io, 0);
> + usleep_range(5000, 10000);
Side note, this would be nice to use fsleep(), but I see that's just a
copy'n'paste of the original piece.
> + gpiod_set_value(priv->reset_n_io, 1);
...
> void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
> {
> - if (gpio_is_valid(priv->config.reset_n_io))
> - gpio_set_value(priv->config.reset_n_io, 0);
> + if (priv->reset_n_io)
Not sure why we need this dup check.
> + gpiod_set_value(priv->reset_n_io, 0);
> }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips
2025-08-09 10:01 ` Jonas Gorski
@ 2025-08-09 20:55 ` Arnd Bergmann
0 siblings, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2025-08-09 20:55 UTC (permalink / raw)
To: Jonas Gorski, Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, open list:GPIO SUBSYSTEM,
Florian Fainelli, Andrew Lunn, Vladimir Oltean, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Álvaro Fernández Rojas, Kyle Hendry, Russell King,
Netdev, linux-kernel
On Sat, Aug 9, 2025, at 12:01, Jonas Gorski wrote:
> On Fri, Aug 8, 2025 at 5:23 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> Can't really test this (no matching hardware), but with the code issues fixed
>
> Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Thanks! I've added the fixes you suggested and made sure it
actually builds on mips. I had done lots of randconfig tested
on arm and x86, but since that code block is only built on
mips, I missed my mistakes.
Arnd
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
2025-08-09 10:09 ` Andy Shevchenko
@ 2025-08-11 7:49 ` Bartosz Golaszewski
2025-08-13 7:48 ` Krzysztof Kozlowski
2 siblings, 0 replies; 15+ messages in thread
From: Bartosz Golaszewski @ 2025-08-11 7:49 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Linus Walleij, linux-gpio, Krzysztof Kozlowski, Arnd Bergmann,
Jakub Kicinski, Andy Shevchenko, netdev, linux-kernel
On Fri, Aug 8, 2025 at 5:24 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The only reason this driver seems to still use the legacy gpio
> numbers is for the module parameter that lets users pass a different
> reset gpio.
>
> Since the fixed numbers are on their way out, and none of the platforms
> this driver is used on would have them any more, remove the module
> parameter and instead just use the reset information from firmware.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
Yes, please!
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 00/21] gpiolib: fence off legacy interfaces
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (2 preceding siblings ...)
2025-08-08 15:18 ` [PATCH 18/21] nfc: s3fwrn5: " Arnd Bergmann
@ 2025-08-11 13:10 ` Bartosz Golaszewski
2025-08-12 16:23 ` (subset) " Mark Brown
2025-09-02 12:56 ` Lee Jones
5 siblings, 0 replies; 15+ messages in thread
From: Bartosz Golaszewski @ 2025-08-11 13:10 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement, Russell King, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Krzysztof Kozlowski, Alim Akhtar,
Geert Uytterhoeven, Thomas Bogendoerfer, Yoshinori Sato,
Rich Felker, John Paul Adrian Glaubitz, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
Dmitry Torokhov, Lee Jones, Pavel Machek, Mauro Carvalho Chehab,
Matti Vaittinen, Florian Fainelli, Jeff Johnson, Hans de Goede,
Ilpo Järvinen, Greg Kroah-Hartman, Jaroslav Kysela,
Takashi Iwai, Liam Girdwood, Mark Brown, Andy Shevchenko,
Dr. David Alan Gilbert, linux-arm-kernel, linux-kernel,
linux-samsung-soc, linux-m68k, linux-mips, linux-sh, linux-input,
linux-leds, linux-media, patches, netdev, linux-wireless, ath10k,
platform-driver-x86, linux-usb, linux-sound, Bartosz Golaszewski,
Linus Walleij, linux-gpio
On Fri, 8 Aug 2025 17:17:44 +0200, Arnd Bergmann <arnd@kernel.org> said:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Commit 678bae2eaa81 ("gpiolib: make legacy interfaces optional") was
> merged for linux-6.17, so now it is possible to use the legacy interfaces
> conditionally and eventually have the support left out of the kernel
> whenever it is not needed.
>
> I created six patches to force-enable CONFIG_GPIOLIB_LEGACY on the
> few (mostly ancient) platforms that still require this, plus a set of
> patches to either add the corresponding Kconfig dependencies that make
> the device drivers conditional on that symbol, or change them to no
> longer require it.
>
> The final patch ends up turning the Kconfig symbol off by default,
> which of course depends on everything else getting merged first to avoid
> build errors.
>
> I would suggest that patches 1-20 can just get merged through the
> respective maintainer trees independently when they are deemed ready,
> and the final patch can wait another merge window.
>
Oh, not at all, I'm fine sending a second PR late into the merge window to
get that done in a single cycle.
Thanks for doing this, awesome work!
Bartosz
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-09 10:09 ` Andy Shevchenko
@ 2025-08-11 21:43 ` Dmitry Torokhov
2025-08-13 12:35 ` Andy Shevchenko
0 siblings, 1 reply; 15+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 21:43 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski, Arnd Bergmann, Jakub Kicinski, netdev,
linux-kernel
On Sat, Aug 09, 2025 at 01:09:47PM +0300, Andy Shevchenko wrote:
> On Fri, Aug 08, 2025 at 05:18:01PM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The only reason this driver seems to still use the legacy gpio
> > numbers is for the module parameter that lets users pass a different
> > reset gpio.
> >
> > Since the fixed numbers are on their way out, and none of the platforms
> > this driver is used on would have them any more, remove the module
> > parameter and instead just use the reset information from firmware.
>
> This patch is my love in the series, thanks for doing it!
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> But note some comments below.
>
> ...
>
> > - if (gpio_is_valid(priv->config.reset_n_io)) {
> > - rc = gpio_request_one(priv->config.reset_n_io,
> > - GPIOF_OUT_INIT_LOW,
> > - "nfcmrvl_reset_n");
> > - if (rc < 0) {
> > - priv->config.reset_n_io = -EINVAL;
> > - nfc_err(dev, "failed to request reset_n io\n");
> > - }
> > + priv->reset_n_io = gpiod_get_optional(dev, "reset-n-io", GPIOD_OUT_LOW);
No, this should be "reset". gpiolib-of.c has a quirk to resolve to naked
"reset-n-io", otherwise this will resolve to "reset-n-io-gpios" in the
bowels of gpiolib.
> > + if (IS_ERR(priv->reset_n_io)) {
> > + nfc_err(dev, "failed to get reset_n gpio\n");
> > + return ERR_CAST(priv->reset_n_io);
> > }
>
> This also needs a call to gpiod_set_consumer_name(), IIRC the API name.
It does not have to... I am not sure who pays attention to names.
>
> ...
>
> > - if (gpio_is_valid(priv->config.reset_n_io)) {
> > - nfc_info(priv->dev, "reset the chip\n");
> > - gpio_set_value(priv->config.reset_n_io, 0);
> > - usleep_range(5000, 10000);
> > - gpio_set_value(priv->config.reset_n_io, 1);
> > - } else
> > - nfc_info(priv->dev, "no reset available on this interface\n");
> > + nfc_info(priv->dev, "reset the chip\n");
> > + gpiod_set_value(priv->reset_n_io, 0);
> > + usleep_range(5000, 10000);
>
> Side note, this would be nice to use fsleep(), but I see that's just a
> copy'n'paste of the original piece.
>
> > + gpiod_set_value(priv->reset_n_io, 1);
Nope, this is not going to work. See
Documentation/devicetree/bindings/net/nfc/marvell,nci.yaml, this GPIO is
active low. We do not have any "live" DTS examples so I am not sure what
polarity is used in the wild. So either use logical level (my
preference) or switch to "_raw()" variant.
>
> ...
>
> > void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
> > {
> > - if (gpio_is_valid(priv->config.reset_n_io))
> > - gpio_set_value(priv->config.reset_n_io, 0);
> > + if (priv->reset_n_io)
>
> Not sure why we need this dup check.
I personally feel very uneasy when dealing with optional GPIO and not
checking if it exists or not, even though gpiod_set_value() handles
this. I think check makes logic clearer.
>
> > + gpiod_set_value(priv->reset_n_io, 0);
> > }
>
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 18/21] nfc: s3fwrn5: convert to gpio descriptors
2025-08-08 15:18 ` [PATCH 18/21] nfc: s3fwrn5: " Arnd Bergmann
@ 2025-08-11 22:08 ` Dmitry Torokhov
0 siblings, 0 replies; 15+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 22:08 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski, Arnd Bergmann, Sumanth Gavini,
Jakub Kicinski, netdev, linux-kernel
Hi Arnd,
On Fri, Aug 08, 2025 at 05:18:02PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> There is no need for this driver to still use the legacy interfaces,
> so convert all the legacy calls into their modern equivalents.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/nfc/s3fwrn5/i2c.c | 42 +++++++++-----------------------
> drivers/nfc/s3fwrn5/phy_common.c | 12 ++++-----
> drivers/nfc/s3fwrn5/phy_common.h | 4 +--
> drivers/nfc/s3fwrn5/uart.c | 30 ++++++-----------------
> 4 files changed, 28 insertions(+), 60 deletions(-)
>
> diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c
> index 110d086cfe5b..411be709b397 100644
> --- a/drivers/nfc/s3fwrn5/i2c.c
> +++ b/drivers/nfc/s3fwrn5/i2c.c
> @@ -8,7 +8,7 @@
>
> #include <linux/clk.h>
> #include <linux/i2c.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
> #include <linux/delay.h>
> #include <linux/of_gpio.h>
> #include <linux/of_irq.h>
> @@ -149,29 +149,22 @@ static irqreturn_t s3fwrn5_i2c_irq_thread_fn(int irq, void *phy_id)
> static int s3fwrn5_i2c_parse_dt(struct i2c_client *client)
> {
> struct s3fwrn5_i2c_phy *phy = i2c_get_clientdata(client);
> - struct device_node *np = client->dev.of_node;
> + struct device *dev = &client->dev;
>
> - if (!np)
> - return -ENODEV;
> -
> - phy->common.gpio_en = of_get_named_gpio(np, "en-gpios", 0);
> - if (!gpio_is_valid(phy->common.gpio_en)) {
> + phy->common.gpio_en = devm_gpiod_get(dev, "en", GPIOD_OUT_HIGH);
> + if (IS_ERR(phy->common.gpio_en)) {
> /* Support also deprecated property */
> - phy->common.gpio_en = of_get_named_gpio(np,
> - "s3fwrn5,en-gpios",
> - 0);
> - if (!gpio_is_valid(phy->common.gpio_en))
> - return -ENODEV;
> + phy->common.gpio_en = devm_gpiod_get(dev, "s3fwrn5,en", GPIOD_OUT_HIGH);
> + if (IS_ERR(phy->common.gpio_en))
> + return PTR_ERR(phy->common.gpio_en);
> }
Should be GPIOD_OUT_LOW or ASIS.
>
> - phy->common.gpio_fw_wake = of_get_named_gpio(np, "wake-gpios", 0);
> - if (!gpio_is_valid(phy->common.gpio_fw_wake)) {
> + phy->common.gpio_fw_wake = devm_gpiod_get(dev, "wake", GPIOD_OUT_LOW);
> + if (IS_ERR(phy->common.gpio_fw_wake)) {
> /* Support also deprecated property */
> - phy->common.gpio_fw_wake = of_get_named_gpio(np,
> - "s3fwrn5,fw-gpios",
> - 0);
> - if (!gpio_is_valid(phy->common.gpio_fw_wake))
> - return -ENODEV;
> + phy->common.gpio_fw_wake = devm_gpiod_get(dev, "s3fwrn5,fw", GPIOD_OUT_LOW);
> + if (IS_ERR(phy->common.gpio_fw_wake))
> + return PTR_ERR(phy->common.gpio_en);
> }
>
> return 0;
> @@ -197,17 +190,6 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client)
> if (ret < 0)
> return ret;
>
> - ret = devm_gpio_request_one(&phy->i2c_dev->dev, phy->common.gpio_en,
> - GPIOF_OUT_INIT_HIGH, "s3fwrn5_en");
> - if (ret < 0)
> - return ret;
> -
> - ret = devm_gpio_request_one(&phy->i2c_dev->dev,
> - phy->common.gpio_fw_wake,
> - GPIOF_OUT_INIT_LOW, "s3fwrn5_fw_wake");
> - if (ret < 0)
> - return ret;
> -
> /*
> * S3FWRN5 depends on a clock input ("XI" pin) to function properly.
> * Depending on the hardware configuration this could be an always-on
> diff --git a/drivers/nfc/s3fwrn5/phy_common.c b/drivers/nfc/s3fwrn5/phy_common.c
> index deb2c039f0fd..e802b4e609c8 100644
> --- a/drivers/nfc/s3fwrn5/phy_common.c
> +++ b/drivers/nfc/s3fwrn5/phy_common.c
> @@ -8,7 +8,7 @@
> * Bongsu Jeon <bongsu.jeon@samsung.com>
> */
>
> -#include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
> #include <linux/delay.h>
> #include <linux/module.h>
>
> @@ -19,7 +19,7 @@ void s3fwrn5_phy_set_wake(void *phy_id, bool wake)
> struct phy_common *phy = phy_id;
>
> mutex_lock(&phy->mutex);
> - gpio_set_value(phy->gpio_fw_wake, wake);
> + gpiod_set_value(phy->gpio_fw_wake, wake);
> if (wake)
> msleep(S3FWRN5_EN_WAIT_TIME);
> mutex_unlock(&phy->mutex);
> @@ -33,14 +33,14 @@ bool s3fwrn5_phy_power_ctrl(struct phy_common *phy, enum s3fwrn5_mode mode)
>
> phy->mode = mode;
>
> - gpio_set_value(phy->gpio_en, 1);
> - gpio_set_value(phy->gpio_fw_wake, 0);
> + gpiod_set_value(phy->gpio_en, 1);
> + gpiod_set_value(phy->gpio_fw_wake, 0);
> if (mode == S3FWRN5_MODE_FW)
> - gpio_set_value(phy->gpio_fw_wake, 1);
> + gpiod_set_value(phy->gpio_fw_wake, 1);
>
> if (mode != S3FWRN5_MODE_COLD) {
> msleep(S3FWRN5_EN_WAIT_TIME);
> - gpio_set_value(phy->gpio_en, 0);
> + gpiod_set_value(phy->gpio_en, 0);
> msleep(S3FWRN5_EN_WAIT_TIME);
The GPIO is describe as "active low" in DTS:
arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
So here you are leaving the chip disabled. You need to use logical
polarity.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: (subset) [PATCH 00/21] gpiolib: fence off legacy interfaces
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (3 preceding siblings ...)
2025-08-11 13:10 ` [PATCH 00/21] gpiolib: fence off legacy interfaces Bartosz Golaszewski
@ 2025-08-12 16:23 ` Mark Brown
2025-09-02 12:56 ` Lee Jones
5 siblings, 0 replies; 15+ messages in thread
From: Mark Brown @ 2025-08-12 16:23 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Arnd Bergmann
Cc: Arnd Bergmann, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement, Russell King, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Krzysztof Kozlowski, Alim Akhtar,
Geert Uytterhoeven, Thomas Bogendoerfer, Yoshinori Sato,
Rich Felker, John Paul Adrian Glaubitz, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
Dmitry Torokhov, Lee Jones, Pavel Machek, Mauro Carvalho Chehab,
Matti Vaittinen, Florian Fainelli, Jeff Johnson, Hans de Goede,
Ilpo Järvinen, Greg Kroah-Hartman, Jaroslav Kysela,
Takashi Iwai, Liam Girdwood, Andy Shevchenko,
Dr. David Alan Gilbert, linux-arm-kernel, linux-kernel,
linux-samsung-soc, linux-m68k, linux-mips, linux-sh, linux-input,
linux-leds, linux-media, patches, netdev, linux-wireless, ath10k,
platform-driver-x86, linux-usb, linux-sound
On Fri, 08 Aug 2025 17:17:44 +0200, Arnd Bergmann wrote:
> Commit 678bae2eaa81 ("gpiolib: make legacy interfaces optional") was
> merged for linux-6.17, so now it is possible to use the legacy interfaces
> conditionally and eventually have the support left out of the kernel
> whenever it is not needed.
>
> I created six patches to force-enable CONFIG_GPIOLIB_LEGACY on the
> few (mostly ancient) platforms that still require this, plus a set of
> patches to either add the corresponding Kconfig dependencies that make
> the device drivers conditional on that symbol, or change them to no
> longer require it.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[08/21] ASoC: add GPIOLIB_LEGACY dependency where needed
commit: 5383d67e2430822fa7bd20dcbbebbd8ae808e386
[20/21] ASoC: pxa: add GPIOLIB_LEGACY dependency
commit: 2d86d2585ab929a143d1e6f8963da1499e33bf13
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
2025-08-09 10:09 ` Andy Shevchenko
2025-08-11 7:49 ` Bartosz Golaszewski
@ 2025-08-13 7:48 ` Krzysztof Kozlowski
2 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-13 7:48 UTC (permalink / raw)
To: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio
Cc: Arnd Bergmann, Jakub Kicinski, Andy Shevchenko, netdev,
linux-kernel
On 08/08/2025 17:18, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The only reason this driver seems to still use the legacy gpio
> numbers is for the module parameter that lets users pass a different
> reset gpio.
>
> Since the fixed numbers are on their way out, and none of the platforms
> this driver is used on would have them any more, remove the module
> parameter and instead just use the reset information from firmware.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/nfc/nfcmrvl/main.c | 47 +++++++++++------------------------
> drivers/nfc/nfcmrvl/nfcmrvl.h | 5 ++--
> drivers/nfc/nfcmrvl/uart.c | 5 ----
> drivers/nfc/nfcmrvl/usb.c | 1 -
> 4 files changed, 18 insertions(+), 40 deletions(-)
>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-11 21:43 ` Dmitry Torokhov
@ 2025-08-13 12:35 ` Andy Shevchenko
0 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2025-08-13 12:35 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski, Arnd Bergmann, Jakub Kicinski, netdev,
linux-kernel
On Mon, Aug 11, 2025 at 02:43:51PM -0700, Dmitry Torokhov wrote:
> On Sat, Aug 09, 2025 at 01:09:47PM +0300, Andy Shevchenko wrote:
> > On Fri, Aug 08, 2025 at 05:18:01PM +0200, Arnd Bergmann wrote:
...
> > > - if (gpio_is_valid(priv->config.reset_n_io)) {
> > > - rc = gpio_request_one(priv->config.reset_n_io,
> > > - GPIOF_OUT_INIT_LOW,
> > > - "nfcmrvl_reset_n");
> > > - if (rc < 0) {
> > > - priv->config.reset_n_io = -EINVAL;
> > > - nfc_err(dev, "failed to request reset_n io\n");
> > > - }
> > > + priv->reset_n_io = gpiod_get_optional(dev, "reset-n-io", GPIOD_OUT_LOW);
>
> No, this should be "reset". gpiolib-of.c has a quirk to resolve to naked
> "reset-n-io", otherwise this will resolve to "reset-n-io-gpios" in the
> bowels of gpiolib.
Good point.
> > > + if (IS_ERR(priv->reset_n_io)) {
> > > + nfc_err(dev, "failed to get reset_n gpio\n");
> > > + return ERR_CAST(priv->reset_n_io);
> > > }
> >
> > This also needs a call to gpiod_set_consumer_name(), IIRC the API name.
>
> It does not have to... I am not sure who pays attention to names.
It goes to user space, isn't it?
In any case it will give 1:1 transition from the look&fell perspective.
...
> > > void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
> > > {
> > > - if (gpio_is_valid(priv->config.reset_n_io))
> > > - gpio_set_value(priv->config.reset_n_io, 0);
> > > + if (priv->reset_n_io)
> >
> > Not sure why we need this dup check.
>
> I personally feel very uneasy when dealing with optional GPIO and not
> checking if it exists or not, even though gpiod_set_value() handles
> this. I think check makes logic clearer.
I disagree with the duplicate. It doesn't make any additional clearness as I
read it. When one reads the code the "here we set GPIO to the X state" without
any conditional is fine as one may check later in DT schema if the GPIO is
optional or not.
> > > + gpiod_set_value(priv->reset_n_io, 0);
> > > }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: (subset) [PATCH 00/21] gpiolib: fence off legacy interfaces
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (4 preceding siblings ...)
2025-08-12 16:23 ` (subset) " Mark Brown
@ 2025-09-02 12:56 ` Lee Jones
5 siblings, 0 replies; 15+ messages in thread
From: Lee Jones @ 2025-09-02 12:56 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Arnd Bergmann
Cc: Arnd Bergmann, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement, Russell King, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Krzysztof Kozlowski, Alim Akhtar,
Geert Uytterhoeven, Thomas Bogendoerfer, Yoshinori Sato,
Rich Felker, John Paul Adrian Glaubitz, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
Dmitry Torokhov, Lee Jones, Pavel Machek, Mauro Carvalho Chehab,
Matti Vaittinen, Florian Fainelli, Jeff Johnson, Hans de Goede,
Ilpo Järvinen, Greg Kroah-Hartman, Jaroslav Kysela,
Takashi Iwai, Liam Girdwood, Mark Brown, Andy Shevchenko,
Dr. David Alan Gilbert, linux-arm-kernel, linux-kernel,
linux-samsung-soc, linux-m68k, linux-mips, linux-sh, linux-input,
linux-leds, linux-media, patches, netdev, linux-wireless, ath10k,
platform-driver-x86, linux-usb, linux-sound
On Fri, 08 Aug 2025 17:17:44 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Commit 678bae2eaa81 ("gpiolib: make legacy interfaces optional") was
> merged for linux-6.17, so now it is possible to use the legacy interfaces
> conditionally and eventually have the support left out of the kernel
> whenever it is not needed.
>
> [...]
Applied, thanks!
[12/21] mfd: arizona: make legacy gpiolib interface optional
commit: 12f6c0afc8987d72017a3ecf7c1183cb951b0d24
[13/21] mfd: si476x: add GPIOLIB_LEGACY dependency
commit: 1ae250257e43b3fba225e4f8ea7d87125dc861ae
[14/21] mfd: aat2870: add GPIOLIB_LEGACY dependency
commit: 3144986f37911f131f373743f294b2941a8ef37c
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2025-09-02 12:56 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
2025-08-08 15:17 ` [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
2025-08-09 10:01 ` Jonas Gorski
2025-08-09 20:55 ` Arnd Bergmann
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
2025-08-09 10:09 ` Andy Shevchenko
2025-08-11 21:43 ` Dmitry Torokhov
2025-08-13 12:35 ` Andy Shevchenko
2025-08-11 7:49 ` Bartosz Golaszewski
2025-08-13 7:48 ` Krzysztof Kozlowski
2025-08-08 15:18 ` [PATCH 18/21] nfc: s3fwrn5: " Arnd Bergmann
2025-08-11 22:08 ` Dmitry Torokhov
2025-08-11 13:10 ` [PATCH 00/21] gpiolib: fence off legacy interfaces Bartosz Golaszewski
2025-08-12 16:23 ` (subset) " Mark Brown
2025-09-02 12:56 ` Lee Jones
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).