[v3,09/38] gpio: add HAS_IOPORT dependencies

Message ID 20230314121216.413434-10-schnelle@linux.ibm.com
State New
Headers
Series Kconfig: Introduce HAS_IOPORT config option |

Commit Message

Niklas Schnelle March 14, 2023, 12:11 p.m. UTC
  In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to add HAS_IOPORT as dependency for
those drivers using them.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/gpio/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Linus Walleij March 15, 2023, 8:42 a.m. UTC | #1
Hi Niklas,

thanks for your patch!

On Tue, Mar 14, 2023 at 1:12 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:
>
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to add HAS_IOPORT as dependency for
> those drivers using them.
>
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
>  drivers/gpio/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 13be729710f2..5a874e67fc13 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -688,7 +688,7 @@ config GPIO_VISCONTI
>
>  config GPIO_VX855
>         tristate "VIA VX855/VX875 GPIO"
> -       depends on (X86 || COMPILE_TEST) && PCI
> +       depends on (X86 || COMPILE_TEST) && PCI && HAS_IOPORT

But is this the right fix? Further down in the Kconfig we have:

menu "Port-mapped I/O GPIO drivers"
        depends on X86 # Unconditional I/O space access

config GPIO_I8255
        tristate
        select GPIO_REGMAP

(...)

Isn't the right fix to:

1) Move this Kconfig entry (VX855) down under the Port-mapped /O drivers,
   and then:

2) Make the whole submenu for port-mapped IO drivers depend on
   X86 && HAS_IOPORT

Yours,
Linus Walleij
  
Niklas Schnelle April 28, 2023, 2:41 p.m. UTC | #2
On Wed, 2023-03-15 at 09:42 +0100, Linus Walleij wrote:
> Hi Niklas,
> 
> thanks for your patch!
> 
> On Tue, Mar 14, 2023 at 1:12 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:
> > 
> > In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> > not being declared. We thus need to add HAS_IOPORT as dependency for
> > those drivers using them.
> > 
> > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > ---
> >  drivers/gpio/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> > index 13be729710f2..5a874e67fc13 100644
> > --- a/drivers/gpio/Kconfig
> > +++ b/drivers/gpio/Kconfig
> > @@ -688,7 +688,7 @@ config GPIO_VISCONTI
> > 
> >  config GPIO_VX855
> >         tristate "VIA VX855/VX875 GPIO"
> > -       depends on (X86 || COMPILE_TEST) && PCI
> > +       depends on (X86 || COMPILE_TEST) && PCI && HAS_IOPORT
> 
> But is this the right fix? Further down in the Kconfig we have:
> 
> menu "Port-mapped I/O GPIO drivers"
>         depends on X86 # Unconditional I/O space access
> 
> config GPIO_I8255
>         tristate
>         select GPIO_REGMAP
> 
> (...)
> 
> Isn't the right fix to:
> 
> 1) Move this Kconfig entry (VX855) down under the Port-mapped /O drivers,
>    and then:
> 
> 2) Make the whole submenu for port-mapped IO drivers depend on
>    X86 && HAS_IOPORT
> 
> Yours,
> Linus Walleij

Makes sense I changed it to the above approach for v4. One thing this
makes me wonder is if then one should change the X86 dependency to at
least X86 || COMPILE_TEST or even remove it and rely on HAS_IOPORT. The
comment there at least suggests that it is there only for the I/O space
access.

Thanks,
Niklas
  
Linus Walleij May 1, 2023, 12:29 p.m. UTC | #3
On Fri, Apr 28, 2023 at 4:45 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:

> Makes sense I changed it to the above approach for v4. One thing this
> makes me wonder is if then one should change the X86 dependency to at
> least X86 || COMPILE_TEST or even remove it and rely on HAS_IOPORT.

Hm it makes sense I think. I don't know if there may be other
X86 deps in these drivers but we don't know until we tried.

Yours,
Linus Walleij
  

Patch

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 13be729710f2..5a874e67fc13 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -688,7 +688,7 @@  config GPIO_VISCONTI
 
 config GPIO_VX855
 	tristate "VIA VX855/VX875 GPIO"
-	depends on (X86 || COMPILE_TEST) && PCI
+	depends on (X86 || COMPILE_TEST) && PCI && HAS_IOPORT
 	select MFD_CORE
 	select MFD_VX855
 	help