* [PATCH] gpio: fix up CONFIG_OF dependencies
@ 2026-03-25 10:01 Arnd Bergmann
2026-03-25 10:32 ` Bartosz Golaszewski
2026-03-26 8:41 ` Bartosz Golaszewski
0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2026-03-25 10:01 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski
Cc: Arnd Bergmann, Yixun Lan, Matthias Brugger,
AngeloGioacchino Del Regno, linux-gpio, linux-kernel, linux-riscv,
spacemit, linux-arm-kernel, linux-mediatek
From: Arnd Bergmann <arnd@arndb.de>
A number of GPIO drivers that used to have a CONFIG_OF_GPIO dependency now fail
to build on targets without CONFIG_OF:
WARNING: unmet direct dependencies detected for GPIO_SYSCON
Depends on [n]: GPIOLIB [=y] && HAS_IOMEM [=y] && MFD_SYSCON [=y] && OF [=n]
Selected by [y]:
- GPIO_SAMA5D2_PIOBU [=y] && GPIOLIB [=y] && HAS_IOMEM [=y] && MFD_SYSCON [=y] && (ARCH_AT91 || COMPILE_TEST [=y])
drivers/gpio/gpio-mt7621.c: In function 'mediatek_gpio_bank_probe':
drivers/gpio/gpio-mt7621.c:254:20: error: 'struct gpio_chip' has no member named 'of_gpio_n_cells'
254 | rg->chip.gc.of_gpio_n_cells = 2;
| ^
drivers/gpio/gpio-tegra186.c: In function 'tegra186_gpio_of_xlate':
drivers/gpio/gpio-tegra186.c:502:25: error: 'struct gpio_chip' has no member named 'of_gpio_n_cells'
502 | if (WARN_ON(chip->of_gpio_n_cells < 2))
| ^~
drivers/gpio/gpio-lpc32xx.c: In function 'lpc32xx_gpio_probe':
drivers/gpio/gpio-lpc32xx.c:523:49: error: 'struct gpio_chip' has no member named 'of_xlate'
523 | lpc32xx_gpiochip[i].chip.of_xlate = lpc32xx_of_xlate;
| ^
drivers/gpio/gpio-spacemit-k1.c: In function 'spacemit_gpio_add_bank':
drivers/gpio/gpio-spacemit-k1.c:234:11: error: 'struct gpio_chip' has no member named 'of_gpio_n_cells'
234 | gc->of_gpio_n_cells = 3;
| ^~
Bring that back as a dependency.
Fixes: 7803501e5754 ("gpio: drop unneeded Kconfig dependencies on OF_GPIO")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
There may be more fallout from the change, this is just what I found immediately,
but you could already fold the changes into the broken patch while I look
for additional ones.
---
drivers/gpio/Kconfig | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index e1e48e432133..bcb8ce89396c 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -236,6 +236,7 @@ config GPIO_BRCMSTB
tristate "BRCMSTB GPIO support"
default y if (ARCH_BRCMSTB || BMIPS_GENERIC)
depends on ARCH_BRCMSTB || ARCH_BCM2835 || BMIPS_GENERIC || COMPILE_TEST
+ depends on OF
select GPIO_GENERIC
select IRQ_DOMAIN
help
@@ -450,6 +451,7 @@ config GPIO_LPC18XX
config GPIO_LPC32XX
tristate "NXP LPC32XX GPIO support"
depends on ARCH_LPC32XX || COMPILE_TEST
+ depends on OF
help
Select this option to enable GPIO driver for
NXP LPC32XX devices.
@@ -492,6 +494,7 @@ config GPIO_MPC8XXX
config GPIO_MT7621
bool "Mediatek MT7621 GPIO Support"
depends on SOC_MT7620 || SOC_MT7621 || COMPILE_TEST
+ depends on OF
select GPIO_GENERIC
select GPIOLIB_IRQCHIP
help
@@ -632,6 +635,7 @@ config GPIO_RTD
config GPIO_SAMA5D2_PIOBU
tristate "SAMA5D2 PIOBU GPIO support"
+ depends on OF
depends on MFD_SYSCON
depends on ARCH_AT91 || COMPILE_TEST
select GPIO_SYSCON
@@ -672,6 +676,7 @@ config GPIO_SNPS_CREG
config GPIO_SPACEMIT_K1
tristate "SPACEMIT K1 GPIO support"
depends on ARCH_SPACEMIT || COMPILE_TEST
+ depends on OF
select GPIO_GENERIC
select GPIOLIB_IRQCHIP
help
@@ -737,6 +742,7 @@ config GPIO_TEGRA186
tristate "NVIDIA Tegra186 GPIO support"
default ARCH_TEGRA_186_SOC || ARCH_TEGRA_194_SOC || ARCH_TEGRA_234_SOC
depends on ARCH_TEGRA_186_SOC || ARCH_TEGRA_194_SOC || ARCH_TEGRA_234_SOC || COMPILE_TEST
+ depends on OF
select GPIOLIB_IRQCHIP
select IRQ_DOMAIN_HIERARCHY
help
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: fix up CONFIG_OF dependencies
2026-03-25 10:01 [PATCH] gpio: fix up CONFIG_OF dependencies Arnd Bergmann
@ 2026-03-25 10:32 ` Bartosz Golaszewski
2026-03-25 10:41 ` Arnd Bergmann
2026-03-26 8:41 ` Bartosz Golaszewski
1 sibling, 1 reply; 5+ messages in thread
From: Bartosz Golaszewski @ 2026-03-25 10:32 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Yixun Lan, Matthias Brugger,
AngeloGioacchino Del Regno, linux-gpio, linux-kernel, linux-riscv,
spacemit, linux-arm-kernel, linux-mediatek, Linus Walleij,
Bartosz Golaszewski
On Wed, 25 Mar 2026 11:01:14 +0100, Arnd Bergmann <arnd@kernel.org> said:
> From: Arnd Bergmann <arnd@arndb.de>
>
> A number of GPIO drivers that used to have a CONFIG_OF_GPIO dependency now fail
> to build on targets without CONFIG_OF:
>
> WARNING: unmet direct dependencies detected for GPIO_SYSCON
> Depends on [n]: GPIOLIB [=y] && HAS_IOMEM [=y] && MFD_SYSCON [=y] && OF [=n]
> Selected by [y]:
> - GPIO_SAMA5D2_PIOBU [=y] && GPIOLIB [=y] && HAS_IOMEM [=y] && MFD_SYSCON [=y] && (ARCH_AT91 || COMPILE_TEST [=y])
>
> drivers/gpio/gpio-mt7621.c: In function 'mediatek_gpio_bank_probe':
> drivers/gpio/gpio-mt7621.c:254:20: error: 'struct gpio_chip' has no member named 'of_gpio_n_cells'
> 254 | rg->chip.gc.of_gpio_n_cells = 2;
> | ^
> drivers/gpio/gpio-tegra186.c: In function 'tegra186_gpio_of_xlate':
> drivers/gpio/gpio-tegra186.c:502:25: error: 'struct gpio_chip' has no member named 'of_gpio_n_cells'
> 502 | if (WARN_ON(chip->of_gpio_n_cells < 2))
> | ^~
> drivers/gpio/gpio-lpc32xx.c: In function 'lpc32xx_gpio_probe':
> drivers/gpio/gpio-lpc32xx.c:523:49: error: 'struct gpio_chip' has no member named 'of_xlate'
> 523 | lpc32xx_gpiochip[i].chip.of_xlate = lpc32xx_of_xlate;
> | ^
> drivers/gpio/gpio-spacemit-k1.c: In function 'spacemit_gpio_add_bank':
> drivers/gpio/gpio-spacemit-k1.c:234:11: error: 'struct gpio_chip' has no member named 'of_gpio_n_cells'
> 234 | gc->of_gpio_n_cells = 3;
> | ^~
>
> Bring that back as a dependency.
>
> Fixes: 7803501e5754 ("gpio: drop unneeded Kconfig dependencies on OF_GPIO")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> There may be more fallout from the change, this is just what I found immediately,
> but you could already fold the changes into the broken patch while I look
> for additional ones.
> ---
Thanks and sorry for the breakage. However, I'm wondering if it wouldn't make
sense to do the following:
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 17511434ed077..ce0e0df68dbaa 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -473,7 +473,6 @@ struct gpio_chip {
struct gpio_irq_chip irq;
#endif /* CONFIG_GPIOLIB_IRQCHIP */
-#if defined(CONFIG_OF_GPIO)
/*
* If CONFIG_OF_GPIO is enabled, then all GPIO controllers described in
* the device tree automatically may have an OF translation
@@ -516,7 +515,6 @@ struct gpio_chip {
*/
int (*of_xlate)(struct gpio_chip *gc,
const struct of_phandle_args *gpiospec, u32 *flags);
-#endif /* CONFIG_OF_GPIO */
};
char *gpiochip_dup_line_label(struct gpio_chip *gc, unsigned int offset);
Symbols from linux/of.h are stubbed out and these drivers can build just fine
with !CONFIG_OF. This would naturally increase the build coverage.
Bartosz
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: fix up CONFIG_OF dependencies
2026-03-25 10:32 ` Bartosz Golaszewski
@ 2026-03-25 10:41 ` Arnd Bergmann
2026-03-26 8:39 ` Bartosz Golaszewski
0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2026-03-25 10:41 UTC (permalink / raw)
To: Bartosz Golaszewski, Arnd Bergmann
Cc: Yixun Lan, Matthias Brugger, AngeloGioacchino Del Regno,
open list:GPIO SUBSYSTEM, linux-kernel, linux-riscv, spacemit,
linux-arm-kernel, linux-mediatek, Linus Walleij
On Wed, Mar 25, 2026, at 11:32, Bartosz Golaszewski wrote:
> On Wed, 25 Mar 2026 11:01:14 +0100, Arnd Bergmann <arnd@kernel.org> said:
>>
>> WARNING: unmet direct dependencies detected for GPIO_SYSCON
>> Depends on [n]: GPIOLIB [=y] && HAS_IOMEM [=y] && MFD_SYSCON [=y] && OF [=n]
>> Selected by [y]:
>> - GPIO_SAMA5D2_PIOBU [=y] && GPIOLIB [=y] && HAS_IOMEM [=y] && MFD_SYSCON [=y] && (ARCH_AT91 || COMPILE_TEST [=y])
>>
>
> Thanks and sorry for the breakage. However, I'm wondering if it wouldn't make
> sense to do the following:
>
>
> -#if defined(CONFIG_OF_GPIO)
> /*
> * If CONFIG_OF_GPIO is enabled, then all GPIO controllers described in
> * the device tree automatically may have an OF translation
...
> Symbols from linux/of.h are stubbed out and these drivers can build just fine
> with !CONFIG_OF. This would naturally increase the build coverage.
I don't think we need to worry about the build coverage here, CONFIG_OF
is still included in x86 allmodconfig and half the randconfig builds,
so the drivers get enough exposure either way.
On the other hand, dropping the build time check may help avoid
future Kconfig dependency issues, so that still sounds like a
reasonable suggestion. At least CONFIG_GPIO_SAMA5D2_PIOBU
is going to need the 'depends on OF' regardless though to work
around the other build error I cited above.
Arnd
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: fix up CONFIG_OF dependencies
2026-03-25 10:41 ` Arnd Bergmann
@ 2026-03-26 8:39 ` Bartosz Golaszewski
0 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2026-03-26 8:39 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Yixun Lan, Matthias Brugger,
AngeloGioacchino Del Regno, open list:GPIO SUBSYSTEM,
linux-kernel, linux-riscv, spacemit, linux-arm-kernel,
linux-mediatek, Linus Walleij
On Wed, Mar 25, 2026 at 11:41 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Wed, Mar 25, 2026, at 11:32, Bartosz Golaszewski wrote:
> > On Wed, 25 Mar 2026 11:01:14 +0100, Arnd Bergmann <arnd@kernel.org> said:
> >>
> >> WARNING: unmet direct dependencies detected for GPIO_SYSCON
> >> Depends on [n]: GPIOLIB [=y] && HAS_IOMEM [=y] && MFD_SYSCON [=y] && OF [=n]
> >> Selected by [y]:
> >> - GPIO_SAMA5D2_PIOBU [=y] && GPIOLIB [=y] && HAS_IOMEM [=y] && MFD_SYSCON [=y] && (ARCH_AT91 || COMPILE_TEST [=y])
> >>
> >
> > Thanks and sorry for the breakage. However, I'm wondering if it wouldn't make
> > sense to do the following:
> >
> >
> > -#if defined(CONFIG_OF_GPIO)
> > /*
> > * If CONFIG_OF_GPIO is enabled, then all GPIO controllers described in
> > * the device tree automatically may have an OF translation
> ...
> > Symbols from linux/of.h are stubbed out and these drivers can build just fine
> > with !CONFIG_OF. This would naturally increase the build coverage.
>
> I don't think we need to worry about the build coverage here, CONFIG_OF
> is still included in x86 allmodconfig and half the randconfig builds,
> so the drivers get enough exposure either way.
>
> On the other hand, dropping the build time check may help avoid
> future Kconfig dependency issues, so that still sounds like a
> reasonable suggestion. At least CONFIG_GPIO_SAMA5D2_PIOBU
> is going to need the 'depends on OF' regardless though to work
> around the other build error I cited above.
>
> Arnd
Fair enough, I'll queue this patch.
Bart
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: fix up CONFIG_OF dependencies
2026-03-25 10:01 [PATCH] gpio: fix up CONFIG_OF dependencies Arnd Bergmann
2026-03-25 10:32 ` Bartosz Golaszewski
@ 2026-03-26 8:41 ` Bartosz Golaszewski
1 sibling, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2026-03-26 8:41 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, Arnd Bergmann
Cc: Bartosz Golaszewski, Arnd Bergmann, Yixun Lan, Matthias Brugger,
AngeloGioacchino Del Regno, linux-gpio, linux-kernel, linux-riscv,
spacemit, linux-arm-kernel, linux-mediatek
On Wed, 25 Mar 2026 11:01:14 +0100, Arnd Bergmann wrote:
> A number of GPIO drivers that used to have a CONFIG_OF_GPIO dependency now fail
> to build on targets without CONFIG_OF:
>
> WARNING: unmet direct dependencies detected for GPIO_SYSCON
> Depends on [n]: GPIOLIB [=y] && HAS_IOMEM [=y] && MFD_SYSCON [=y] && OF [=n]
> Selected by [y]:
> - GPIO_SAMA5D2_PIOBU [=y] && GPIOLIB [=y] && HAS_IOMEM [=y] && MFD_SYSCON [=y] && (ARCH_AT91 || COMPILE_TEST [=y])
>
> [...]
Applied, thanks!
[1/1] gpio: fix up CONFIG_OF dependencies
https://git.kernel.org/brgl/c/af475c16bc02a08ed6af6ca0c920f98a45611fe6
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-26 8:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 10:01 [PATCH] gpio: fix up CONFIG_OF dependencies Arnd Bergmann
2026-03-25 10:32 ` Bartosz Golaszewski
2026-03-25 10:41 ` Arnd Bergmann
2026-03-26 8:39 ` Bartosz Golaszewski
2026-03-26 8:41 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox