[v3,21/38] parport: PC style parport depends on HAS_IOPORT

Message ID 20230314121216.413434-22-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. As PC style parport uses these functions we need to
handle this dependency.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/parport/Kconfig | 4 ++--
 include/linux/parport.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
  

Comments

Arnd Bergmann March 14, 2023, 2:12 p.m. UTC | #1
On Tue, Mar 14, 2023, at 13:11, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. As PC style parport uses these functions we need to
> handle this dependency.
>
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

> 
>  menuconfig PARPORT
>  	tristate "Parallel port support"
> -	depends on HAS_IOMEM

I would leave this dependency, or maybe make it 'HAS_IOMEM || HAS_IOPORT'.
at least the parport_atari driver uses MMIO instead of PIO.

>  	help
>  	  If you want to use devices connected to your machine's parallel port
>  	  (the connector at the computer with 25 holes), e.g. printer, ZIP
> @@ -42,7 +41,8 @@ if PARPORT
> 
>  config PARPORT_PC
>  	tristate "PC-style hardware"
> -	depends on ARCH_MIGHT_HAVE_PC_PARPORT || (PCI && !S390)
> +	depends on ARCH_MIGHT_HAVE_PC_PARPORT
> +	depends on HAS_IOPORT
>  	help
>  	  You should say Y here if you have a PC-style parallel port. All
>  	  IBM PC compatible computers and some Alphas have PC-style

This would revert 66bcd06099bb ("parport_pc: Also enable driver for
PCI systems"), so I think this is wrong. You can drop the !S390
by adding HAS_IOPORT as a dependency, but the other line should still
be 

       depends on ARCH_MIGHT_HAVE_PC_PARPORT || PCI
    

    Arnd
  
Niklas Schnelle May 2, 2023, 1:40 p.m. UTC | #2
On Tue, 2023-03-14 at 15:12 +0100, Arnd Bergmann wrote:
> > On Tue, Mar 14, 2023, at 13:11, Niklas Schnelle wrote:
> > > > In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> > > > not being declared. As PC style parport uses these functions we need to
> > > > handle this dependency.
> > > > 
> > > > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > > > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > 
> > > > 
> > > >  menuconfig PARPORT
> > > >  	tristate "Parallel port support"
> > > > -	depends on HAS_IOMEM
> > 
> > I would leave this dependency, or maybe make it 'HAS_IOMEM || HAS_IOPORT'.
> > at least the parport_atari driver uses MMIO instead of PIO.
> > 
> > > >  	help
> > > >  	  If you want to use devices connected to your machine's parallel port
> > > >  	  (the connector at the computer with 25 holes), e.g. printer, ZIP
> > > > @@ -42,7 +41,8 @@ if PARPORT
> > > > 
> > > >  config PARPORT_PC
> > > >  	tristate "PC-style hardware"
> > > > -	depends on ARCH_MIGHT_HAVE_PC_PARPORT || (PCI && !S390)
> > > > +	depends on ARCH_MIGHT_HAVE_PC_PARPORT
> > > > +	depends on HAS_IOPORT
> > > >  	help
> > > >  	  You should say Y here if you have a PC-style parallel port. All
> > > >  	  IBM PC compatible computers and some Alphas have PC-style
> > 
> > This would revert 66bcd06099bb ("parport_pc: Also enable driver for
> > PCI systems"), so I think this is wrong. You can drop the !S390
> > by adding HAS_IOPORT as a dependency, but the other line should still
> > be 
> > 
> >        depends on ARCH_MIGHT_HAVE_PC_PARPORT || PCI
> >     
> > 
> >     Arnd

Ok changed for v4. Just saw that commit even nicely references our lack
of I/O ports :-)
  
Bjorn Helgaas May 2, 2023, 3:30 p.m. UTC | #3
The wording of this subject line is a bit ambiguous and doesn't quite
say what the patch does.

It reads like a statement of fact, i.e., "this is the current state,"
but I think the patch actually *adds* a HAS_IOPORT dependency like
many of the other patches.

I guess it also *removes* a HAS_IOMEM dependency; I didn't investigate
to figure out why that is or whether it's even related (I guess it is,
but I don't know how).

On Tue, Mar 14, 2023 at 01:11:59PM +0100, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. As PC style parport uses these functions we need to
> handle this dependency.
> 
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
>  drivers/parport/Kconfig | 4 ++--
>  include/linux/parport.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/parport/Kconfig b/drivers/parport/Kconfig
> index 5561362224e2..5c471c73629f 100644
> --- a/drivers/parport/Kconfig
> +++ b/drivers/parport/Kconfig
> @@ -14,7 +14,6 @@ config ARCH_MIGHT_HAVE_PC_PARPORT
>  
>  menuconfig PARPORT
>  	tristate "Parallel port support"
> -	depends on HAS_IOMEM
>  	help
>  	  If you want to use devices connected to your machine's parallel port
>  	  (the connector at the computer with 25 holes), e.g. printer, ZIP
> @@ -42,7 +41,8 @@ if PARPORT
>  
>  config PARPORT_PC
>  	tristate "PC-style hardware"
> -	depends on ARCH_MIGHT_HAVE_PC_PARPORT || (PCI && !S390)
> +	depends on ARCH_MIGHT_HAVE_PC_PARPORT
> +	depends on HAS_IOPORT
>  	help
>  	  You should say Y here if you have a PC-style parallel port. All
>  	  IBM PC compatible computers and some Alphas have PC-style
> diff --git a/include/linux/parport.h b/include/linux/parport.h
> index a0bc9e0267b7..fff39bc30629 100644
> --- a/include/linux/parport.h
> +++ b/include/linux/parport.h
> @@ -514,7 +514,7 @@ extern int parport_device_proc_register(struct pardevice *device);
>  extern int parport_device_proc_unregister(struct pardevice *device);
>  
>  /* If PC hardware is the only type supported, we can optimise a bit.  */
> -#if !defined(CONFIG_PARPORT_NOT_PC)
> +#if !defined(CONFIG_PARPORT_NOT_PC) && defined(CONFIG_PARPORT_PC)
>  
>  #include <linux/parport_pc.h>
>  #define parport_write_data(p,x)            parport_pc_write_data(p,x)
> -- 
> 2.37.2
>
  

Patch

diff --git a/drivers/parport/Kconfig b/drivers/parport/Kconfig
index 5561362224e2..5c471c73629f 100644
--- a/drivers/parport/Kconfig
+++ b/drivers/parport/Kconfig
@@ -14,7 +14,6 @@  config ARCH_MIGHT_HAVE_PC_PARPORT
 
 menuconfig PARPORT
 	tristate "Parallel port support"
-	depends on HAS_IOMEM
 	help
 	  If you want to use devices connected to your machine's parallel port
 	  (the connector at the computer with 25 holes), e.g. printer, ZIP
@@ -42,7 +41,8 @@  if PARPORT
 
 config PARPORT_PC
 	tristate "PC-style hardware"
-	depends on ARCH_MIGHT_HAVE_PC_PARPORT || (PCI && !S390)
+	depends on ARCH_MIGHT_HAVE_PC_PARPORT
+	depends on HAS_IOPORT
 	help
 	  You should say Y here if you have a PC-style parallel port. All
 	  IBM PC compatible computers and some Alphas have PC-style
diff --git a/include/linux/parport.h b/include/linux/parport.h
index a0bc9e0267b7..fff39bc30629 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -514,7 +514,7 @@  extern int parport_device_proc_register(struct pardevice *device);
 extern int parport_device_proc_unregister(struct pardevice *device);
 
 /* If PC hardware is the only type supported, we can optimise a bit.  */
-#if !defined(CONFIG_PARPORT_NOT_PC)
+#if !defined(CONFIG_PARPORT_NOT_PC) && defined(CONFIG_PARPORT_PC)
 
 #include <linux/parport_pc.h>
 #define parport_write_data(p,x)            parport_pc_write_data(p,x)