linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option
@ 2023-03-14 12:11 Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary Niklas Schnelle
                   ` (38 more replies)
  0 siblings, 39 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Richard Cochran, Paul Walmsley, Palmer Dabbelt, Albert Ou
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, linux-kernel, linux-arch, linux-pci, netdev,
	linux-riscv

Hello Kernel Hackers,

Some platforms such as s390 do not support PCI I/O spaces. On such platforms
I/O space accessors like inb()/outb() are stubs that can never actually work.
The way these stubs are implemented in asm-generic/io.h leads to compiler
warnings because any use will be a NULL pointer access on these platforms. In
a previous patch we tried handling this with a run-time warning on access. This
approach however was rejected by Linus[0] with the argument that this really
should be a compile-time check and, though a much more invasive change, we
believe that is indeed the right approach.

This patch series aims to do exactly that by introducing a HAS_IOPORT config
option akin to the existing HAS_IOMEM. When this is unset inb()/outb() and
friends may not be defined. This is also the same approach originally planned by
Uwe Kleine-König as mentioned in commit ce816fa88cca ("Kconfig: rename
HAS_IOPORT to HAS_IOPORT_MAP").

This series builds heavily on an original patch for demonstating the concept by
Arnd Bergmann[1] and incoporates feedback of previous RFC versions [2] and [3].

This version is based on v6.3-rc1 and is also available on my kernel.org tree
in the has_ioport_v3 branch with the PGP signed tag has_ioport_v3_signed:

https://git.kernel.org/pub/scm/linux/kernel/git/niks/linux.git

Thanks,
Niklas Schnelle

Changes from RFC v2:
- Rebased on v6.3-rc1
- Fixed a NULL pointer dereference in set_io_from_upio() due to accidentially
  expanded #ifdef CONFIG_SERIAL_8250_RT288X (kernel test robot)
- Dropped "ACPI: add dependency on HAS_IOPORT" (Bjorn Helgaas)
- Reworded commit message and moved ifdefs for "PCI/sysfs: Make I/O resource
  depend on HAS_IOPORT" (Bjorn Helgaas)
- Instead of complete removal inb() etc. are marked with __compiletime_error()
  when HAS_IOPORT is unset allowing for better error reporting (Ahmad Fatoum)
- Removed HAS_IOPORT dependency from PCMCIA as I/O port use is optional in at
  least PC Card. Instead added HAS_IOPORT on a per driver basis. (Bjorn
  Helgaas)
- Made uhci_has_pci_registers() constant 0 if HAS_IOPORT is not defined (Alan
  Stern)

Changes from RFC v1:
- Completely dropped the LEGACY_PCI option and replaced its dependencies with
  HAS_IOPORT as appropriate
- In the usb subsystem patch I incorporated the feedback from v1 by Alan Stern:
  - Used a local macro to nop in*()/out*() in the helpers
  - Removed an unnecessary further restriction on CONFIG_USB_UHCI_HCD
- Added a few more subsystems including wireless, ptp, and, mISDN that I had
  previously missed due to a blanket !S390.
- Removed blanket !S390 dependencies where they are added due to the I/O port
  problem
- In the sound system SND_OPL3_LIB needed to use "depends on" instead of
  "select" because of its added HAS_IOPORT dependency
- In the drm subsystem the bochs driver gets #ifdefs instead of a blanket
  dependency because its MMIO capable device variant should work without
  HAS_IOPORT.

[0] https://lore.kernel.org/lkml/CAHk-=wg80je=K7madF4e7WrRNp37e3qh6y10Svhdc7O8SZ_-8g@mail.gmail.com/
[1] https://lore.kernel.org/lkml/CAK8P3a0MNbx-iuzW_-=0ab6-TTZzwV-PT_6gAC1Gp5PgYyHcrA@mail.gmail.com/
[2] https://yhbt.net/lore/all/20211227164317.4146918-1-schnelle@linux.ibm.com/
[3] https://lore.kernel.org/all/20220429135108.2781579-1-schnelle@linux.ibm.com/

Niklas Schnelle (38):
  Kconfig: introduce HAS_IOPORT option and select it as necessary
  ata: add HAS_IOPORT dependencies
  char: impi, tpm: depend on HAS_IOPORT
  comedi: add HAS_IOPORT dependencies
  counter: add HAS_IOPORT dependencies
  /dev/port: don't compile file operations without CONFIG_DEVPORT
  drm: handle HAS_IOPORT dependencies
  firmware: dmi-sysfs: handle HAS_IOPORT=n
  gpio: add HAS_IOPORT dependencies
  hwmon: add HAS_IOPORT dependencies
  i2c: add HAS_IOPORT dependencies
  iio: ad7606: Kconfig: add HAS_IOPORT dependencies
  Input: add HAS_IOPORT dependencies
  Input: gameport: add ISA and HAS_IOPORT dependencies
  leds: add HAS_IOPORT dependencies
  media: add HAS_IOPORT dependencies
  misc: add HAS_IOPORT dependencies
  mISDN: add HAS_IOPORT dependencies
  mpt fusion: add HAS_IOPORT dependencies
  net: handle HAS_IOPORT dependencies
  parport: PC style parport depends on HAS_IOPORT
  PCI: Make quirk using inw() depend on HAS_IOPORT
  PCI/sysfs: Make I/O resource depend on HAS_IOPORT
  pcmcia: add HAS_IOPORT dependencies
  platform: add HAS_IOPORT dependencies
  pnp: add HAS_IOPORT dependencies
  power: add HAS_IOPORT dependencies
  rtc: add HAS_IOPORT dependencies
  scsi: add HAS_IOPORT dependencies
  sound: add HAS_IOPORT dependencies
  speakup: add HAS_IOPORT dependency for SPEAKUP_SERIALIO
  staging: add HAS_IOPORT dependencies
  tty: serial: handle HAS_IOPORT dependencies
  usb: handle HAS_IOPORT dependencies
  video: handle HAS_IOPORT dependencies
  watchdog: add HAS_IOPORT dependencies
  wireless: add HAS_IOPORT dependencies
  asm-generic/io.h: drop inb() etc for HAS_IOPORT=n

 arch/alpha/Kconfig                           |   1 +
 arch/arm/Kconfig                             |   1 +
 arch/arm64/Kconfig                           |   1 +
 arch/ia64/Kconfig                            |   1 +
 arch/m68k/Kconfig                            |   1 +
 arch/microblaze/Kconfig                      |   1 +
 arch/mips/Kconfig                            |   2 +
 arch/parisc/Kconfig                          |   2 +
 arch/powerpc/Kconfig                         |   2 +-
 arch/riscv/Kconfig                           |   1 +
 arch/sh/Kconfig                              |   1 +
 arch/sparc/Kconfig                           |   1 +
 arch/um/Kconfig                              |   1 +
 arch/x86/Kconfig                             |   2 +
 drivers/accessibility/speakup/Kconfig        |   1 +
 drivers/ata/Kconfig                          |   1 +
 drivers/bus/Kconfig                          |   2 +-
 drivers/char/Kconfig                         |   3 +-
 drivers/char/ipmi/Makefile                   |  11 +-
 drivers/char/ipmi/ipmi_si_intf.c             |   3 +-
 drivers/char/ipmi/ipmi_si_pci.c              |   3 +
 drivers/char/mem.c                           |   6 +-
 drivers/char/pcmcia/Kconfig                  |   8 +-
 drivers/char/tpm/Kconfig                     |   1 +
 drivers/char/tpm/tpm_infineon.c              |  14 ++-
 drivers/char/tpm/tpm_tis_core.c              |  19 ++-
 drivers/comedi/Kconfig                       | 103 +++++++++------
 drivers/counter/Kconfig                      |   1 +
 drivers/eisa/Kconfig                         |   1 +
 drivers/firmware/dmi-sysfs.c                 |   4 +
 drivers/gpio/Kconfig                         |   2 +-
 drivers/gpu/drm/qxl/Kconfig                  |   1 +
 drivers/gpu/drm/tiny/bochs.c                 |  19 +++
 drivers/gpu/drm/tiny/cirrus.c                |   2 +
 drivers/hwmon/Kconfig                        |  21 +++-
 drivers/i2c/busses/Kconfig                   |  31 ++---
 drivers/iio/adc/Kconfig                      |   2 +-
 drivers/input/gameport/Kconfig               |   4 +-
 drivers/input/serio/Kconfig                  |   2 +
 drivers/input/touchscreen/Kconfig            |   1 +
 drivers/isdn/Kconfig                         |   1 -
 drivers/isdn/hardware/mISDN/Kconfig          |  12 +-
 drivers/leds/Kconfig                         |   2 +-
 drivers/media/pci/dm1105/Kconfig             |   2 +-
 drivers/media/radio/Kconfig                  |  14 ++-
 drivers/media/rc/Kconfig                     |   6 +
 drivers/message/fusion/Kconfig               |   2 +-
 drivers/misc/altera-stapl/Makefile           |   3 +-
 drivers/misc/altera-stapl/altera.c           |   6 +-
 drivers/net/Kconfig                          |   2 +-
 drivers/net/arcnet/Kconfig                   |   2 +-
 drivers/net/can/cc770/Kconfig                |   1 +
 drivers/net/can/sja1000/Kconfig              |   1 +
 drivers/net/ethernet/3com/Kconfig            |   4 +-
 drivers/net/ethernet/8390/Kconfig            |   6 +-
 drivers/net/ethernet/amd/Kconfig             |   4 +-
 drivers/net/ethernet/fujitsu/Kconfig         |   2 +-
 drivers/net/ethernet/intel/Kconfig           |   2 +-
 drivers/net/ethernet/sis/Kconfig             |   4 +-
 drivers/net/ethernet/smsc/Kconfig            |   2 +-
 drivers/net/ethernet/ti/Kconfig              |   2 +-
 drivers/net/ethernet/via/Kconfig             |   1 +
 drivers/net/ethernet/xircom/Kconfig          |   2 +-
 drivers/net/fddi/Kconfig                     |   2 +-
 drivers/net/fddi/defxx.c                     |   2 +-
 drivers/net/hamradio/Kconfig                 |   6 +-
 drivers/net/wan/Kconfig                      |   2 +-
 drivers/net/wireless/atmel/Kconfig           |   2 +-
 drivers/net/wireless/intersil/hostap/Kconfig |   2 +-
 drivers/parport/Kconfig                      |   4 +-
 drivers/pci/pci-sysfs.c                      |   4 +
 drivers/pci/quirks.c                         |   2 +
 drivers/pcmcia/Kconfig                       |   5 +-
 drivers/platform/chrome/Kconfig              |   1 +
 drivers/platform/chrome/wilco_ec/Kconfig     |   1 +
 drivers/pnp/isapnp/Kconfig                   |   2 +-
 drivers/power/reset/Kconfig                  |   1 +
 drivers/rtc/Kconfig                          |   4 +-
 drivers/scsi/Kconfig                         |  25 ++--
 drivers/scsi/aic7xxx/Kconfig.aic79xx         |   2 +-
 drivers/scsi/aic7xxx/Kconfig.aic7xxx         |   2 +-
 drivers/scsi/aic94xx/Kconfig                 |   2 +-
 drivers/scsi/megaraid/Kconfig.megaraid       |   6 +-
 drivers/scsi/mvsas/Kconfig                   |   2 +-
 drivers/scsi/pcmcia/Kconfig                  |   6 +-
 drivers/scsi/qla2xxx/Kconfig                 |   2 +-
 drivers/staging/sm750fb/Kconfig              |   2 +-
 drivers/staging/vt6655/Kconfig               |   2 +-
 drivers/tty/Kconfig                          |   2 +-
 drivers/tty/serial/8250/8250_early.c         |   4 +
 drivers/tty/serial/8250/8250_pci.c           |  14 +++
 drivers/tty/serial/8250/8250_port.c          |  44 +++++--
 drivers/tty/serial/8250/Kconfig              |   5 +-
 drivers/tty/serial/Kconfig                   |   2 +-
 drivers/usb/core/hcd-pci.c                   |   2 +
 drivers/usb/host/Kconfig                     |   4 +-
 drivers/usb/host/pci-quirks.c                | 125 ++++++++++---------
 drivers/usb/host/pci-quirks.h                |  31 +++--
 drivers/usb/host/uhci-hcd.c                  |   2 +-
 drivers/usb/host/uhci-hcd.h                  |  36 ++++--
 drivers/video/console/Kconfig                |   1 +
 drivers/video/fbdev/Kconfig                  |  25 ++--
 drivers/watchdog/Kconfig                     |   6 +-
 include/asm-generic/io.h                     |  60 +++++++++
 include/linux/gameport.h                     |   9 +-
 include/linux/parport.h                      |   2 +-
 include/video/vga.h                          |   8 ++
 lib/Kconfig                                  |   4 +
 lib/Kconfig.kgdb                             |   3 +-
 net/ax25/Kconfig                             |   2 +-
 sound/drivers/Kconfig                        |   3 +
 sound/isa/Kconfig                            |  31 ++++-
 sound/pci/Kconfig                            |  45 +++++--
 sound/pcmcia/Kconfig                         |   2 +
 114 files changed, 649 insertions(+), 281 deletions(-)


base-commit: eeac8ede17557680855031c6f305ece2378af326
-- 
2.37.2


^ permalink raw reply	[flat|nested] 110+ messages in thread

* [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:37   ` Johannes Berg
                     ` (3 more replies)
  2023-03-14 12:11 ` [PATCH v3 02/38] ata: add HAS_IOPORT dependencies Niklas Schnelle
                   ` (37 subsequent siblings)
  38 siblings, 4 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	Russell King, Catalin Marinas, Will Deacon, Geert Uytterhoeven,
	Michal Simek, Thomas Bogendoerfer, James E.J. Bottomley,
	Helge Deller, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
	David S. Miller, Richard Weinberger, Anton Ivanov, Johannes Berg,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-alpha,
	linux-arm-kernel, linux-ia64, linux-m68k, linux-mips,
	linux-parisc, linuxppc-dev, linux-riscv, linux-sh, sparclinux,
	linux-um

We introduce a new HAS_IOPORT Kconfig option to indicate support for I/O
Port access. In a future patch HAS_IOPORT=n will disable compilation of
the I/O accessor functions inb()/outb() and friends on architectures
which can not meaningfully support legacy I/O spaces such as s390. Also
add dependencies on HAS_IOPORT for the ISA and HAVE_EISA config options
as these busses always go along with HAS_IOPORT.

The "depends on" relations on HAS_IOPORT in drivers as well as ifdefs
for HAS_IOPORT specific sections will be added in subsequent patches on
a per subsystem basis.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 arch/alpha/Kconfig      | 1 +
 arch/arm/Kconfig        | 1 +
 arch/arm64/Kconfig      | 1 +
 arch/ia64/Kconfig       | 1 +
 arch/m68k/Kconfig       | 1 +
 arch/microblaze/Kconfig | 1 +
 arch/mips/Kconfig       | 2 ++
 arch/parisc/Kconfig     | 2 ++
 arch/powerpc/Kconfig    | 2 +-
 arch/riscv/Kconfig      | 1 +
 arch/sh/Kconfig         | 1 +
 arch/sparc/Kconfig      | 1 +
 arch/um/Kconfig         | 1 +
 arch/x86/Kconfig        | 2 ++
 drivers/bus/Kconfig     | 2 +-
 drivers/eisa/Kconfig    | 1 +
 lib/Kconfig             | 4 ++++
 lib/Kconfig.kgdb        | 3 ++-
 18 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 780d4673c3ca..a5c2b1aa46b0 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -27,6 +27,7 @@ config ALPHA
 	select AUDIT_ARCH
 	select GENERIC_CPU_VULNERABILITIES
 	select GENERIC_SMP_IDLE_THREAD
+	select HAS_IOPORT
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_MOD_ARCH_SPECIFIC
 	select MODULES_USE_ELF_RELA
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e24a9820e12f..4acb5bc4b52a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -70,6 +70,7 @@ config ARM
 	select GENERIC_SCHED_CLOCK
 	select GENERIC_SMP_IDLE_THREAD
 	select HARDIRQS_SW_RESEND
+	select HAS_IOPORT
 	select HAVE_ARCH_AUDITSYSCALL if AEABI && !OABI_COMPAT
 	select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6
 	select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 1023e896d46b..b740019c4aee 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -145,6 +145,7 @@ config ARM64
 	select GENERIC_GETTIMEOFDAY
 	select GENERIC_VDSO_TIME_NS
 	select HARDIRQS_SW_RESEND
+	select HAS_IOPORT
 	select HAVE_MOVE_PMD
 	select HAVE_MOVE_PUD
 	select HAVE_PCI
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index d7e4a24e8644..2e13ec8263b9 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -25,6 +25,7 @@ config IA64
 	select PCI_DOMAINS if PCI
 	select PCI_MSI
 	select PCI_SYSCALL if PCI
+	select HAS_IOPORT
 	select HAVE_ASM_MODVERSIONS
 	select HAVE_UNSTABLE_SCHED_CLOCK
 	select HAVE_EXIT_THREAD
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 82154952e574..40198a1ebe27 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -18,6 +18,7 @@ config M68K
 	select GENERIC_CPU_DEVICES
 	select GENERIC_IOMAP
 	select GENERIC_IRQ_SHOW
+	select HAS_IOPORT if PCI || ISA || ATARI_ROM_ISA
 	select HAVE_ARCH_SECCOMP
 	select HAVE_ARCH_SECCOMP_FILTER
 	select HAVE_ASM_MODVERSIONS
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index cc88af6fa7a4..211f338d6235 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -21,6 +21,7 @@ config MICROBLAZE
 	select GENERIC_IRQ_SHOW
 	select GENERIC_PCI_IOMAP
 	select GENERIC_SCHED_CLOCK
+	select HAS_IOPORT if PCI
 	select HAVE_ARCH_HASH
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_SECCOMP
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index e2f3ca73f40d..64760fcd7b52 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -47,6 +47,7 @@ config MIPS
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_TIME_VSYSCALL
 	select GUP_GET_PXX_LOW_HIGH if CPU_MIPS32 && PHYS_ADDR_T_64BIT
+	select HAS_IOPORT if !NO_IOPORT_MAP
 	select HAVE_ARCH_COMPILER_H
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_KGDB if MIPS_FP_SUPPORT
@@ -3120,6 +3121,7 @@ config PCI_DRIVERS_LEGACY
 # users to choose the right thing ...
 #
 config ISA
+	depends on HAS_IOPORT
 	bool
 
 config TC
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index a98940e64243..5eeacc72e4da 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -47,6 +47,7 @@ config PARISC
 	select MODULES_USE_ELF_RELA
 	select CLONE_BACKWARDS
 	select TTY # Needed for pdc_cons.c
+	select HAS_IOPORT if PCI
 	select HAVE_DEBUG_STACKOVERFLOW
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_HASH
@@ -131,6 +132,7 @@ config STACKTRACE_SUPPORT
 
 config ISA_DMA_API
 	bool
+	depends on HAS_IOPORT
 
 config ARCH_MAY_HAVE_PC_FDC
 	bool
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a6c4407d3ec8..f7de646c074a 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -188,6 +188,7 @@ config PPC
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_TIME_VSYSCALL
 	select GENERIC_VDSO_TIME_NS
+	select HAS_IOPORT			if PCI
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_HUGE_VMALLOC		if HAVE_ARCH_HUGE_VMAP
 	select HAVE_ARCH_HUGE_VMAP		if PPC_RADIX_MMU || PPC_8xx
@@ -1070,7 +1071,6 @@ menu "Bus options"
 
 config ISA
 	bool "Support for ISA-bus hardware"
-	depends on PPC_CHRP
 	select PPC_I8259
 	help
 	  Find out whether you have ISA slots on your motherboard.  ISA is the
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index c5e42cc37604..b957d12a171b 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -74,6 +74,7 @@ config RISCV
 	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
 	select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
 	select HARDIRQS_SW_RESEND
+	select HAS_IOPORT if MMU
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
 	select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 0665ac0add0b..cfb797bc4200 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -25,6 +25,7 @@ config SUPERH
 	select GENERIC_SCHED_CLOCK
 	select GENERIC_SMP_IDLE_THREAD
 	select GUP_GET_PXX_LOW_HIGH if X2TLB
+	select HAS_IOPORT if HAS_IOPORT_MAP
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_SECCOMP_FILTER
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 84437a4c6545..d4c1d96f85cd 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -32,6 +32,7 @@ config SPARC
 	select GENERIC_IRQ_SHOW
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select GENERIC_PCI_IOMAP
+	select HAS_IOPORT
 	select HAVE_NMI_WATCHDOG if SPARC64
 	select HAVE_CBPF_JIT if SPARC32
 	select HAVE_EBPF_JIT if SPARC64
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 541a9b18e343..452d268be2e8 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -56,6 +56,7 @@ config NO_IOPORT_MAP
 
 config ISA
 	bool
+	depends on HAS_IOPORT
 
 config SBUS
 	bool
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a825bf031f49..634dd42532f3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -162,6 +162,7 @@ config X86
 	select GUP_GET_PXX_LOW_HIGH		if X86_PAE
 	select HARDIRQS_SW_RESEND
 	select HARDLOCKUP_CHECK_TIMESTAMP	if X86_64
+	select HAS_IOPORT
 	select HAVE_ACPI_APEI			if ACPI
 	select HAVE_ACPI_APEI_NMI		if ACPI
 	select HAVE_ALIGNED_STRUCT_PAGE		if SLUB
@@ -2893,6 +2894,7 @@ if X86_32
 
 config ISA
 	bool "ISA support"
+	depends on HAS_IOPORT
 	help
 	  Find out whether you have ISA slots on your motherboard.  ISA is the
 	  name of a bus system, i.e. the way the CPU talks to the other stuff
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index 7bfe998f3514..fcfa280df98a 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -81,7 +81,7 @@ config MOXTET
 config HISILICON_LPC
 	bool "Support for ISA I/O space on HiSilicon Hip06/7"
 	depends on (ARM64 && ARCH_HISI) || (COMPILE_TEST && !ALPHA && !HEXAGON && !PARISC)
-	depends on HAS_IOMEM
+	depends on HAS_IOPORT
 	select INDIRECT_PIO if ARM64
 	help
 	  Driver to enable I/O access to devices attached to the Low Pin
diff --git a/drivers/eisa/Kconfig b/drivers/eisa/Kconfig
index c8bbf90209f5..d3f62de72259 100644
--- a/drivers/eisa/Kconfig
+++ b/drivers/eisa/Kconfig
@@ -5,6 +5,7 @@
 
 config HAVE_EISA
 	bool
+	depends on HAS_IOPORT
 
 menuconfig EISA
 	bool "EISA support"
diff --git a/lib/Kconfig b/lib/Kconfig
index ce2abffb9ed8..5c2da561c516 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -92,6 +92,7 @@ config ARCH_USE_SYM_ANNOTATIONS
 config INDIRECT_PIO
 	bool "Access I/O in non-MMIO mode"
 	depends on ARM64
+	depends on HAS_IOPORT
 	help
 	  On some platforms where no separate I/O space exists, there are I/O
 	  hosts which can not be accessed in MMIO mode. Using the logical PIO
@@ -509,6 +510,9 @@ config HAS_IOMEM
 	depends on !NO_IOMEM
 	default y
 
+config HAS_IOPORT
+	bool
+
 config HAS_IOPORT_MAP
 	bool
 	depends on HAS_IOMEM && !NO_IOPORT_MAP
diff --git a/lib/Kconfig.kgdb b/lib/Kconfig.kgdb
index 3b9a44008433..c68e4d9dcecb 100644
--- a/lib/Kconfig.kgdb
+++ b/lib/Kconfig.kgdb
@@ -121,7 +121,8 @@ config KDB_DEFAULT_ENABLE
 
 config KDB_KEYBOARD
 	bool "KGDB_KDB: keyboard as input device"
-	depends on VT && KGDB_KDB && !PARISC
+	depends on HAS_IOPORT
+	depends on VT && KGDB_KDB
 	default n
 	help
 	  KDB can use a PS/2 type keyboard for an input device
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 02/38] ata: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-15  1:23   ` Damien Le Moal
                     ` (2 more replies)
  2023-03-14 12:11 ` [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT Niklas Schnelle
                   ` (36 subsequent siblings)
  38 siblings, 3 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Damien Le Moal
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-ide

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/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index b56fba76b43f..e5e67bdc2dff 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -342,6 +342,7 @@ endif # HAS_DMA
 
 config ATA_SFF
 	bool "ATA SFF support (for legacy IDE and PATA)"
+	depends on HAS_IOPORT
 	default y
 	help
 	  This option adds support for ATA controllers with SFF
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 02/38] ata: add HAS_IOPORT dependencies Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:20   ` Jarkko Sakkinen
                     ` (3 more replies)
  2023-03-14 12:11 ` [PATCH v3 04/38] comedi: add HAS_IOPORT dependencies Niklas Schnelle
                   ` (35 subsequent siblings)
  38 siblings, 4 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Corey Minyard, Peter Huewe,
	Jarkko Sakkinen, Jason Gunthorpe
  Cc: Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, openipmi-developer, linux-integrity

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to add this dependency and ifdef
sections of code using inb()/outb() as alternative access methods.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/char/Kconfig             |  3 ++-
 drivers/char/ipmi/Makefile       | 11 ++++-------
 drivers/char/ipmi/ipmi_si_intf.c |  3 ++-
 drivers/char/ipmi/ipmi_si_pci.c  |  3 +++
 drivers/char/pcmcia/Kconfig      |  8 ++++----
 drivers/char/tpm/Kconfig         |  1 +
 drivers/char/tpm/tpm_infineon.c  | 14 ++++++++++----
 drivers/char/tpm/tpm_tis_core.c  | 19 ++++++++-----------
 8 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 30fe9848dac1..c34679c6da70 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -34,6 +34,7 @@ config TTY_PRINTK_LEVEL
 config PRINTER
 	tristate "Parallel printer support"
 	depends on PARPORT
+	depends on HAS_IOPORT
 	help
 	  If you intend to attach a printer to the parallel port of your Linux
 	  box (as opposed to using a serial printer; if the connector at the
@@ -342,7 +343,7 @@ config NVRAM
 
 config DEVPORT
 	bool "/dev/port character device"
-	depends on ISA || PCI
+	depends on HAS_IOPORT
 	default y
 	help
 	  Say Y here if you want to support the /dev/port device. The /dev/port
diff --git a/drivers/char/ipmi/Makefile b/drivers/char/ipmi/Makefile
index cb6138b8ded9..e0944547c9d0 100644
--- a/drivers/char/ipmi/Makefile
+++ b/drivers/char/ipmi/Makefile
@@ -5,13 +5,10 @@
 
 ipmi_si-y := ipmi_si_intf.o ipmi_kcs_sm.o ipmi_smic_sm.o ipmi_bt_sm.o \
 	ipmi_si_hotmod.o ipmi_si_hardcode.o ipmi_si_platform.o \
-	ipmi_si_port_io.o ipmi_si_mem_io.o
-ifdef CONFIG_PCI
-ipmi_si-y += ipmi_si_pci.o
-endif
-ifdef CONFIG_PARISC
-ipmi_si-y += ipmi_si_parisc.o
-endif
+	ipmi_si_mem_io.o
+ipmi_si-$(CONFIG_HAS_IOPORT) += ipmi_si_port_io.o
+ipmi_si-$(CONFIG_PCI) += ipmi_si_pci.o
+ipmi_si-$(CONFIG_PARISC) += ipmi_si_parisc.o
 
 obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o
 obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index abddd7e43a9a..edbbdb804913 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -1882,7 +1882,8 @@ int ipmi_si_add_smi(struct si_sm_io *io)
 	}
 
 	if (!io->io_setup) {
-		if (io->addr_space == IPMI_IO_ADDR_SPACE) {
+		if (IS_ENABLED(CONFIG_HAS_IOPORT) &&
+		    io->addr_space == IPMI_IO_ADDR_SPACE) {
 			io->io_setup = ipmi_si_port_setup;
 		} else if (io->addr_space == IPMI_MEM_ADDR_SPACE) {
 			io->io_setup = ipmi_si_mem_setup;
diff --git a/drivers/char/ipmi/ipmi_si_pci.c b/drivers/char/ipmi/ipmi_si_pci.c
index 74fa2055868b..b83d55685b22 100644
--- a/drivers/char/ipmi/ipmi_si_pci.c
+++ b/drivers/char/ipmi/ipmi_si_pci.c
@@ -97,6 +97,9 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
 	}
 
 	if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) {
+		if (!IS_ENABLED(CONFIG_HAS_IOPORT))
+			return -ENXIO;
+
 		io.addr_space = IPMI_IO_ADDR_SPACE;
 		io.io_setup = ipmi_si_port_setup;
 	} else {
diff --git a/drivers/char/pcmcia/Kconfig b/drivers/char/pcmcia/Kconfig
index f5d589b2be44..788422627b43 100644
--- a/drivers/char/pcmcia/Kconfig
+++ b/drivers/char/pcmcia/Kconfig
@@ -8,7 +8,7 @@ menu "PCMCIA character devices"
 
 config SYNCLINK_CS
 	tristate "SyncLink PC Card support"
-	depends on PCMCIA && TTY
+	depends on PCMCIA && TTY && HAS_IOPORT
 	help
 	  Enable support for the SyncLink PC Card serial adapter, running
 	  asynchronous and HDLC communications up to 512Kbps. The port is
@@ -21,7 +21,7 @@ config SYNCLINK_CS
 
 config CARDMAN_4000
 	tristate "Omnikey Cardman 4000 support"
-	depends on PCMCIA
+	depends on PCMCIA && HAS_IOPORT
 	select BITREVERSE
 	help
 	  Enable support for the Omnikey Cardman 4000 PCMCIA Smartcard
@@ -33,7 +33,7 @@ config CARDMAN_4000
 
 config CARDMAN_4040
 	tristate "Omnikey CardMan 4040 support"
-	depends on PCMCIA
+	depends on PCMCIA && HAS_IOPORT
 	help
 	  Enable support for the Omnikey CardMan 4040 PCMCIA Smartcard
 	  reader.
@@ -57,7 +57,7 @@ config SCR24X
 
 config IPWIRELESS
 	tristate "IPWireless 3G UMTS PCMCIA card support"
-	depends on PCMCIA && NETDEVICES && TTY
+	depends on PCMCIA && NETDEVICES && TTY && HAS_IOPORT
 	select PPP
 	help
 	  This is a driver for 3G UMTS PCMCIA card from IPWireless company. In
diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
index 927088b2c3d3..418c9ed59ffd 100644
--- a/drivers/char/tpm/Kconfig
+++ b/drivers/char/tpm/Kconfig
@@ -149,6 +149,7 @@ config TCG_NSC
 config TCG_ATMEL
 	tristate "Atmel TPM Interface"
 	depends on PPC64 || HAS_IOPORT_MAP
+	depends on HAS_IOPORT
 	help
 	  If you have a TPM security chip from Atmel say Yes and it 
 	  will be accessible from within Linux.  To compile this driver 
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
index 9c924a1440a9..2d2ae37153ba 100644
--- a/drivers/char/tpm/tpm_infineon.c
+++ b/drivers/char/tpm/tpm_infineon.c
@@ -51,34 +51,40 @@ static struct tpm_inf_dev tpm_dev;
 
 static inline void tpm_data_out(unsigned char data, unsigned char offset)
 {
+#ifdef CONFIG_HAS_IOPORT
 	if (tpm_dev.iotype == TPM_INF_IO_PORT)
 		outb(data, tpm_dev.data_regs + offset);
 	else
+#endif
 		writeb(data, tpm_dev.mem_base + tpm_dev.data_regs + offset);
 }
 
 static inline unsigned char tpm_data_in(unsigned char offset)
 {
+#ifdef CONFIG_HAS_IOPORT
 	if (tpm_dev.iotype == TPM_INF_IO_PORT)
 		return inb(tpm_dev.data_regs + offset);
-	else
-		return readb(tpm_dev.mem_base + tpm_dev.data_regs + offset);
+#endif
+	return readb(tpm_dev.mem_base + tpm_dev.data_regs + offset);
 }
 
 static inline void tpm_config_out(unsigned char data, unsigned char offset)
 {
+#ifdef CONFIG_HAS_IOPORT
 	if (tpm_dev.iotype == TPM_INF_IO_PORT)
 		outb(data, tpm_dev.config_port + offset);
 	else
+#endif
 		writeb(data, tpm_dev.mem_base + tpm_dev.index_off + offset);
 }
 
 static inline unsigned char tpm_config_in(unsigned char offset)
 {
+#ifdef CONFIG_HAS_IOPORT
 	if (tpm_dev.iotype == TPM_INF_IO_PORT)
 		return inb(tpm_dev.config_port + offset);
-	else
-		return readb(tpm_dev.mem_base + tpm_dev.index_off + offset);
+#endif
+	return readb(tpm_dev.mem_base + tpm_dev.index_off + offset);
 }
 
 /* TPM header definitions */
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 3f98e587b3e8..e43d2a1da3ea 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -897,11 +897,6 @@ static void tpm_tis_clkrun_enable(struct tpm_chip *chip, bool value)
 		clkrun_val &= ~LPC_CLKRUN_EN;
 		iowrite32(clkrun_val, data->ilb_base_addr + LPC_CNTRL_OFFSET);
 
-		/*
-		 * Write any random value on port 0x80 which is on LPC, to make
-		 * sure LPC clock is running before sending any TPM command.
-		 */
-		outb(0xCC, 0x80);
 	} else {
 		data->clkrun_enabled--;
 		if (data->clkrun_enabled)
@@ -912,13 +907,15 @@ static void tpm_tis_clkrun_enable(struct tpm_chip *chip, bool value)
 		/* Enable LPC CLKRUN# */
 		clkrun_val |= LPC_CLKRUN_EN;
 		iowrite32(clkrun_val, data->ilb_base_addr + LPC_CNTRL_OFFSET);
-
-		/*
-		 * Write any random value on port 0x80 which is on LPC, to make
-		 * sure LPC clock is running before sending any TPM command.
-		 */
-		outb(0xCC, 0x80);
 	}
+
+#ifdef CONFIG_HAS_IOPORT
+	/*
+	 * Write any random value on port 0x80 which is on LPC, to make
+	 * sure LPC clock is running before sending any TPM command.
+	 */
+	outb(0xCC, 0x80);
+#endif
 }
 
 static const struct tpm_class_ops tpm_tis = {
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 04/38] comedi: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (2 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 05/38] counter: " Niklas Schnelle
                   ` (34 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Ian Abbott, H Hartley Sweeten
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann

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/comedi/Kconfig | 103 +++++++++++++++++++++++++++--------------
 1 file changed, 68 insertions(+), 35 deletions(-)

diff --git a/drivers/comedi/Kconfig b/drivers/comedi/Kconfig
index 9af280735cba..7a8d402f05be 100644
--- a/drivers/comedi/Kconfig
+++ b/drivers/comedi/Kconfig
@@ -67,6 +67,7 @@ config COMEDI_TEST
 
 config COMEDI_PARPORT
 	tristate "Parallel port support"
+	depends on HAS_IOPORT
 	help
 	  Enable support for the standard parallel port.
 	  A cheap and easy way to get a few more digital I/O lines. Steal
@@ -79,6 +80,7 @@ config COMEDI_PARPORT
 config COMEDI_SSV_DNP
 	tristate "SSV Embedded Systems DIL/Net-PC support"
 	depends on X86_32 || COMPILE_TEST
+	depends on HAS_IOPORT
 	help
 	  Enable support for SSV Embedded Systems DIL/Net-PC
 
@@ -89,6 +91,7 @@ endif # COMEDI_MISC_DRIVERS
 
 menuconfig COMEDI_ISA_DRIVERS
 	bool "Comedi ISA and PC/104 drivers"
+	depends on ISA
 	help
 	  Enable comedi ISA and PC/104 drivers to be built
 
@@ -100,7 +103,8 @@ if COMEDI_ISA_DRIVERS
 
 config COMEDI_PCL711
 	tristate "Advantech PCL-711/711b and ADlink ACL-8112 ISA card support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	help
 	  Enable support for Advantech PCL-711 and 711b, ADlink ACL-8112
 
@@ -161,8 +165,9 @@ config COMEDI_PCL730
 
 config COMEDI_PCL812
 	tristate "Advantech PCL-812/813 and ADlink ACL-8112/8113/8113/8216"
+	depends on HAS_IOPORT
 	select COMEDI_ISADMA if ISA_DMA_API
-	select COMEDI_8254
+	depends on COMEDI_8254
 	help
 	  Enable support for Advantech PCL-812/PG, PCL-813/B, ADLink
 	  ACL-8112DG/HG/PG, ACL-8113, ACL-8216, ICP DAS A-821PGH/PGL/PGL-NDA,
@@ -173,8 +178,9 @@ config COMEDI_PCL812
 
 config COMEDI_PCL816
 	tristate "Advantech PCL-814 and PCL-816 ISA card support"
+	depends on HAS_IOPORT
 	select COMEDI_ISADMA if ISA_DMA_API
-	select COMEDI_8254
+	depends on COMEDI_8254
 	help
 	  Enable support for Advantech PCL-814 and PCL-816 ISA cards
 
@@ -183,8 +189,9 @@ config COMEDI_PCL816
 
 config COMEDI_PCL818
 	tristate "Advantech PCL-718 and PCL-818 ISA card support"
+	depends on HAS_IOPORT
 	select COMEDI_ISADMA if ISA_DMA_API
-	select COMEDI_8254
+	depends on COMEDI_8254
 	help
 	  Enable support for Advantech PCL-818 ISA cards
 	  PCL-818L, PCL-818H, PCL-818HD, PCL-818HG, PCL-818 and PCL-718
@@ -203,7 +210,7 @@ config COMEDI_PCM3724
 
 config COMEDI_AMPLC_DIO200_ISA
 	tristate "Amplicon PC212E/PC214E/PC215E/PC218E/PC272E"
-	select COMEDI_AMPLC_DIO200
+	depends on COMEDI_AMPLC_DIO200
 	help
 	  Enable support for Amplicon PC212E, PC214E, PC215E, PC218E and
 	  PC272E ISA DIO boards
@@ -255,7 +262,8 @@ config COMEDI_DAC02
 
 config COMEDI_DAS16M1
 	tristate "MeasurementComputing CIO-DAS16/M1DAS-16 ISA card support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	select COMEDI_8255
 	help
 	  Enable support for Measurement Computing CIO-DAS16/M1 ISA cards.
@@ -265,7 +273,7 @@ config COMEDI_DAS16M1
 
 config COMEDI_DAS08_ISA
 	tristate "DAS-08 compatible ISA and PC/104 card support"
-	select COMEDI_DAS08
+	depends on COMEDI_DAS08
 	help
 	  Enable support for Keithley Metrabyte/ComputerBoards DAS08
 	  and compatible ISA and PC/104 cards:
@@ -278,8 +286,9 @@ config COMEDI_DAS08_ISA
 
 config COMEDI_DAS16
 	tristate "DAS-16 compatible ISA and PC/104 card support"
+	depends on HAS_IOPORT
 	select COMEDI_ISADMA if ISA_DMA_API
-	select COMEDI_8254
+	depends on COMEDI_8254
 	select COMEDI_8255
 	help
 	  Enable support for Keithley Metrabyte/ComputerBoards DAS16
@@ -296,7 +305,8 @@ config COMEDI_DAS16
 
 config COMEDI_DAS800
 	tristate "DAS800 and compatible ISA card support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	help
 	  Enable support for Keithley Metrabyte DAS800 and compatible ISA cards
 	  Keithley Metrabyte DAS-800, DAS-801, DAS-802
@@ -308,8 +318,9 @@ config COMEDI_DAS800
 
 config COMEDI_DAS1800
 	tristate "DAS1800 and compatible ISA card support"
+	depends on HAS_IOPORT
 	select COMEDI_ISADMA if ISA_DMA_API
-	select COMEDI_8254
+	depends on COMEDI_8254
 	help
 	  Enable support for DAS1800 and compatible ISA cards
 	  Keithley Metrabyte DAS-1701ST, DAS-1701ST-DA, DAS-1701/AO,
@@ -323,7 +334,8 @@ config COMEDI_DAS1800
 
 config COMEDI_DAS6402
 	tristate "DAS6402 and compatible ISA card support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	help
 	  Enable support for DAS6402 and compatible ISA cards
 	  Computerboards, Keithley Metrabyte DAS6402 and compatibles
@@ -402,7 +414,8 @@ config COMEDI_FL512
 
 config COMEDI_AIO_AIO12_8
 	tristate "I/O Products PC/104 AIO12-8 Analog I/O Board support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	select COMEDI_8255
 	help
 	  Enable support for I/O Products PC/104 AIO12-8 Analog I/O Board
@@ -456,8 +469,9 @@ config COMEDI_ADQ12B
 
 config COMEDI_NI_AT_A2150
 	tristate "NI AT-A2150 ISA card support"
+	depends on HAS_IOPORT
 	select COMEDI_ISADMA if ISA_DMA_API
-	select COMEDI_8254
+	depends on COMEDI_8254
 	help
 	  Enable support for National Instruments AT-A2150 cards
 
@@ -466,7 +480,8 @@ config COMEDI_NI_AT_A2150
 
 config COMEDI_NI_AT_AO
 	tristate "NI AT-AO-6/10 EISA card support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	help
 	  Enable support for National Instruments AT-AO-6/10 cards
 
@@ -497,7 +512,7 @@ config COMEDI_NI_ATMIO16D
 
 config COMEDI_NI_LABPC_ISA
 	tristate "NI Lab-PC and compatibles ISA support"
-	select COMEDI_NI_LABPC
+	depends on COMEDI_NI_LABPC
 	help
 	  Enable support for National Instruments Lab-PC and compatibles
 	  Lab-PC-1200, Lab-PC-1200AI, Lab-PC+.
@@ -561,7 +576,7 @@ endif # COMEDI_ISA_DRIVERS
 
 menuconfig COMEDI_PCI_DRIVERS
 	tristate "Comedi PCI drivers"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  Enable support for comedi PCI drivers.
 
@@ -710,7 +725,8 @@ config COMEDI_ADL_PCI8164
 
 config COMEDI_ADL_PCI9111
 	tristate "ADLink PCI-9111HR support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	help
 	  Enable support for ADlink PCI9111 cards
 
@@ -720,7 +736,7 @@ config COMEDI_ADL_PCI9111
 config COMEDI_ADL_PCI9118
 	tristate "ADLink PCI-9118DG, PCI-9118HG, PCI-9118HR support"
 	depends on HAS_DMA
-	select COMEDI_8254
+	depends on COMEDI_8254
 	help
 	  Enable support for ADlink PCI-9118DG, PCI-9118HG, PCI-9118HR cards
 
@@ -729,7 +745,8 @@ config COMEDI_ADL_PCI9118
 
 config COMEDI_ADV_PCI1710
 	tristate "Advantech PCI-171x and PCI-1731 support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	help
 	  Enable support for Advantech PCI-1710, PCI-1710HG, PCI-1711,
 	  PCI-1713 and PCI-1731
@@ -773,7 +790,8 @@ config COMEDI_ADV_PCI1760
 
 config COMEDI_ADV_PCI_DIO
 	tristate "Advantech PCI DIO card support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	select COMEDI_8255
 	help
 	  Enable support for Advantech PCI DIO cards
@@ -786,7 +804,7 @@ config COMEDI_ADV_PCI_DIO
 
 config COMEDI_AMPLC_DIO200_PCI
 	tristate "Amplicon PCI215/PCI272/PCIe215/PCIe236/PCIe296 DIO support"
-	select COMEDI_AMPLC_DIO200
+	depends on COMEDI_AMPLC_DIO200
 	help
 	  Enable support for Amplicon PCI215, PCI272, PCIe215, PCIe236
 	  and PCIe296 DIO boards.
@@ -814,7 +832,8 @@ config COMEDI_AMPLC_PC263_PCI
 
 config COMEDI_AMPLC_PCI224
 	tristate "Amplicon PCI224 and PCI234 support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	help
 	  Enable support for Amplicon PCI224 and PCI234 AO boards
 
@@ -823,7 +842,8 @@ config COMEDI_AMPLC_PCI224
 
 config COMEDI_AMPLC_PCI230
 	tristate "Amplicon PCI230 and PCI260 support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	select COMEDI_8255
 	help
 	  Enable support for Amplicon PCI230 and PCI260 Multifunction I/O
@@ -842,7 +862,7 @@ config COMEDI_CONTEC_PCI_DIO
 
 config COMEDI_DAS08_PCI
 	tristate "DAS-08 PCI support"
-	select COMEDI_DAS08
+	depends on COMEDI_DAS08
 	help
 	  Enable support for PCI DAS-08 cards.
 
@@ -929,7 +949,8 @@ config COMEDI_CB_PCIDAS64
 
 config COMEDI_CB_PCIDAS
 	tristate "MeasurementComputing PCI-DAS support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	select COMEDI_8255
 	help
 	  Enable support for ComputerBoards/MeasurementComputing PCI-DAS with
@@ -953,7 +974,8 @@ config COMEDI_CB_PCIDDA
 
 config COMEDI_CB_PCIMDAS
 	tristate "MeasurementComputing PCIM-DAS1602/16, PCIe-DAS1602/16 support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	select COMEDI_8255
 	help
 	  Enable support for ComputerBoards/MeasurementComputing PCI Migration
@@ -973,7 +995,8 @@ config COMEDI_CB_PCIMDDA
 
 config COMEDI_ME4000
 	tristate "Meilhaus ME-4000 support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	help
 	  Enable support for Meilhaus PCI data acquisition cards
 	  ME-4650, ME-4670i, ME-4680, ME-4680i and ME-4680is
@@ -1031,7 +1054,7 @@ config COMEDI_NI_670X
 
 config COMEDI_NI_LABPC_PCI
 	tristate "NI Lab-PC PCI-1200 support"
-	select COMEDI_NI_LABPC
+	depends on COMEDI_NI_LABPC
 	help
 	  Enable support for National Instruments Lab-PC PCI-1200.
 
@@ -1053,6 +1076,7 @@ config COMEDI_NI_PCIDIO
 config COMEDI_NI_PCIMIO
 	tristate "NI PCI-MIO-E series and M series support"
 	depends on HAS_DMA
+	depends on HAS_IOPORT
 	select COMEDI_NI_TIOCMD
 	select COMEDI_8255
 	help
@@ -1074,7 +1098,8 @@ config COMEDI_NI_PCIMIO
 
 config COMEDI_RTD520
 	tristate "Real Time Devices PCI4520/DM7520 support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	help
 	  Enable support for Real Time Devices PCI4520/DM7520
 
@@ -1114,7 +1139,8 @@ if COMEDI_PCMCIA_DRIVERS
 
 config COMEDI_CB_DAS16_CS
 	tristate "CB DAS16 series PCMCIA support"
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	help
 	  Enable support for the ComputerBoards/MeasurementComputing PCMCIA
 	  cards DAS16/16, PCM-DAS16D/12 and PCM-DAS16s/16
@@ -1124,7 +1150,7 @@ config COMEDI_CB_DAS16_CS
 
 config COMEDI_DAS08_CS
 	tristate "CB DAS08 PCMCIA support"
-	select COMEDI_DAS08
+	depends on COMEDI_DAS08
 	help
 	  Enable support for the ComputerBoards/MeasurementComputing DAS-08
 	  PCMCIA card
@@ -1134,6 +1160,7 @@ config COMEDI_DAS08_CS
 
 config COMEDI_NI_DAQ_700_CS
 	tristate "NI DAQCard-700 PCMCIA support"
+	depends on HAS_IOPORT
 	help
 	  Enable support for the National Instruments PCMCIA DAQCard-700 DIO
 
@@ -1142,6 +1169,7 @@ config COMEDI_NI_DAQ_700_CS
 
 config COMEDI_NI_DAQ_DIO24_CS
 	tristate "NI DAQ-Card DIO-24 PCMCIA support"
+	depends on HAS_IOPORT
 	select COMEDI_8255
 	help
 	  Enable support for the National Instruments PCMCIA DAQ-Card DIO-24
@@ -1151,7 +1179,7 @@ config COMEDI_NI_DAQ_DIO24_CS
 
 config COMEDI_NI_LABPC_CS
 	tristate "NI DAQCard-1200 PCMCIA support"
-	select COMEDI_NI_LABPC
+	depends on COMEDI_NI_LABPC
 	help
 	  Enable support for the National Instruments PCMCIA DAQCard-1200
 
@@ -1160,6 +1188,7 @@ config COMEDI_NI_LABPC_CS
 
 config COMEDI_NI_MIO_CS
 	tristate "NI DAQCard E series PCMCIA support"
+	depends on HAS_IOPORT
 	select COMEDI_NI_TIO
 	select COMEDI_8255
 	help
@@ -1172,6 +1201,7 @@ config COMEDI_NI_MIO_CS
 
 config COMEDI_QUATECH_DAQP_CS
 	tristate "Quatech DAQP PCMCIA data capture card support"
+	depends on HAS_IOPORT
 	help
 	  Enable support for the Quatech DAQP PCMCIA data capture cards
 	  DAQP-208 and DAQP-308
@@ -1248,12 +1278,14 @@ endif # COMEDI_USB_DRIVERS
 
 config COMEDI_8254
 	tristate
+	depends on HAS_IOPORT
 
 config COMEDI_8255
 	tristate
 
 config COMEDI_8255_SA
 	tristate "Standalone 8255 support"
+	depends on HAS_IOPORT
 	select COMEDI_8255
 	help
 	  Enable support for 8255 digital I/O as a standalone driver.
@@ -1285,7 +1317,7 @@ config COMEDI_KCOMEDILIB
 	  called kcomedilib.
 
 config COMEDI_AMPLC_DIO200
-	select COMEDI_8254
+	depends on COMEDI_8254
 	tristate
 
 config COMEDI_AMPLC_PC236
@@ -1294,7 +1326,7 @@ config COMEDI_AMPLC_PC236
 
 config COMEDI_DAS08
 	tristate
-	select COMEDI_8254
+	depends on COMEDI_8254
 	select COMEDI_8255
 
 config COMEDI_ISADMA
@@ -1302,7 +1334,8 @@ config COMEDI_ISADMA
 
 config COMEDI_NI_LABPC
 	tristate
-	select COMEDI_8254
+	depends on HAS_IOPORT
+	depends on COMEDI_8254
 	select COMEDI_8255
 
 config COMEDI_NI_LABPC_ISADMA
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 05/38] counter: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (3 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 04/38] comedi: add HAS_IOPORT dependencies Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:41   ` William Breathitt Gray
  2023-03-14 12:11 ` [PATCH v3 06/38] /dev/port: don't compile file operations without CONFIG_DEVPORT Niklas Schnelle
                   ` (33 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, William Breathitt Gray
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-iio

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/counter/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/counter/Kconfig b/drivers/counter/Kconfig
index b5ba8fb02cf7..1cae5097217e 100644
--- a/drivers/counter/Kconfig
+++ b/drivers/counter/Kconfig
@@ -15,6 +15,7 @@ if COUNTER
 config 104_QUAD_8
 	tristate "ACCES 104-QUAD-8 driver"
 	depends on (PC104 && X86) || COMPILE_TEST
+	depends on HAS_IOPORT
 	select ISA_BUS_API
 	help
 	  Say yes here to build support for the ACCES 104-QUAD-8 quadrature
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 06/38] /dev/port: don't compile file operations without CONFIG_DEVPORT
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (4 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 05/38] counter: " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 07/38] drm: handle HAS_IOPORT dependencies Niklas Schnelle
                   ` (32 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman
  Cc: Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann

In the future inb() and friends will not be available when compiling
with CONFIG_HAS_IOPORT=n so we must only try to access them here if
CONFIG_DEVPORT is set which depends on HAS_IOPORT.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/char/mem.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index ffb101d349f0..d7fcf85b4df9 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -402,6 +402,7 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma)
 	return 0;
 }
 
+#ifdef CONFIG_DEVPORT
 static ssize_t read_port(struct file *file, char __user *buf,
 			 size_t count, loff_t *ppos)
 {
@@ -443,6 +444,7 @@ static ssize_t write_port(struct file *file, const char __user *buf,
 	*ppos = i;
 	return tmp-buf;
 }
+#endif
 
 static ssize_t read_null(struct file *file, char __user *buf,
 			 size_t count, loff_t *ppos)
@@ -671,12 +673,14 @@ static const struct file_operations null_fops = {
 	.uring_cmd	= uring_cmd_null,
 };
 
-static const struct file_operations __maybe_unused port_fops = {
+#ifdef CONFIG_DEVPORT
+static const struct file_operations port_fops = {
 	.llseek		= memory_lseek,
 	.read		= read_port,
 	.write		= write_port,
 	.open		= open_port,
 };
+#endif
 
 static const struct file_operations zero_fops = {
 	.llseek		= zero_lseek,
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 07/38] drm: handle HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (5 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 06/38] /dev/port: don't compile file operations without CONFIG_DEVPORT Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-15 11:54   ` Jani Nikula
  2023-03-14 12:11 ` [PATCH v3 08/38] firmware: dmi-sysfs: handle HAS_IOPORT=n Niklas Schnelle
                   ` (31 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Dave Airlie, Gerd Hoffmann, David Airlie, Daniel Vetter
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	virtualization, spice-devel, dri-devel

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. In the bochs driver there is optional MMIO
support detected at runtime, warn if this isn't taken when
HAS_IOPORT is not defined.

There is also a direct and hard coded use in cirrus.c which according to
the comment is only necessary during resume.  Let's just skip this as
for example s390 which doesn't have I/O port support also doesen't
support suspend/resume.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/gpu/drm/qxl/Kconfig   |  1 +
 drivers/gpu/drm/tiny/bochs.c  | 19 +++++++++++++++++++
 drivers/gpu/drm/tiny/cirrus.c |  2 ++
 3 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/qxl/Kconfig b/drivers/gpu/drm/qxl/Kconfig
index ca3f51c2a8fe..d0e0d440c8d9 100644
--- a/drivers/gpu/drm/qxl/Kconfig
+++ b/drivers/gpu/drm/qxl/Kconfig
@@ -2,6 +2,7 @@
 config DRM_QXL
 	tristate "QXL virtual GPU"
 	depends on DRM && PCI && MMU
+	depends on HAS_IOPORT
 	select DRM_KMS_HELPER
 	select DRM_TTM
 	select DRM_TTM_HELPER
diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
index 024346054c70..da4a5d53b003 100644
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -2,6 +2,7 @@
 
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <asm/bug.h>
 
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
@@ -105,7 +106,11 @@ static void bochs_vga_writeb(struct bochs_device *bochs, u16 ioport, u8 val)
 
 		writeb(val, bochs->mmio + offset);
 	} else {
+#ifdef HAS_IOPORT
 		outb(val, ioport);
+#else
+		WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT");
+#endif
 	}
 }
 
@@ -119,7 +124,12 @@ static u8 bochs_vga_readb(struct bochs_device *bochs, u16 ioport)
 
 		return readb(bochs->mmio + offset);
 	} else {
+#ifdef HAS_IOPORT
 		return inb(ioport);
+#else
+		WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT");
+		return 0xff;
+#endif
 	}
 }
 
@@ -132,8 +142,13 @@ static u16 bochs_dispi_read(struct bochs_device *bochs, u16 reg)
 
 		ret = readw(bochs->mmio + offset);
 	} else {
+#ifdef HAS_IOPORT
 		outw(reg, VBE_DISPI_IOPORT_INDEX);
 		ret = inw(VBE_DISPI_IOPORT_DATA);
+#else
+		WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT");
+		ret = 0xffff;
+#endif
 	}
 	return ret;
 }
@@ -145,8 +160,12 @@ static void bochs_dispi_write(struct bochs_device *bochs, u16 reg, u16 val)
 
 		writew(val, bochs->mmio + offset);
 	} else {
+#ifdef HAS_IOPORT
 		outw(reg, VBE_DISPI_IOPORT_INDEX);
 		outw(val, VBE_DISPI_IOPORT_DATA);
+#else
+		WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT");
+#endif
 	}
 }
 
diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c
index accfa52e78c5..9da89732c5ac 100644
--- a/drivers/gpu/drm/tiny/cirrus.c
+++ b/drivers/gpu/drm/tiny/cirrus.c
@@ -308,8 +308,10 @@ static int cirrus_mode_set(struct cirrus_device *cirrus,
 
 	cirrus_set_start_address(cirrus, 0);
 
+#ifdef CONFIG_HAS_IOPORT
 	/* Unblank (needed on S3 resume, vgabios doesn't do it then) */
 	outb(0x20, 0x3c0);
+#endif
 
 	drm_dev_exit(idx);
 	return 0;
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 08/38] firmware: dmi-sysfs: handle HAS_IOPORT=n
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (6 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 07/38] drm: handle HAS_IOPORT dependencies Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 09/38] gpio: add HAS_IOPORT dependencies Niklas Schnelle
                   ` (30 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to guard sections of code calling them
as alternative access methods.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/firmware/dmi-sysfs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
index ed5aff0a4204..22ca1af4e363 100644
--- a/drivers/firmware/dmi-sysfs.c
+++ b/drivers/firmware/dmi-sysfs.c
@@ -310,6 +310,7 @@ static struct kobj_type dmi_system_event_log_ktype = {
 	.default_groups = dmi_sysfs_sel_groups,
 };
 
+#ifdef CONFIG_HAS_IOPORT
 typedef u8 (*sel_io_reader)(const struct dmi_system_event_log *sel,
 			    loff_t offset);
 
@@ -374,6 +375,7 @@ static ssize_t dmi_sel_raw_read_io(struct dmi_sysfs_entry *entry,
 
 	return wrote;
 }
+#endif
 
 static ssize_t dmi_sel_raw_read_phys32(struct dmi_sysfs_entry *entry,
 				       const struct dmi_system_event_log *sel,
@@ -409,11 +411,13 @@ static ssize_t dmi_sel_raw_read_helper(struct dmi_sysfs_entry *entry,
 	memcpy(&sel, dh, sizeof(sel));
 
 	switch (sel.access_method) {
+#ifdef CONFIG_HAS_IOPORT
 	case DMI_SEL_ACCESS_METHOD_IO8:
 	case DMI_SEL_ACCESS_METHOD_IO2x8:
 	case DMI_SEL_ACCESS_METHOD_IO16:
 		return dmi_sel_raw_read_io(entry, &sel, state->buf,
 					   state->pos, state->count);
+#endif
 	case DMI_SEL_ACCESS_METHOD_PHYS32:
 		return dmi_sel_raw_read_phys32(entry, &sel, state->buf,
 					       state->pos, state->count);
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 09/38] gpio: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (7 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 08/38] firmware: dmi-sysfs: handle HAS_IOPORT=n Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-15  8:42   ` Linus Walleij
  2023-03-14 12:11 ` [PATCH v3 10/38] hwmon: " Niklas Schnelle
                   ` (29 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Linus Walleij, Bartosz Golaszewski
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-gpio

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
 	select MFD_CORE
 	select MFD_VX855
 	help
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 10/38] hwmon: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (8 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 09/38] gpio: add HAS_IOPORT dependencies Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 11/38] i2c: " Niklas Schnelle
                   ` (28 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Jean Delvare, Guenter Roeck
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-hwmon

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.

Acked-by: Guenter Roeck <linux@roeck-us.net>
Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/hwmon/Kconfig | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 5b3b76477b0e..35afb070cae2 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -578,6 +578,7 @@ config SENSORS_SPARX5
 
 config SENSORS_F71805F
 	tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG"
+	depends on HAS_IOPORT
 	depends on !PPC
 	help
 	  If you say yes here you get support for hardware monitoring
@@ -589,6 +590,7 @@ config SENSORS_F71805F
 
 config SENSORS_F71882FG
 	tristate "Fintek F71882FG and compatibles"
+	depends on HAS_IOPORT
 	depends on !PPC
 	help
 	  If you say yes here you get support for hardware monitoring
@@ -801,6 +803,7 @@ config SENSORS_CORETEMP
 
 config SENSORS_IT87
 	tristate "ITE IT87xx and compatibles"
+	depends on HAS_IOPORT
 	depends on !PPC
 	select HWMON_VID
 	help
@@ -1465,6 +1468,7 @@ config SENSORS_LM95245
 
 config SENSORS_PC87360
 	tristate "National Semiconductor PC87360 family"
+	depends on HAS_IOPORT
 	depends on !PPC
 	select HWMON_VID
 	help
@@ -1479,6 +1483,7 @@ config SENSORS_PC87360
 
 config SENSORS_PC87427
 	tristate "National Semiconductor PC87427"
+	depends on HAS_IOPORT
 	depends on !PPC
 	help
 	  If you say yes here you get access to the hardware monitoring
@@ -1510,6 +1515,7 @@ config SENSORS_NTC_THERMISTOR
 
 config SENSORS_NCT6683
 	tristate "Nuvoton NCT6683D"
+	depends on HAS_IOPORT
 	depends on !PPC
 	help
 	  If you say yes here you get support for the hardware monitoring
@@ -1531,6 +1537,7 @@ config SENSORS_NCT6775_CORE
 
 config SENSORS_NCT6775
 	tristate "Platform driver for Nuvoton NCT6775F and compatibles"
+	depends on HAS_IOPORT
 	depends on !PPC
 	depends on ACPI || ACPI=n
 	select HWMON_VID
@@ -1767,7 +1774,7 @@ config SENSORS_SHTC1
 
 config SENSORS_SIS5595
 	tristate "Silicon Integrated Systems Corp. SiS5595"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes here you get support for the integrated sensors in
 	  SiS5595 South Bridges.
@@ -1787,6 +1794,7 @@ config SENSORS_SY7636A
 
 config SENSORS_DME1737
 	tristate "SMSC DME1737, SCH311x and compatibles"
+	depends on HAS_IOPORT
 	depends on I2C && !PPC
 	select HWMON_VID
 	help
@@ -1843,6 +1851,7 @@ config SENSORS_EMC6W201
 
 config SENSORS_SMSC47M1
 	tristate "SMSC LPC47M10x and compatibles"
+	depends on HAS_IOPORT
 	depends on !PPC
 	help
 	  If you say yes here you get support for the integrated fan
@@ -1877,6 +1886,7 @@ config SENSORS_SMSC47M192
 
 config SENSORS_SMSC47B397
 	tristate "SMSC LPC47B397-NC"
+	depends on HAS_IOPORT
 	depends on !PPC
 	help
 	  If you say yes here you get support for the SMSC LPC47B397-NC
@@ -1890,6 +1900,7 @@ config SENSORS_SCH56XX_COMMON
 
 config SENSORS_SCH5627
 	tristate "SMSC SCH5627"
+	depends on HAS_IOPORT
 	depends on !PPC && WATCHDOG
 	select SENSORS_SCH56XX_COMMON
 	select WATCHDOG_CORE
@@ -1903,6 +1914,7 @@ config SENSORS_SCH5627
 
 config SENSORS_SCH5636
 	tristate "SMSC SCH5636"
+	depends on HAS_IOPORT
 	depends on !PPC && WATCHDOG
 	select SENSORS_SCH56XX_COMMON
 	select WATCHDOG_CORE
@@ -2145,7 +2157,7 @@ config SENSORS_VIA_CPUTEMP
 
 config SENSORS_VIA686A
 	tristate "VIA686A"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes here you get support for the integrated sensors in
 	  Via 686A/B South Bridges.
@@ -2155,6 +2167,7 @@ config SENSORS_VIA686A
 
 config SENSORS_VT1211
 	tristate "VIA VT1211"
+	depends on HAS_IOPORT
 	depends on !PPC
 	select HWMON_VID
 	help
@@ -2166,7 +2179,7 @@ config SENSORS_VT1211
 
 config SENSORS_VT8231
 	tristate "VIA VT8231"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select HWMON_VID
 	help
 	  If you say yes here then you get support for the integrated sensors
@@ -2274,6 +2287,7 @@ config SENSORS_W83L786NG
 
 config SENSORS_W83627HF
 	tristate "Winbond W83627HF, W83627THF, W83637HF, W83687THF, W83697HF"
+	depends on HAS_IOPORT
 	depends on !PPC
 	select HWMON_VID
 	help
@@ -2286,6 +2300,7 @@ config SENSORS_W83627HF
 
 config SENSORS_W83627EHF
 	tristate "Winbond W83627EHF/EHG/DHG/UHG, W83667HG"
+	depends on HAS_IOPORT
 	depends on !PPC
 	select HWMON_VID
 	help
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 11/38] i2c: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (9 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 10/38] hwmon: " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 12/38] iio: ad7606: Kconfig: " Niklas Schnelle
                   ` (27 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-i2c

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/i2c/busses/Kconfig | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 25eb4e8fd22f..6c0b9ca25e32 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -18,7 +18,7 @@ config I2C_CCGX_UCSI
 
 config I2C_ALI1535
 	tristate "ALI 1535"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the SMB
 	  Host controller on Acer Labs Inc. (ALI) M1535 South Bridges.  The SMB
@@ -30,7 +30,7 @@ config I2C_ALI1535
 
 config I2C_ALI1563
 	tristate "ALI 1563"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the SMB
 	  Host controller on Acer Labs Inc. (ALI) M1563 South Bridges.  The SMB
@@ -42,7 +42,7 @@ config I2C_ALI1563
 
 config I2C_ALI15X3
 	tristate "ALI 15x3"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the
 	  Acer Labs Inc. (ALI) M1514 and M1543 motherboard I2C interfaces.
@@ -52,7 +52,7 @@ config I2C_ALI15X3
 
 config I2C_AMD756
 	tristate "AMD 756/766/768/8111 and nVidia nForce"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the AMD
 	  756/766/768 mainboard I2C interfaces.  The driver also includes
@@ -77,7 +77,7 @@ config I2C_AMD756_S4882
 
 config I2C_AMD8111
 	tristate "AMD 8111"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the
 	  second (SMBus 2.0) AMD 8111 mainboard I2C interface.
@@ -107,7 +107,7 @@ config I2C_HIX5HD2
 
 config I2C_I801
 	tristate "Intel 82801 (ICH/PCH)"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select P2SB if X86
 	select CHECK_SIGNATURE if X86 && DMI
 	select I2C_SMBUS
@@ -164,7 +164,7 @@ config I2C_I801
 
 config I2C_ISCH
 	tristate "Intel SCH SMBus 1.0"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select LPC_SCH
 	help
 	  Say Y here if you want to use SMBus controller on the Intel SCH
@@ -185,7 +185,7 @@ config I2C_ISMT
 
 config I2C_PIIX4
 	tristate "Intel PIIX4 and compatible (ATI/AMD/Serverworks/Broadcom/SMSC)"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the Intel
 	  PIIX4 family of mainboard I2C interfaces.  Specifically, the following
@@ -231,7 +231,7 @@ config I2C_CHT_WC
 
 config I2C_NFORCE2
 	tristate "Nvidia nForce2, nForce3 and nForce4"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the Nvidia
 	  nForce2, nForce3 and nForce4 families of mainboard I2C interfaces.
@@ -264,7 +264,7 @@ config I2C_NVIDIA_GPU
 
 config I2C_SIS5595
 	tristate "SiS 5595"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the
 	  SiS5595 SMBus (a subset of I2C) interface.
@@ -274,7 +274,7 @@ config I2C_SIS5595
 
 config I2C_SIS630
 	tristate "SiS 630/730/964"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the
 	  SiS630, SiS730 and SiS964 SMBus (a subset of I2C) interface.
@@ -284,7 +284,7 @@ config I2C_SIS630
 
 config I2C_SIS96X
 	tristate "SiS 96x"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the SiS
 	  96x SMBus (a subset of I2C) interfaces.  Specifically, the following
@@ -302,7 +302,7 @@ config I2C_SIS96X
 
 config I2C_VIA
 	tristate "VIA VT82C586B"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select I2C_ALGOBIT
 	help
 	  If you say yes to this option, support will be included for the VIA
@@ -313,7 +313,7 @@ config I2C_VIA
 
 config I2C_VIAPRO
 	tristate "VIA VT82C596/82C686/82xx and CX700/VX8xx/VX900"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the VIA
 	  VT82C596 and later SMBus interface.  Specifically, the following
@@ -881,6 +881,7 @@ config I2C_NPCM
 
 config I2C_OCORES
 	tristate "OpenCores I2C Controller"
+	depends on HAS_IOPORT
 	help
 	  If you say yes to this option, support will be included for the
 	  OpenCores I2C controller. For details see
@@ -1274,6 +1275,7 @@ config I2C_CP2615
 config I2C_PARPORT
 	tristate "Parallel port adapter"
 	depends on PARPORT
+	depends on HAS_IOPORT
 	select I2C_ALGOBIT
 	select I2C_SMBUS
 	help
@@ -1382,6 +1384,7 @@ config I2C_ICY
 config I2C_MLXCPLD
 	tristate "Mellanox I2C driver"
 	depends on X86_64 || COMPILE_TEST
+	depends on HAS_IOPORT
 	help
 	  This exposes the Mellanox platform I2C busses to the linux I2C layer
 	  for X86 based systems.
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 12/38] iio: ad7606: Kconfig: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (10 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 11/38] i2c: " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 13/38] Input: " Niklas Schnelle
                   ` (26 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Jonathan Cameron, Lars-Peter Clausen
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Jonathan Cameron,
	Arnd Bergmann, linux-iio

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.

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

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 45af2302be53..df4c7d80d765 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -145,7 +145,7 @@ config AD7606
 
 config AD7606_IFACE_PARALLEL
 	tristate "Analog Devices AD7606 ADC driver with parallel interface support"
-	depends on HAS_IOMEM
+	depends on HAS_IOPORT
 	select AD7606
 	help
 	  Say yes here to build parallel interface support for Analog Devices:
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 13/38] Input: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (11 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 12/38] iio: ad7606: Kconfig: " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-15  8:22   ` Geert Uytterhoeven
  2023-03-14 12:11 ` [PATCH v3 14/38] Input: gameport: add ISA and " Niklas Schnelle
                   ` (25 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Dmitry Torokhov
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-input

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/input/serio/Kconfig       | 2 ++
 drivers/input/touchscreen/Kconfig | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index f39b7b3f7942..5d125627c595 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -75,6 +75,7 @@ config SERIO_Q40KBD
 config SERIO_PARKBD
 	tristate "Parallel port keyboard adapter"
 	depends on PARPORT
+	depends on HAS_IOPORT
 	help
 	  Say Y here if you built a simple parallel port adapter to attach
 	  an additional AT keyboard, XT keyboard or PS/2 mouse.
@@ -148,6 +149,7 @@ config HIL_MLC
 config SERIO_PCIPS2
 	tristate "PCI PS/2 keyboard and PS/2 mouse controller"
 	depends on PCI
+	depends on HAS_IOPORT
 	help
 	  Say Y here if you have a Mobility Docking station with PS/2
 	  keyboard and mice ports.
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 1a2049b336a6..6c268b8f0d19 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -690,6 +690,7 @@ config TOUCHSCREEN_INEXIO
 
 config TOUCHSCREEN_MK712
 	tristate "ICS MicroClock MK712 touchscreen"
+	depends on ISA
 	help
 	  Say Y here if you have the ICS MicroClock MK712 touchscreen
 	  controller chip in your system.
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 14/38] Input: gameport: add ISA and HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (12 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 13/38] Input: " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 15/38] leds: add " Niklas Schnelle
                   ` (24 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Dmitry Torokhov
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-input

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. As ISA already implies HAS_IOPORT we can simply add
this dependency and guard sections of code using inb()/outb() as
alternative access methods.

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

diff --git a/drivers/input/gameport/Kconfig b/drivers/input/gameport/Kconfig
index 5a2c2fb3217d..fe73b26e647a 100644
--- a/drivers/input/gameport/Kconfig
+++ b/drivers/input/gameport/Kconfig
@@ -25,6 +25,7 @@ if GAMEPORT
 
 config GAMEPORT_NS558
 	tristate "Classic ISA and PnP gameport support"
+	depends on ISA
 	help
 	  Say Y here if you have an ISA or PnP gameport.
 
@@ -35,6 +36,7 @@ config GAMEPORT_NS558
 
 config GAMEPORT_L4
 	tristate "PDPI Lightning 4 gamecard support"
+	depends on ISA
 	help
 	  Say Y here if you have a PDPI Lightning 4 gamecard.
 
@@ -53,7 +55,7 @@ config GAMEPORT_EMU10K1
 
 config GAMEPORT_FM801
 	tristate "ForteMedia FM801 gameport support"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  Say Y here if you have ForteMedia FM801 PCI audio controller
 	  (Abit AU10, Genius Sound Maker, HP Workstation zx2000,
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index 8c2f00018e89..4d5720022b63 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -167,16 +167,21 @@ static inline void gameport_trigger(struct gameport *gameport)
 {
 	if (gameport->trigger)
 		gameport->trigger(gameport);
+#ifdef CONFIG_HAS_IOPORT
 	else
 		outb(0xff, gameport->io);
+#endif
 }
 
 static inline unsigned char gameport_read(struct gameport *gameport)
 {
 	if (gameport->read)
 		return gameport->read(gameport);
-	else
-		return inb(gameport->io);
+#ifdef CONFIG_HAS_IOPORT
+	return inb(gameport->io);
+#else
+	return 0xff;
+#endif
 }
 
 static inline int gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 15/38] leds: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (13 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 14/38] Input: gameport: add ISA and " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-16 16:14   ` Lee Jones
  2023-03-14 12:11 ` [PATCH v3 16/38] media: " Niklas Schnelle
                   ` (23 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Pavel Machek, Lee Jones
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-leds

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.

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

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 9dbce09eabac..55b4a4de8f1a 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -662,7 +662,7 @@ config LEDS_LM355x
 
 config LEDS_OT200
 	tristate "LED support for the Bachmann OT200"
-	depends on LEDS_CLASS && HAS_IOMEM && (X86_32 || COMPILE_TEST)
+	depends on LEDS_CLASS && HAS_IOPORT && (X86_32 || COMPILE_TEST)
 	help
 	  This option enables support for the LEDs on the Bachmann OT200.
 	  Say Y to enable LEDs on the Bachmann OT200.
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 16/38] media: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (14 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 15/38] leds: add " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 17/38] misc: " Niklas Schnelle
                   ` (22 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Mauro Carvalho Chehab, Sean Young
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-media

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.

Reviewed-by: Sean Young <sean@mess.org> # media/rc
Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/media/pci/dm1105/Kconfig |  2 +-
 drivers/media/radio/Kconfig      | 14 +++++++++++++-
 drivers/media/rc/Kconfig         |  6 ++++++
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/dm1105/Kconfig b/drivers/media/pci/dm1105/Kconfig
index e0e3af67c99c..4498c37f4990 100644
--- a/drivers/media/pci/dm1105/Kconfig
+++ b/drivers/media/pci/dm1105/Kconfig
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config DVB_DM1105
 	tristate "SDMC DM1105 based PCI cards"
-	depends on DVB_CORE && PCI && I2C && I2C_ALGOBIT
+	depends on DVB_CORE && PCI && I2C && I2C_ALGOBIT && HAS_IOPORT
 	select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_STV0299 if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_STV0288 if MEDIA_SUBDRV_AUTOSELECT
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index 616a38feb641..d52eccdc7eb9 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -15,7 +15,7 @@ if RADIO_ADAPTERS
 
 config RADIO_MAXIRADIO
 	tristate "Guillemot MAXI Radio FM 2000 radio"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select RADIO_TEA575X
 	help
 	  Choose Y here if you have this radio card.  This card may also be
@@ -232,6 +232,7 @@ source "drivers/media/radio/wl128x/Kconfig"
 menuconfig V4L_RADIO_ISA_DRIVERS
 	bool "ISA radio devices"
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	help
 	  Say Y here to enable support for these ISA drivers.
 
@@ -240,6 +241,7 @@ if V4L_RADIO_ISA_DRIVERS
 config RADIO_AZTECH
 	tristate "Aztech/Packard Bell Radio"
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	select RADIO_ISA
 	help
 	  Choose Y here if you have one of these FM radio cards, and then fill
@@ -260,6 +262,7 @@ config RADIO_AZTECH_PORT
 config RADIO_CADET
 	tristate "ADS Cadet AM/FM Tuner"
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	help
 	  Choose Y here if you have one of these AM/FM radio cards, and then
 	  fill in the port address below.
@@ -270,6 +273,7 @@ config RADIO_CADET
 config RADIO_GEMTEK
 	tristate "GemTek Radio card (or compatible) support"
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	select RADIO_ISA
 	help
 	  Choose Y here if you have this FM radio card, and then fill in the
@@ -309,6 +313,7 @@ config RADIO_GEMTEK_PROBE
 
 config RADIO_ISA
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	tristate
 
 config RADIO_MIROPCM20
@@ -329,6 +334,7 @@ config RADIO_MIROPCM20
 config RADIO_RTRACK
 	tristate "AIMSlab RadioTrack (aka RadioReveal) support"
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	select RADIO_ISA
 	help
 	  Choose Y here if you have one of these FM radio cards, and then fill
@@ -383,6 +389,7 @@ config RADIO_RTRACK_PORT
 config RADIO_SF16FMI
 	tristate "SF16-FMI/SF16-FMP/SF16-FMD Radio"
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	help
 	  Choose Y here if you have one of these FM radio cards.
 
@@ -392,6 +399,7 @@ config RADIO_SF16FMI
 config RADIO_SF16FMR2
 	tristate "SF16-FMR2/SF16-FMD2 Radio"
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	select RADIO_TEA575X
 	help
 	  Choose Y here if you have one of these FM radio cards.
@@ -402,6 +410,7 @@ config RADIO_SF16FMR2
 config RADIO_TERRATEC
 	tristate "TerraTec ActiveRadio ISA Standalone"
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	select RADIO_ISA
 	help
 	  Choose Y here if you have this FM radio card.
@@ -416,6 +425,7 @@ config RADIO_TERRATEC
 config RADIO_TRUST
 	tristate "Trust FM radio card"
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	select RADIO_ISA
 	help
 	  This is a driver for the Trust FM radio cards. Say Y if you have
@@ -439,6 +449,7 @@ config RADIO_TRUST_PORT
 config RADIO_TYPHOON
 	tristate "Typhoon Radio (a.k.a. EcoRadio)"
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	select RADIO_ISA
 	help
 	  Choose Y here if you have one of these FM radio cards, and then fill
@@ -473,6 +484,7 @@ config RADIO_TYPHOON_PORT
 config RADIO_ZOLTRIX
 	tristate "Zoltrix Radio"
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 	select RADIO_ISA
 	help
 	  Choose Y here if you have one of these FM radio cards, and then fill
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index ac4172feb6f9..922c790b577e 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -148,6 +148,7 @@ if RC_DEVICES
 config IR_ENE
 	tristate "ENE eHome Receiver/Transceiver (pnp id: ENE0100/ENE02xxx)"
 	depends on PNP || COMPILE_TEST
+	depends on HAS_IOPORT
 	help
 	   Say Y here to enable support for integrated infrared receiver
 	   /transceiver made by ENE.
@@ -161,6 +162,7 @@ config IR_ENE
 config IR_FINTEK
 	tristate "Fintek Consumer Infrared Transceiver"
 	depends on PNP || COMPILE_TEST
+	depends on HAS_IOPORT
 	help
 	   Say Y here to enable support for integrated infrared receiver
 	   /transceiver made by Fintek. This chip is found on assorted
@@ -249,6 +251,7 @@ config IR_IMON_RAW
 config IR_ITE_CIR
 	tristate "ITE Tech Inc. IT8712/IT8512 Consumer Infrared Transceiver"
 	depends on PNP || COMPILE_TEST
+	depends on HAS_IOPORT
 	help
 	   Say Y here to enable support for integrated infrared receivers
 	   /transceivers made by ITE Tech Inc. These are found in
@@ -301,6 +304,7 @@ config IR_MTK
 config IR_NUVOTON
 	tristate "Nuvoton w836x7hg Consumer Infrared Transceiver"
 	depends on PNP || COMPILE_TEST
+	depends on HAS_IOPORT
 	help
 	   Say Y here to enable support for integrated infrared receiver
 	   /transceiver made by Nuvoton (formerly Winbond). This chip is
@@ -345,6 +349,7 @@ config IR_RX51
 
 config IR_SERIAL
 	tristate "Homebrew Serial Port Receiver"
+	depends on HAS_IOPORT
 	help
 	   Say Y if you want to use Homebrew Serial Port Receivers and
 	   Transceivers.
@@ -412,6 +417,7 @@ config IR_TTUSBIR
 config IR_WINBOND_CIR
 	tristate "Winbond IR remote control"
 	depends on (X86 && PNP) || COMPILE_TEST
+	depends on HAS_IOPORT
 	select NEW_LEDS
 	select LEDS_CLASS
 	select BITREVERSE
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 17/38] misc: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (15 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 16/38] media: " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 18/38] mISDN: " Niklas Schnelle
                   ` (21 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman
  Cc: Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann

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/misc/altera-stapl/Makefile | 3 ++-
 drivers/misc/altera-stapl/altera.c | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/altera-stapl/Makefile b/drivers/misc/altera-stapl/Makefile
index dd0f8189666b..90f18e7bf9b0 100644
--- a/drivers/misc/altera-stapl/Makefile
+++ b/drivers/misc/altera-stapl/Makefile
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
-altera-stapl-objs = altera-lpt.o altera-jtag.o altera-comp.o altera.o
+altera-stapl-y = altera-jtag.o altera-comp.o altera.o
+altera-stapl-$(CONFIG_HAS_IOPORT) += altera-lpt.o
 
 obj-$(CONFIG_ALTERA_STAPL) += altera-stapl.o
diff --git a/drivers/misc/altera-stapl/altera.c b/drivers/misc/altera-stapl/altera.c
index a58b7cb81d98..587427b73914 100644
--- a/drivers/misc/altera-stapl/altera.c
+++ b/drivers/misc/altera-stapl/altera.c
@@ -2407,6 +2407,10 @@ int altera_init(struct altera_config *config, const struct firmware *fw)
 
 	astate->config = config;
 	if (!astate->config->jtag_io) {
+		if (!IS_ENABLED(CONFIG_HAS_IOPORT)) {
+			retval = -ENODEV;
+			goto free_state;
+		}
 		dprintk("%s: using byteblaster!\n", __func__);
 		astate->config->jtag_io = netup_jtag_io_lpt;
 	}
@@ -2481,7 +2485,7 @@ int altera_init(struct altera_config *config, const struct firmware *fw)
 
 	} else if (exec_result)
 		printk(KERN_ERR "%s: error %d\n", __func__, exec_result);
-
+free_state:
 	kfree(astate);
 free_value:
 	kfree(value);
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 18/38] mISDN: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (16 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 17/38] misc: " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-15  5:41   ` Jakub Kicinski
  2023-03-14 12:11 ` [PATCH v3 19/38] mpt fusion: " Niklas Schnelle
                   ` (20 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Karsten Keil
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, netdev

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. With that the !S390 dependency on ISDN can be
removed as all drivers without HAS_IOPORT requirement now build.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/isdn/Kconfig                |  1 -
 drivers/isdn/hardware/mISDN/Kconfig | 12 ++++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/isdn/Kconfig b/drivers/isdn/Kconfig
index 2690e2c5a158..6fd1b3f84a29 100644
--- a/drivers/isdn/Kconfig
+++ b/drivers/isdn/Kconfig
@@ -6,7 +6,6 @@
 menuconfig ISDN
 	bool "ISDN support"
 	depends on NET && NETDEVICES
-	depends on !S390 && !UML
 	help
 	  ISDN ("Integrated Services Digital Network", called RNIS in France)
 	  is a fully digital telephone service that can be used for voice and
diff --git a/drivers/isdn/hardware/mISDN/Kconfig b/drivers/isdn/hardware/mISDN/Kconfig
index 078eeadf707a..a35bff8a93f5 100644
--- a/drivers/isdn/hardware/mISDN/Kconfig
+++ b/drivers/isdn/hardware/mISDN/Kconfig
@@ -14,7 +14,7 @@ config MISDN_HFCPCI
 
 config MISDN_HFCMULTI
 	tristate "Support for HFC multiport cards (HFC-4S/8S/E1)"
-	depends on PCI || CPM1
+	depends on (PCI || CPM1) && HAS_IOPORT
 	depends on MISDN
 	help
 	  Enable support for cards with Cologne Chip AG's HFC multiport
@@ -43,7 +43,7 @@ config MISDN_HFCUSB
 config MISDN_AVMFRITZ
 	tristate "Support for AVM FRITZ!CARD PCI"
 	depends on MISDN
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select MISDN_IPAC
 	help
 	  Enable support for AVMs FRITZ!CARD PCI cards
@@ -51,7 +51,7 @@ config MISDN_AVMFRITZ
 config MISDN_SPEEDFAX
 	tristate "Support for Sedlbauer Speedfax+"
 	depends on MISDN
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select MISDN_IPAC
 	select MISDN_ISAR
 	help
@@ -60,7 +60,7 @@ config MISDN_SPEEDFAX
 config MISDN_INFINEON
 	tristate "Support for cards with Infineon chipset"
 	depends on MISDN
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select MISDN_IPAC
 	help
 	  Enable support for cards with ISAC + HSCX, IPAC or IPAC-SX
@@ -69,14 +69,14 @@ config MISDN_INFINEON
 config MISDN_W6692
 	tristate "Support for cards with Winbond 6692"
 	depends on MISDN
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  Enable support for Winbond 6692 PCI chip based cards.
 
 config MISDN_NETJET
 	tristate "Support for NETJet cards"
 	depends on MISDN
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	depends on TTY
 	select MISDN_IPAC
 	select MISDN_HDLC
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 19/38] mpt fusion: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (17 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 18/38] mISDN: " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 12:11 ` [PATCH v3 20/38] net: handle " Niklas Schnelle
                   ` (19 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Sathya Prakash, Sreekanth Reddy, Suganath Prabu Subramani
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	MPT-FusionLinux.pdl, linux-scsi

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/message/fusion/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig
index a3d0288fd0e2..88a6e506a942 100644
--- a/drivers/message/fusion/Kconfig
+++ b/drivers/message/fusion/Kconfig
@@ -2,7 +2,7 @@
 
 menuconfig FUSION
 	bool "Fusion MPT device support"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	Say Y here to get to see options for Fusion Message
 	Passing Technology (MPT) drivers.
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 20/38] net: handle HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (18 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 19/38] mpt fusion: " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-15  5:41   ` Jakub Kicinski
  2023-03-15  9:47   ` Maciej W. Rozycki
  2023-03-14 12:11 ` [PATCH v3 21/38] parport: PC style parport depends on HAS_IOPORT Niklas Schnelle
                   ` (18 subsequent siblings)
  38 siblings, 2 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michael Grzeschik, Wolfgang Grandegger,
	Marc Kleine-Budde, Jesse Brandeburg, Tony Nguyen,
	Maciej W. Rozycki, Ralf Baechle
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, netdev,
	linux-can, intel-wired-lan, linux-hams

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 requiring them. For the DEFXX driver there use of I/O
ports is optional and we only need to fence those paths.can It also
turns out that with HAS_IOPORT handled explicitly HAMRADIO does not need
the !S390 dependency and successfully builds the bpqether driver.

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/net/Kconfig                  | 2 +-
 drivers/net/arcnet/Kconfig           | 2 +-
 drivers/net/can/cc770/Kconfig        | 1 +
 drivers/net/can/sja1000/Kconfig      | 1 +
 drivers/net/ethernet/3com/Kconfig    | 4 ++--
 drivers/net/ethernet/8390/Kconfig    | 6 +++---
 drivers/net/ethernet/amd/Kconfig     | 4 ++--
 drivers/net/ethernet/fujitsu/Kconfig | 2 +-
 drivers/net/ethernet/intel/Kconfig   | 2 +-
 drivers/net/ethernet/sis/Kconfig     | 4 ++--
 drivers/net/ethernet/smsc/Kconfig    | 2 +-
 drivers/net/ethernet/ti/Kconfig      | 2 +-
 drivers/net/ethernet/via/Kconfig     | 1 +
 drivers/net/ethernet/xircom/Kconfig  | 2 +-
 drivers/net/fddi/Kconfig             | 2 +-
 drivers/net/fddi/defxx.c             | 2 +-
 drivers/net/hamradio/Kconfig         | 6 +++---
 drivers/net/wan/Kconfig              | 2 +-
 net/ax25/Kconfig                     | 2 +-
 19 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index c34bd432da27..170387314f1b 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -474,7 +474,7 @@ source "drivers/net/ipa/Kconfig"
 
 config NET_SB1000
 	tristate "General Instruments Surfboard 1000"
-	depends on PNP
+	depends on ISA && PNP
 	help
 	  This is a driver for the General Instrument (also known as
 	  NextLevel) SURFboard 1000 internal
diff --git a/drivers/net/arcnet/Kconfig b/drivers/net/arcnet/Kconfig
index a51b9dab6d3a..d1d07a1d4fbc 100644
--- a/drivers/net/arcnet/Kconfig
+++ b/drivers/net/arcnet/Kconfig
@@ -4,7 +4,7 @@
 #
 
 menuconfig ARCNET
-	depends on NETDEVICES && (ISA || PCI || PCMCIA)
+	depends on NETDEVICES && (ISA || PCI || PCMCIA) && HAS_IOPORT
 	tristate "ARCnet support"
 	help
 	  If you have a network card of this type, say Y and check out the
diff --git a/drivers/net/can/cc770/Kconfig b/drivers/net/can/cc770/Kconfig
index 9ef1359319f0..467ef19de1c1 100644
--- a/drivers/net/can/cc770/Kconfig
+++ b/drivers/net/can/cc770/Kconfig
@@ -7,6 +7,7 @@ if CAN_CC770
 
 config CAN_CC770_ISA
 	tristate "ISA Bus based legacy CC770 driver"
+	depends on ISA
 	help
 	  This driver adds legacy support for CC770 and AN82527 chips
 	  connected to the ISA bus using I/O port, memory mapped or
diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig
index 4b2f9cb17fc3..01168db4c106 100644
--- a/drivers/net/can/sja1000/Kconfig
+++ b/drivers/net/can/sja1000/Kconfig
@@ -87,6 +87,7 @@ config CAN_PLX_PCI
 
 config CAN_SJA1000_ISA
 	tristate "ISA Bus based legacy SJA1000 driver"
+	depends on ISA
 	help
 	  This driver adds legacy support for SJA1000 chips connected to
 	  the ISA bus using I/O port, memory mapped or indirect access.
diff --git a/drivers/net/ethernet/3com/Kconfig b/drivers/net/ethernet/3com/Kconfig
index 706bd59bf645..1fbab79e2be4 100644
--- a/drivers/net/ethernet/3com/Kconfig
+++ b/drivers/net/ethernet/3com/Kconfig
@@ -44,7 +44,7 @@ config 3C515
 
 config PCMCIA_3C574
 	tristate "3Com 3c574 PCMCIA support"
-	depends on PCMCIA
+	depends on PCMCIA && HAS_IOPORT
 	help
 	  Say Y here if you intend to attach a 3Com 3c574 or compatible PCMCIA
 	  (PC-card) Fast Ethernet card to your computer.
@@ -54,7 +54,7 @@ config PCMCIA_3C574
 
 config PCMCIA_3C589
 	tristate "3Com 3c589 PCMCIA support"
-	depends on PCMCIA
+	depends on PCMCIA && HAS_IOPORT
 	help
 	  Say Y here if you intend to attach a 3Com 3c589 or compatible PCMCIA
 	  (PC-card) Ethernet card to your computer.
diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig
index a4130e643342..345f250781c6 100644
--- a/drivers/net/ethernet/8390/Kconfig
+++ b/drivers/net/ethernet/8390/Kconfig
@@ -19,7 +19,7 @@ if NET_VENDOR_8390
 
 config PCMCIA_AXNET
 	tristate "Asix AX88190 PCMCIA support"
-	depends on PCMCIA
+	depends on PCMCIA && HAS_IOPORT
 	help
 	  Say Y here if you intend to attach an Asix AX88190-based PCMCIA
 	  (PC-card) Fast Ethernet card to your computer.  These cards are
@@ -117,7 +117,7 @@ config NE2000
 
 config NE2K_PCI
 	tristate "PCI NE2000 and clones support (see help)"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select CRC32
 	help
 	  This driver is for NE2000 compatible PCI cards. It will not work
@@ -146,7 +146,7 @@ config APNE
 
 config PCMCIA_PCNET
 	tristate "NE2000 compatible PCMCIA support"
-	depends on PCMCIA
+	depends on PCMCIA && HAS_IOPORT
 	select CRC32
 	help
 	  Say Y here if you intend to attach an NE2000 compatible PCMCIA
diff --git a/drivers/net/ethernet/amd/Kconfig b/drivers/net/ethernet/amd/Kconfig
index ab42f75b9413..2f19b4a24d53 100644
--- a/drivers/net/ethernet/amd/Kconfig
+++ b/drivers/net/ethernet/amd/Kconfig
@@ -56,7 +56,7 @@ config LANCE
 
 config PCNET32
 	tristate "AMD PCnet32 PCI support"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select CRC32
 	select MII
 	help
@@ -122,7 +122,7 @@ config MVME147_NET
 
 config PCMCIA_NMCLAN
 	tristate "New Media PCMCIA support"
-	depends on PCMCIA
+	depends on PCMCIA && HAS_IOPORT
 	help
 	  Say Y here if you intend to attach a New Media Ethernet or LiveWire
 	  PCMCIA (PC-card) Ethernet card to your computer.
diff --git a/drivers/net/ethernet/fujitsu/Kconfig b/drivers/net/ethernet/fujitsu/Kconfig
index 0a1400cb410a..06a28bce5d27 100644
--- a/drivers/net/ethernet/fujitsu/Kconfig
+++ b/drivers/net/ethernet/fujitsu/Kconfig
@@ -18,7 +18,7 @@ if NET_VENDOR_FUJITSU
 
 config PCMCIA_FMVJ18X
 	tristate "Fujitsu FMV-J18x PCMCIA support"
-	depends on PCMCIA
+	depends on PCMCIA && HAS_IOPORT
 	select CRC32
 	help
 	  Say Y here if you intend to attach a Fujitsu FMV-J18x or compatible
diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
index c18c3b373846..bfb182310135 100644
--- a/drivers/net/ethernet/intel/Kconfig
+++ b/drivers/net/ethernet/intel/Kconfig
@@ -41,7 +41,7 @@ config E100
 
 config E1000
 	tristate "Intel(R) PRO/1000 Gigabit Ethernet support"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  This driver supports Intel(R) PRO/1000 gigabit ethernet family of
 	  adapters.  For more information on how to identify your adapter, go
diff --git a/drivers/net/ethernet/sis/Kconfig b/drivers/net/ethernet/sis/Kconfig
index 775d76d9890e..7e498bdbca73 100644
--- a/drivers/net/ethernet/sis/Kconfig
+++ b/drivers/net/ethernet/sis/Kconfig
@@ -19,7 +19,7 @@ if NET_VENDOR_SIS
 
 config SIS900
 	tristate "SiS 900/7016 PCI Fast Ethernet Adapter support"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select CRC32
 	select MII
 	help
@@ -35,7 +35,7 @@ config SIS900
 
 config SIS190
 	tristate "SiS190/SiS191 gigabit ethernet support"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select CRC32
 	select MII
 	help
diff --git a/drivers/net/ethernet/smsc/Kconfig b/drivers/net/ethernet/smsc/Kconfig
index 5f22a8a4d27b..13ce9086a9ca 100644
--- a/drivers/net/ethernet/smsc/Kconfig
+++ b/drivers/net/ethernet/smsc/Kconfig
@@ -54,7 +54,7 @@ config SMC91X
 
 config PCMCIA_SMC91C92
 	tristate "SMC 91Cxx PCMCIA support"
-	depends on PCMCIA
+	depends on PCMCIA && HAS_IOPORT
 	select CRC32
 	select MII
 	help
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index fce06663e1e1..20068acce9fe 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -161,7 +161,7 @@ config TI_KEYSTONE_NETCP_ETHSS
 
 config TLAN
 	tristate "TI ThunderLAN support"
-	depends on (PCI || EISA)
+	depends on (PCI || EISA) && HAS_IOPORT
 	help
 	  If you have a PCI Ethernet network card based on the ThunderLAN chip
 	  which is supported by this driver, say Y here.
diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig
index da287ef65be7..00773f5e4d7e 100644
--- a/drivers/net/ethernet/via/Kconfig
+++ b/drivers/net/ethernet/via/Kconfig
@@ -20,6 +20,7 @@ config VIA_RHINE
 	tristate "VIA Rhine support"
 	depends on PCI || (OF_IRQ && GENERIC_PCI_IOMAP)
 	depends on PCI || ARCH_VT8500 || COMPILE_TEST
+	depends on HAS_IOPORT
 	depends on HAS_DMA
 	select CRC32
 	select MII
diff --git a/drivers/net/ethernet/xircom/Kconfig b/drivers/net/ethernet/xircom/Kconfig
index 7497b9bea511..bfbdcf758afb 100644
--- a/drivers/net/ethernet/xircom/Kconfig
+++ b/drivers/net/ethernet/xircom/Kconfig
@@ -19,7 +19,7 @@ if NET_VENDOR_XIRCOM
 
 config PCMCIA_XIRC2PS
 	tristate "Xircom 16-bit PCMCIA support"
-	depends on PCMCIA
+	depends on PCMCIA && HAS_IOPORT
 	help
 	  Say Y here if you intend to attach a Xircom 16-bit PCMCIA (PC-card)
 	  Ethernet or Fast Ethernet card to your computer.
diff --git a/drivers/net/fddi/Kconfig b/drivers/net/fddi/Kconfig
index 846bf41c2717..fa3f1e0fe143 100644
--- a/drivers/net/fddi/Kconfig
+++ b/drivers/net/fddi/Kconfig
@@ -29,7 +29,7 @@ config DEFZA
 
 config DEFXX
 	tristate "Digital DEFTA/DEFEA/DEFPA adapter support"
-	depends on FDDI && (PCI || EISA || TC)
+	depends on FDDI && (PCI || EISA || TC) && HAS_IOPORT
 	help
 	  This is support for the DIGITAL series of TURBOchannel (DEFTA),
 	  EISA (DEFEA) and PCI (DEFPA) controllers which can connect you
diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c
index 1fef8a9b1a0f..5f386eba9618 100644
--- a/drivers/net/fddi/defxx.c
+++ b/drivers/net/fddi/defxx.c
@@ -254,7 +254,7 @@ static const char version[] =
 #define DFX_BUS_TC(dev) 0
 #endif
 
-#if defined(CONFIG_EISA) || defined(CONFIG_PCI)
+#ifdef HAS_IOPORT
 #define dfx_use_mmio bp->mmio
 #else
 #define dfx_use_mmio true
diff --git a/drivers/net/hamradio/Kconfig b/drivers/net/hamradio/Kconfig
index a9c44f08199d..0ac87b90b01e 100644
--- a/drivers/net/hamradio/Kconfig
+++ b/drivers/net/hamradio/Kconfig
@@ -83,7 +83,7 @@ config SCC_TRXECHO
 
 config BAYCOM_SER_FDX
 	tristate "BAYCOM ser12 fullduplex driver for AX.25"
-	depends on AX25 && !S390
+	depends on AX25 && HAS_IOPORT
 	select CRC_CCITT
 	help
 	  This is one of two drivers for Baycom style simple amateur radio
@@ -103,7 +103,7 @@ config BAYCOM_SER_FDX
 
 config BAYCOM_SER_HDX
 	tristate "BAYCOM ser12 halfduplex driver for AX.25"
-	depends on AX25 && !S390
+	depends on AX25 && HAS_IOPORT
 	select CRC_CCITT
 	help
 	  This is one of two drivers for Baycom style simple amateur radio
@@ -151,7 +151,7 @@ config BAYCOM_EPP
 
 config YAM
 	tristate "YAM driver for AX.25"
-	depends on AX25 && !S390
+	depends on AX25 && HAS_IOPORT
 	help
 	  The YAM is a modem for packet radio which connects to the serial
 	  port and includes some of the functions of a Terminal Node
diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index dcb069dde66b..417e2c2d349d 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -178,7 +178,7 @@ config C101
 
 config FARSYNC
 	tristate "FarSync T-Series support"
-	depends on HDLC && PCI
+	depends on HDLC && PCI && HAS_IOPORT
 	help
 	  Support for the FarSync T-Series X.21 (and V.35/V.24) cards by
 	  FarSite Communications Ltd.
diff --git a/net/ax25/Kconfig b/net/ax25/Kconfig
index d3a9843a043d..f769e8f4bd02 100644
--- a/net/ax25/Kconfig
+++ b/net/ax25/Kconfig
@@ -4,7 +4,7 @@
 #
 
 menuconfig HAMRADIO
-	depends on NET && !S390
+	depends on NET
 	bool "Amateur Radio support"
 	help
 	  If you want to connect your Linux box to an amateur radio, answer Y
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 21/38] parport: PC style parport depends on HAS_IOPORT
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (19 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 20/38] net: handle " Niklas Schnelle
@ 2023-03-14 12:11 ` Niklas Schnelle
  2023-03-14 14:12   ` Arnd Bergmann
  2023-05-02 15:30   ` Bjorn Helgaas
  2023-03-14 12:12 ` [PATCH v3 22/38] PCI: Make quirk using inw() depend " Niklas Schnelle
                   ` (17 subsequent siblings)
  38 siblings, 2 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:11 UTC (permalink / raw)
  To: Arnd Bergmann, Sudip Mukherjee
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann

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


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 22/38] PCI: Make quirk using inw() depend on HAS_IOPORT
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (20 preceding siblings ...)
  2023-03-14 12:11 ` [PATCH v3 21/38] parport: PC style parport depends on HAS_IOPORT Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 12:12 ` [PATCH v3 23/38] PCI/sysfs: Make I/O resource " Niklas Schnelle
                   ` (16 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Bjorn Helgaas
  Cc: Greg Kroah-Hartman, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann

In the future inw() and friends will not be compiled on architectures
without I/O port support.

Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/pci/quirks.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 44cab813bf95..3289295f56a4 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -268,6 +268,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC,	PCI_DEVICE_ID_NEC_CBUS_2,	quirk_isa_d
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC,	PCI_DEVICE_ID_NEC_CBUS_3,	quirk_isa_dma_hangs);
 #endif
 
+#ifdef CONFIG_HAS_IOPORT
 /*
  * Intel NM10 "TigerPoint" LPC PM1a_STS.BM_STS must be clear
  * for some HT machines to use C4 w/o hanging.
@@ -287,6 +288,7 @@ static void quirk_tigerpoint_bm_sts(struct pci_dev *dev)
 	}
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TGP_LPC, quirk_tigerpoint_bm_sts);
+#endif
 
 /* Chipsets where PCI->PCI transfers vanish or hang */
 static void quirk_nopcipci(struct pci_dev *dev)
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 23/38] PCI/sysfs: Make I/O resource depend on HAS_IOPORT
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (21 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 22/38] PCI: Make quirk using inw() depend " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 16:05   ` Bjorn Helgaas
  2023-03-14 12:12 ` [PATCH v3 24/38] pcmcia: add HAS_IOPORT dependencies Niklas Schnelle
                   ` (15 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Bjorn Helgaas
  Cc: Greg Kroah-Hartman, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann

If legacy I/O spaces are not supported simply return an error when
trying to access them via pci_resource_io(). This allows inb() and
friends to become undefined when they are known at compile time to be
non-functional in a later patch.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/pci/pci-sysfs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index dd0d9d9bc509..11e92d106761 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1083,6 +1083,7 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
 			       struct bin_attribute *attr, char *buf,
 			       loff_t off, size_t count, bool write)
 {
+#ifdef CONFIG_HAS_IOPORT
 	struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
 	int bar = (unsigned long)attr->private;
 	unsigned long port = off;
@@ -1116,6 +1117,9 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
 		return 4;
 	}
 	return -EINVAL;
+#else
+	return -ENXIO;
+#endif
 }
 
 static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj,
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 24/38] pcmcia: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (22 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 23/38] PCI/sysfs: Make I/O resource " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 12:12 ` [PATCH v3 25/38] platform: " Niklas Schnelle
                   ` (14 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Dominik Brodowski
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. Add dependencies for those drivers that use them.

Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/pcmcia/Kconfig | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index 44c16508ef14..e72419d7e72e 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -5,7 +5,6 @@
 
 menuconfig PCCARD
 	tristate "PCCard (PCMCIA/CardBus) support"
-	depends on !UML
 	help
 	  Say Y here if you want to attach PCMCIA- or PC-cards to your Linux
 	  computer.  These are credit-card size devices such as network cards,
@@ -113,7 +112,7 @@ config YENTA_TOSHIBA
 
 config PD6729
 	tristate "Cirrus PD6729 compatible bridge support"
-	depends on PCMCIA && PCI
+	depends on PCMCIA && PCI && HAS_IOPORT
 	select PCCARD_NONSTATIC
 	help
 	  This provides support for the Cirrus PD6729 PCI-to-PCMCIA bridge
@@ -121,7 +120,7 @@ config PD6729
 
 config I82092
 	tristate "i82092 compatible bridge support"
-	depends on PCMCIA && PCI
+	depends on PCMCIA && PCI && HAS_IOPORT
 	select PCCARD_NONSTATIC
 	help
 	  This provides support for the Intel I82092AA PCI-to-PCMCIA bridge device,
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 25/38] platform: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (23 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 24/38] pcmcia: add HAS_IOPORT dependencies Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-15  2:21   ` Tzung-Bi Shih
  2023-03-14 12:12 ` [PATCH v3 26/38] pnp: " Niklas Schnelle
                   ` (13 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Benson Leung
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	chrome-platform

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/platform/chrome/Kconfig          | 1 +
 drivers/platform/chrome/wilco_ec/Kconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/platform/chrome/Kconfig b/drivers/platform/chrome/Kconfig
index 7d82a0946e1c..7eb1cfde29b4 100644
--- a/drivers/platform/chrome/Kconfig
+++ b/drivers/platform/chrome/Kconfig
@@ -132,6 +132,7 @@ config CROS_EC_UART
 config CROS_EC_LPC
 	tristate "ChromeOS Embedded Controller (LPC)"
 	depends on CROS_EC && ACPI && (X86 || COMPILE_TEST)
+	depends on HAS_IOPORT
 	help
 	  If you say Y here, you get support for talking to the ChromeOS EC
 	  over an LPC bus, including the LPC Microchip EC (MEC) variant.
diff --git a/drivers/platform/chrome/wilco_ec/Kconfig b/drivers/platform/chrome/wilco_ec/Kconfig
index 49e8530ca0ac..d1648fb099ac 100644
--- a/drivers/platform/chrome/wilco_ec/Kconfig
+++ b/drivers/platform/chrome/wilco_ec/Kconfig
@@ -3,6 +3,7 @@ config WILCO_EC
 	tristate "ChromeOS Wilco Embedded Controller"
 	depends on X86 || COMPILE_TEST
 	depends on ACPI && CROS_EC_LPC && LEDS_CLASS
+	depends on HAS_IOPORT
 	help
 	  If you say Y here, you get support for talking to the ChromeOS
 	  Wilco EC over an eSPI bus. This uses a simple byte-level protocol
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 26/38] pnp: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (24 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 25/38] platform: " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-20 17:37   ` Rafael J. Wysocki
  2023-03-14 12:12 ` [PATCH v3 27/38] power: " Niklas Schnelle
                   ` (12 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Jaroslav Kysela, Rafael J. Wysocki
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-acpi

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to depend on HAS_IOPORT even when
compile testing only.

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

diff --git a/drivers/pnp/isapnp/Kconfig b/drivers/pnp/isapnp/Kconfig
index d0479a563123..79bd48f1dd94 100644
--- a/drivers/pnp/isapnp/Kconfig
+++ b/drivers/pnp/isapnp/Kconfig
@@ -4,7 +4,7 @@
 #
 config ISAPNP
 	bool "ISA Plug and Play support"
-	depends on ISA || COMPILE_TEST
+	depends on ISA || (HAS_IOPORT && COMPILE_TEST)
 	help
 	  Say Y here if you would like support for ISA Plug and Play devices.
 	  Some information is in <file:Documentation/driver-api/isapnp.rst>.
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 27/38] power: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (25 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 26/38] pnp: " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-29 23:01   ` Sebastian Reichel
  2023-03-14 12:12 ` [PATCH v3 28/38] rtc: " Niklas Schnelle
                   ` (11 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Sebastian Reichel
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-pm

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/power/reset/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 8c87eeda0fec..fff07b2bd77b 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -158,6 +158,7 @@ config POWER_RESET_OXNAS
 config POWER_RESET_PIIX4_POWEROFF
 	tristate "Intel PIIX4 power-off driver"
 	depends on PCI
+	depends on HAS_IOPORT
 	depends on MIPS || COMPILE_TEST
 	help
 	  This driver supports powering off a system using the Intel PIIX4
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 28/38] rtc: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (26 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 27/38] power: " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 12:52   ` Alexandre Belloni
  2023-03-14 12:12 ` [PATCH v3 29/38] scsi: " Niklas Schnelle
                   ` (10 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Alessandro Zummo, Alexandre Belloni
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-rtc

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/rtc/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 5a71579af0a1..20aa77bf0a9f 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -956,6 +956,7 @@ comment "Platform RTC drivers"
 config RTC_DRV_CMOS
 	tristate "PC-style 'CMOS'"
 	depends on X86 || ARM || PPC || MIPS || SPARC64
+	depends on HAS_IOPORT
 	default y if X86
 	select RTC_MC146818_LIB
 	help
@@ -976,6 +977,7 @@ config RTC_DRV_CMOS
 config RTC_DRV_ALPHA
 	bool "Alpha PC-style CMOS"
 	depends on ALPHA
+	depends on HAS_IOPORT
 	select RTC_MC146818_LIB
 	default y
 	help
@@ -1193,7 +1195,7 @@ config RTC_DRV_MSM6242
 
 config RTC_DRV_BQ4802
 	tristate "TI BQ4802"
-	depends on HAS_IOMEM
+	depends on HAS_IOMEM && HAS_IOPORT
 	help
 	  If you say Y here you will get support for the TI
 	  BQ4802 RTC chip.
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 29/38] scsi: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (27 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 28/38] rtc: " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 12:12 ` [PATCH v3 30/38] sound: " Niklas Schnelle
                   ` (9 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, James E.J. Bottomley, Martin K. Petersen,
	Hannes Reinecke, Kashyap Desai, Sumit Saxena, Shivasharan S,
	Nilesh Javali, GR-QLogic-Storage-Upstream
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-scsi,
	megaraidlinux.pdl

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/scsi/Kconfig                   | 25 +++++++++++++------------
 drivers/scsi/aic7xxx/Kconfig.aic79xx   |  2 +-
 drivers/scsi/aic7xxx/Kconfig.aic7xxx   |  2 +-
 drivers/scsi/aic94xx/Kconfig           |  2 +-
 drivers/scsi/megaraid/Kconfig.megaraid |  6 +++---
 drivers/scsi/mvsas/Kconfig             |  2 +-
 drivers/scsi/pcmcia/Kconfig            |  6 +++++-
 drivers/scsi/qla2xxx/Kconfig           |  2 +-
 8 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 03e71e3d5e5b..4ff96d8f6455 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -334,7 +334,7 @@ config SGIWD93_SCSI
 
 config BLK_DEV_3W_XXXX_RAID
 	tristate "3ware 5/6/7/8xxx ATA-RAID support"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	help
 	  3ware is the only hardware ATA-Raid product in Linux to date.
 	  This card is 2,4, or 8 channel master mode support only.
@@ -381,7 +381,7 @@ config SCSI_3W_SAS
 
 config SCSI_ACARD
 	tristate "ACARD SCSI support"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	help
 	  This driver supports the ACARD SCSI host adapter.
 	  Support Chip <ATP870 ATP876 ATP880 ATP885>
@@ -462,7 +462,7 @@ config SCSI_MVUMI
 config SCSI_ADVANSYS
 	tristate "AdvanSys SCSI support"
 	depends on SCSI
-	depends on ISA || EISA || PCI
+	depends on (ISA || EISA || PCI) && HAS_IOPORT
 	depends on ISA_DMA_API || !ISA
 	help
 	  This is a driver for all SCSI host adapters manufactured by
@@ -503,7 +503,7 @@ config SCSI_HPTIOP
 
 config SCSI_BUSLOGIC
 	tristate "BusLogic SCSI support"
-	depends on PCI && SCSI
+	depends on SCSI && PCI && HAS_IOPORT
 	help
 	  This is support for BusLogic MultiMaster and FlashPoint SCSI Host
 	  Adapters. Consult the SCSI-HOWTO, available from
@@ -518,7 +518,7 @@ config SCSI_BUSLOGIC
 
 config SCSI_FLASHPOINT
 	bool "FlashPoint support"
-	depends on SCSI_BUSLOGIC && PCI
+	depends on SCSI_BUSLOGIC && PCI && HAS_IOPORT
 	help
 	  This option allows you to add FlashPoint support to the
 	  BusLogic SCSI driver. The FlashPoint SCCB Manager code is
@@ -632,7 +632,7 @@ config SCSI_SNIC_DEBUG_FS
 
 config SCSI_DMX3191D
 	tristate "DMX3191D SCSI support"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	select SCSI_SPI_ATTRS
 	help
 	  This is support for Domex DMX3191D SCSI Host Adapters.
@@ -646,7 +646,7 @@ config SCSI_FDOMAIN
 
 config SCSI_FDOMAIN_PCI
 	tristate "Future Domain TMC-3260/AHA-2920A PCI SCSI support"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	select SCSI_FDOMAIN
 	help
 	  This is support for Future Domain's PCI SCSI host adapters (TMC-3260)
@@ -699,7 +699,7 @@ config SCSI_GENERIC_NCR5380
 
 config SCSI_IPS
 	tristate "IBM ServeRAID support"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	help
 	  This is support for the IBM ServeRAID hardware RAID controllers.
 	  See <http://www.developer.ibm.com/welcome/netfinity/serveraid.html>
@@ -759,7 +759,7 @@ config SCSI_IBMVFC_TRACE
 
 config SCSI_INITIO
 	tristate "Initio 9100U(W) support"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	help
 	  This is support for the Initio 91XXU(W) SCSI host adapter.  Please
 	  read the SCSI-HOWTO, available from
@@ -770,7 +770,7 @@ config SCSI_INITIO
 
 config SCSI_INIA100
 	tristate "Initio INI-A100U2W support"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	help
 	  This is support for the Initio INI-A100U2W SCSI host adapter.
 	  Please read the SCSI-HOWTO, available from
@@ -782,6 +782,7 @@ config SCSI_INIA100
 config SCSI_PPA
 	tristate "IOMEGA parallel port (ppa - older drives)"
 	depends on SCSI && PARPORT_PC
+	depends on HAS_IOPORT
 	help
 	  This driver supports older versions of IOMEGA's parallel port ZIP
 	  drive (a 100 MB removable media device).
@@ -1176,7 +1177,7 @@ config SCSI_SIM710
 
 config SCSI_DC395x
 	tristate "Tekram DC395(U/UW/F) and DC315(U) SCSI support"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	select SCSI_SPI_ATTRS
 	help
 	  This driver supports PCI SCSI host adapters based on the ASIC
@@ -1208,7 +1209,7 @@ config SCSI_AM53C974
 
 config SCSI_NSP32
 	tristate "Workbit NinjaSCSI-32Bi/UDE support"
-	depends on PCI && SCSI && !64BIT
+	depends on PCI && SCSI && !64BIT && HAS_IOPORT
 	help
 	  This is support for the Workbit NinjaSCSI-32Bi/UDE PCI/Cardbus
 	  SCSI host adapter. Please read the SCSI-HOWTO, available from
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic79xx b/drivers/scsi/aic7xxx/Kconfig.aic79xx
index a47dbd500e9a..4bc53eec4c83 100644
--- a/drivers/scsi/aic7xxx/Kconfig.aic79xx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic79xx
@@ -5,7 +5,7 @@
 #
 config SCSI_AIC79XX
 	tristate "Adaptec AIC79xx U320 support"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	select SCSI_SPI_ATTRS
 	help
 	This driver supports all of Adaptec's Ultra 320 PCI-X
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic7xxx b/drivers/scsi/aic7xxx/Kconfig.aic7xxx
index 0cfd92ce750a..f0425145a5f4 100644
--- a/drivers/scsi/aic7xxx/Kconfig.aic7xxx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic7xxx
@@ -5,7 +5,7 @@
 #
 config SCSI_AIC7XXX
 	tristate "Adaptec AIC7xxx Fast -> U160 support"
-	depends on (PCI || EISA) && SCSI
+	depends on (PCI || EISA) && HAS_IOPORT && SCSI
 	select SCSI_SPI_ATTRS
 	help
 	This driver supports all of Adaptec's Fast through Ultra 160 PCI
diff --git a/drivers/scsi/aic94xx/Kconfig b/drivers/scsi/aic94xx/Kconfig
index 71931c371b1c..aaa8dadc6e1c 100644
--- a/drivers/scsi/aic94xx/Kconfig
+++ b/drivers/scsi/aic94xx/Kconfig
@@ -8,7 +8,7 @@
 
 config SCSI_AIC94XX
 	tristate "Adaptec AIC94xx SAS/SATA support"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select SCSI_SAS_LIBSAS
 	select FW_LOADER
 	help
diff --git a/drivers/scsi/megaraid/Kconfig.megaraid b/drivers/scsi/megaraid/Kconfig.megaraid
index 2adc2afd9f91..3f2ce1eb081c 100644
--- a/drivers/scsi/megaraid/Kconfig.megaraid
+++ b/drivers/scsi/megaraid/Kconfig.megaraid
@@ -1,13 +1,13 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config MEGARAID_NEWGEN
 	bool "LSI Logic New Generation RAID Device Drivers"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	help
 	LSI Logic RAID Device Drivers
 
 config MEGARAID_MM
 	tristate "LSI Logic Management Module (New Driver)"
-	depends on PCI && SCSI && MEGARAID_NEWGEN
+	depends on PCI && HAS_IOPORT && SCSI && MEGARAID_NEWGEN
 	help
 	Management Module provides ioctl, sysfs support for LSI Logic
 	RAID controllers.
@@ -67,7 +67,7 @@ config MEGARAID_MAILBOX
 
 config MEGARAID_LEGACY
 	tristate "LSI Logic Legacy MegaRAID Driver"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	help
 	This driver supports the LSI MegaRAID 418, 428, 438, 466, 762, 490
 	and 467 SCSI host adapters. This driver also support the all U320
diff --git a/drivers/scsi/mvsas/Kconfig b/drivers/scsi/mvsas/Kconfig
index 79812b80743b..5ac7fd593b17 100644
--- a/drivers/scsi/mvsas/Kconfig
+++ b/drivers/scsi/mvsas/Kconfig
@@ -9,7 +9,7 @@
 
 config SCSI_MVSAS
 	tristate "Marvell 88SE64XX/88SE94XX SAS/SATA support"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select SCSI_SAS_LIBSAS
 	select FW_LOADER
 	help
diff --git a/drivers/scsi/pcmcia/Kconfig b/drivers/scsi/pcmcia/Kconfig
index 9696b6b5591f..449bd85db7bb 100644
--- a/drivers/scsi/pcmcia/Kconfig
+++ b/drivers/scsi/pcmcia/Kconfig
@@ -12,6 +12,7 @@ if SCSI_LOWLEVEL_PCMCIA && SCSI && PCMCIA && m
 
 config PCMCIA_AHA152X
 	tristate "Adaptec AHA152X PCMCIA support"
+	depends on HAS_IOPORT
 	select SCSI_SPI_ATTRS
 	help
 	  Say Y here if you intend to attach this type of PCMCIA SCSI host
@@ -22,6 +23,7 @@ config PCMCIA_AHA152X
 
 config PCMCIA_FDOMAIN
 	tristate "Future Domain PCMCIA support"
+	depends on HAS_IOPORT
 	select SCSI_FDOMAIN
 	help
 	  Say Y here if you intend to attach this type of PCMCIA SCSI host
@@ -32,7 +34,7 @@ config PCMCIA_FDOMAIN
 
 config PCMCIA_NINJA_SCSI
 	tristate "NinjaSCSI-3 / NinjaSCSI-32Bi (16bit) PCMCIA support"
-	depends on !64BIT || COMPILE_TEST
+	depends on (!64BIT || COMPILE_TEST) && HAS_IOPORT
 	help
 	  If you intend to attach this type of PCMCIA SCSI host adapter to
 	  your computer, say Y here and read
@@ -66,6 +68,7 @@ config PCMCIA_NINJA_SCSI
 
 config PCMCIA_QLOGIC
 	tristate "Qlogic PCMCIA support"
+	depends on HAS_IOPORT
 	help
 	  Say Y here if you intend to attach this type of PCMCIA SCSI host
 	  adapter to your computer.
@@ -75,6 +78,7 @@ config PCMCIA_QLOGIC
 
 config PCMCIA_SYM53C500
 	tristate "Symbios 53c500 PCMCIA support"
+	depends on HAS_IOPORT
 	help
 	  Say Y here if you have a New Media Bus Toaster or other PCMCIA
 	  SCSI adapter based on the Symbios 53c500 controller.
diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig
index 802c373fd6d9..a584708d3056 100644
--- a/drivers/scsi/qla2xxx/Kconfig
+++ b/drivers/scsi/qla2xxx/Kconfig
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config SCSI_QLA_FC
 	tristate "QLogic QLA2XXX Fibre Channel Support"
-	depends on PCI && SCSI
+	depends on PCI && HAS_IOPORT && SCSI
 	depends on SCSI_FC_ATTRS
 	depends on NVME_FC || !NVME_FC
 	select FW_LOADER
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 30/38] sound: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (28 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 29/38] scsi: " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 12:33   ` Takashi Iwai
  2023-03-14 12:12 ` [PATCH v3 31/38] speakup: add HAS_IOPORT dependency for SPEAKUP_SERIALIO Niklas Schnelle
                   ` (8 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Jaroslav Kysela, Takashi Iwai
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, alsa-devel

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>
---
 sound/drivers/Kconfig |  3 +++
 sound/isa/Kconfig     | 31 ++++++++++++++++++++++++++---
 sound/pci/Kconfig     | 45 ++++++++++++++++++++++++++++++++-----------
 sound/pcmcia/Kconfig  |  2 ++
 4 files changed, 67 insertions(+), 14 deletions(-)

diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig
index be3009746f3a..864991d8776d 100644
--- a/sound/drivers/Kconfig
+++ b/sound/drivers/Kconfig
@@ -128,6 +128,7 @@ config SND_VIRMIDI
 
 config SND_MTPAV
 	tristate "MOTU MidiTimePiece AV multiport MIDI"
+	depends on HAS_IOPORT
 	select SND_RAWMIDI
 	help
 	  To use a MOTU MidiTimePiece AV multiport MIDI adapter
@@ -152,6 +153,7 @@ config SND_MTS64
 
 config SND_SERIAL_U16550
 	tristate "UART16550 serial MIDI driver"
+	depends on HAS_IOPORT
 	select SND_RAWMIDI
 	help
 	  To include support for MIDI serial port interfaces, say Y here
@@ -185,6 +187,7 @@ config SND_SERIAL_GENERIC
 
 config SND_MPU401
 	tristate "Generic MPU-401 UART driver"
+	depends on HAS_IOPORT
 	select SND_MPU401_UART
 	help
 	  Say Y here to include support for MIDI ports compatible with
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index 6ffa48dd5983..c7cef1e656fa 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -23,6 +23,7 @@ menuconfig SND_ISA
 	bool "ISA sound devices"
 	depends on ISA || COMPILE_TEST
 	depends on ISA_DMA_API
+	depends on HAS_IOPORT
 	default y
 	help
 	  Support for sound devices connected via the ISA bus.
@@ -31,6 +32,7 @@ if SND_ISA
 
 config SND_ADLIB
 	tristate "AdLib FM card"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	help
 	  Say Y here to include support for AdLib FM cards.
@@ -41,6 +43,7 @@ config SND_ADLIB
 config SND_AD1816A
 	tristate "Analog Devices SoundPort AD1816A"
 	depends on PNP
+	depends on HAS_IOPORT
 	select ISAPNP
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
@@ -69,6 +72,7 @@ config SND_AD1848
 config SND_ALS100
 	tristate "Diamond Tech. DT-019x and Avance Logic ALSxxx"
 	depends on PNP
+	depends on HAS_IOPORT
 	select ISAPNP
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
@@ -84,6 +88,7 @@ config SND_ALS100
 config SND_AZT1605
 	tristate "Aztech AZT1605 Driver"
 	depends on SND
+	depends on HAS_IOPORT
 	select SND_WSS_LIB
 	select SND_MPU401_UART
 	select SND_OPL3_LIB
@@ -97,6 +102,7 @@ config SND_AZT1605
 config SND_AZT2316
 	tristate "Aztech AZT2316 Driver"
 	depends on SND
+	depends on HAS_IOPORT
 	select SND_WSS_LIB
 	select SND_MPU401_UART
 	select SND_OPL3_LIB
@@ -110,6 +116,7 @@ config SND_AZT2316
 config SND_AZT2320
 	tristate "Aztech Systems AZT2320"
 	depends on PNP
+	depends on HAS_IOPORT
 	select ISAPNP
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
@@ -123,6 +130,7 @@ config SND_AZT2320
 
 config SND_CMI8328
 	tristate "C-Media CMI8328"
+	depends on HAS_IOPORT
 	select SND_WSS_LIB
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
@@ -135,6 +143,7 @@ config SND_CMI8328
 
 config SND_CMI8330
 	tristate "C-Media CMI8330"
+	depends on HAS_IOPORT
 	select SND_WSS_LIB
 	select SND_SB16_DSP
 	select SND_OPL3_LIB
@@ -148,6 +157,7 @@ config SND_CMI8330
 
 config SND_CS4231
 	tristate "Generic Cirrus Logic CS4231 driver"
+	depends on HAS_IOPORT
 	select SND_MPU401_UART
 	select SND_WSS_LIB
 	help
@@ -159,6 +169,7 @@ config SND_CS4231
 
 config SND_CS4236
 	tristate "Generic Cirrus Logic CS4232/CS4236+ driver"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_WSS_LIB
@@ -172,6 +183,7 @@ config SND_CS4236
 
 config SND_ES1688
 	tristate "Generic ESS ES688/ES1688 and ES968 PnP driver"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_PCM
@@ -184,6 +196,7 @@ config SND_ES1688
 
 config SND_ES18XX
 	tristate "Generic ESS ES18xx driver"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_PCM
@@ -195,7 +208,7 @@ config SND_ES18XX
 
 config SND_SC6000
 	tristate "Gallant SC-6000/6600/7000 and Audio Excel DSP 16"
-	depends on HAS_IOPORT_MAP
+	depends on HAS_IOPORT_MAP && HAS_IOPORT
 	select SND_WSS_LIB
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
@@ -223,6 +236,7 @@ config SND_GUSCLASSIC
 
 config SND_GUSEXTREME
 	tristate "Gravis UltraSound Extreme"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_PCM
@@ -273,6 +287,7 @@ config SND_INTERWAVE_STB
 
 config SND_JAZZ16
 	tristate "Media Vision Jazz16 card and compatibles"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_SB8_DSP
@@ -289,6 +304,7 @@ config SND_JAZZ16
 
 config SND_OPL3SA2
 	tristate "Yamaha OPL3-SA2/SA3"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_WSS_LIB
@@ -301,6 +317,7 @@ config SND_OPL3SA2
 
 config SND_OPTI92X_AD1848
 	tristate "OPTi 82C92x - AD1848"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_OPL4_LIB
 	select SND_MPU401_UART
@@ -314,6 +331,7 @@ config SND_OPTI92X_AD1848
 
 config SND_OPTI92X_CS4231
 	tristate "OPTi 82C92x - CS4231"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_OPL4_LIB
 	select SND_MPU401_UART
@@ -327,6 +345,7 @@ config SND_OPTI92X_CS4231
 
 config SND_OPTI93X
 	tristate "OPTi 82C93x"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_WSS_LIB
@@ -339,6 +358,7 @@ config SND_OPTI93X
 
 config SND_MIRO
 	tristate "Miro miroSOUND PCM1pro/PCM12/PCM20radio driver"
+	depends on HAS_IOPORT
 	select SND_OPL4_LIB
 	select SND_WSS_LIB
 	select SND_MPU401_UART
@@ -352,6 +372,7 @@ config SND_MIRO
 
 config SND_SB8
 	tristate "Sound Blaster 1.0/2.0/Pro (8-bit)"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_RAWMIDI
 	select SND_SB8_DSP
@@ -364,6 +385,7 @@ config SND_SB8
 
 config SND_SB16
 	tristate "Sound Blaster 16 (PnP)"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_SB16_DSP
@@ -376,6 +398,7 @@ config SND_SB16
 
 config SND_SBAWE
 	tristate "Sound Blaster AWE (32,64) (PnP)"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_SB16_DSP
@@ -405,6 +428,7 @@ config SND_SB16_CSP
 
 config SND_SSCAPE
 	tristate "Ensoniq SoundScape driver"
+	depends on HAS_IOPORT
 	select SND_MPU401_UART
 	select SND_WSS_LIB
 	select FW_LOADER
@@ -426,6 +450,7 @@ config SND_SSCAPE
 
 config SND_WAVEFRONT
 	tristate "Turtle Beach Maui,Tropez,Tropez+ (Wavefront)"
+	depends on HAS_IOPORT
 	select FW_LOADER
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
@@ -439,7 +464,7 @@ config SND_WAVEFRONT
 
 config SND_MSND_PINNACLE
 	tristate "Turtle Beach MultiSound Pinnacle/Fiji driver"
-	depends on X86
+	depends on X86 && HAS_IOPORT
 	select FW_LOADER
 	select SND_MPU401_UART
 	select SND_PCM
@@ -452,7 +477,7 @@ config SND_MSND_PINNACLE
 
 config SND_MSND_CLASSIC
 	tristate "Support for Turtle Beach MultiSound Classic, Tahiti, Monterey"
-	depends on X86
+	depends on X86 && HAS_IOPORT
 	select FW_LOADER
 	select SND_MPU401_UART
 	select SND_PCM
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index a55836225401..e8780bade58f 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -26,7 +26,7 @@ config SND_ALS300
 	select SND_PCM
 	select SND_AC97_CODEC
 	select SND_OPL3_LIB
-	depends on ZONE_DMA
+	depends on ZONE_DMA && HAS_IOPORT
 	help
 	  Say 'Y' or 'M' to include support for Avance Logic ALS300/ALS300+
 
@@ -36,6 +36,7 @@ config SND_ALS300
 config SND_ALS4000
 	tristate "Avance Logic ALS4000"
 	depends on ISA_DMA_API
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_PCM
@@ -51,7 +52,7 @@ config SND_ALI5451
 	tristate "ALi M5451 PCI Audio Controller"
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
-	depends on ZONE_DMA
+	depends on ZONE_DMA && HAS_IOPORT
 	help
 	  Say Y here to include support for the integrated AC97 sound
 	  device on motherboards using the ALi M5451 Audio Controller
@@ -96,6 +97,7 @@ config SND_ATIIXP_MODEM
 
 config SND_AU8810
 	tristate "Aureal Advantage"
+	depends on HAS_IOPORT
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
 	help
@@ -110,6 +112,7 @@ config SND_AU8810
 
 config SND_AU8820
 	tristate "Aureal Vortex"
+	depends on HAS_IOPORT
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
 	help
@@ -123,6 +126,7 @@ config SND_AU8820
 
 config SND_AU8830
 	tristate "Aureal Vortex 2"
+	depends on HAS_IOPORT
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
 	help
@@ -157,7 +161,7 @@ config SND_AZT3328
 	select SND_RAWMIDI
 	select SND_AC97_CODEC
 	select SND_TIMER
-	depends on ZONE_DMA
+	depends on ZONE_DMA && HAS_IOPORT
 	help
 	  Say Y here to include support for Aztech AZF3328 (PCI168)
 	  soundcards.
@@ -193,6 +197,7 @@ config SND_BT87X_OVERCLOCK
 
 config SND_CA0106
 	tristate "SB Audigy LS / Live 24bit"
+	depends on HAS_IOPORT
 	select SND_AC97_CODEC
 	select SND_RAWMIDI
 	select SND_VMASTER
@@ -205,6 +210,7 @@ config SND_CA0106
 
 config SND_CMIPCI
 	tristate "C-Media 8338, 8738, 8768, 8770"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_PCM
@@ -221,6 +227,7 @@ config SND_OXYGEN_LIB
 
 config SND_OXYGEN
 	tristate "C-Media 8786, 8787, 8788 (Oxygen)"
+	depends on HAS_IOPORT
 	select SND_OXYGEN_LIB
 	select SND_PCM
 	select SND_MPU401_UART
@@ -246,6 +253,7 @@ config SND_OXYGEN
 
 config SND_CS4281
 	tristate "Cirrus Logic (Sound Fusion) CS4281"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_RAWMIDI
 	select SND_AC97_CODEC
@@ -257,6 +265,7 @@ config SND_CS4281
 
 config SND_CS46XX
 	tristate "Cirrus Logic (Sound Fusion) CS4280/CS461x/CS462x/CS463x"
+	depends on HAS_IOPORT
 	select SND_RAWMIDI
 	select SND_AC97_CODEC
 	select FW_LOADER
@@ -290,6 +299,7 @@ config SND_CS5530
 config SND_CS5535AUDIO
 	tristate "CS5535/CS5536 Audio"
 	depends on X86_32 || MIPS || COMPILE_TEST
+	depends on HAS_IOPORT
 	select SND_PCM
 	select SND_AC97_CODEC
 	help
@@ -307,6 +317,7 @@ config SND_CS5535AUDIO
 
 config SND_CTXFI
 	tristate "Creative Sound Blaster X-Fi"
+	depends on HAS_IOPORT
 	select SND_PCM
 	help
 	  If you want to use soundcards based on Creative Sound Blastr X-Fi
@@ -468,7 +479,7 @@ config SND_EMU10K1
 	select SND_AC97_CODEC
 	select SND_TIMER
 	select SND_SEQ_DEVICE if SND_SEQUENCER != n
-	depends on ZONE_DMA
+	depends on ZONE_DMA && HAS_IOPORT
 	help
 	  Say Y to include support for Sound Blaster PCI 512, Live!,
 	  Audigy and E-mu APS (partially supported) soundcards.
@@ -491,7 +502,7 @@ config SND_EMU10K1X
 	tristate "Emu10k1X (Dell OEM Version)"
 	select SND_AC97_CODEC
 	select SND_RAWMIDI
-	depends on ZONE_DMA
+	depends on ZONE_DMA && HAS_IOPORT
 	help
 	  Say Y here to include support for the Dell OEM version of the
 	  Sound Blaster Live!.
@@ -501,6 +512,7 @@ config SND_EMU10K1X
 
 config SND_ENS1370
 	tristate "(Creative) Ensoniq AudioPCI 1370"
+	depends on HAS_IOPORT
 	select SND_RAWMIDI
 	select SND_PCM
 	help
@@ -511,6 +523,7 @@ config SND_ENS1370
 
 config SND_ENS1371
 	tristate "(Creative) Ensoniq AudioPCI 1371/1373"
+	depends on HAS_IOPORT
 	select SND_RAWMIDI
 	select SND_AC97_CODEC
 	help
@@ -525,7 +538,7 @@ config SND_ES1938
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
-	depends on ZONE_DMA
+	depends on ZONE_DMA && HAS_IOPORT
 	help
 	  Say Y here to include support for soundcards based on ESS Solo-1
 	  (ES1938, ES1946, ES1969) chips.
@@ -537,7 +550,7 @@ config SND_ES1968
 	tristate "ESS ES1968/1978 (Maestro-1/2/2E)"
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
-	depends on ZONE_DMA
+	depends on ZONE_DMA && HAS_IOPORT
 	help
 	  Say Y here to include support for soundcards based on ESS Maestro
 	  1/2/2E chips.
@@ -569,6 +582,7 @@ config SND_ES1968_RADIO
 
 config SND_FM801
 	tristate "ForteMedia FM801"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
@@ -624,7 +638,7 @@ config SND_ICE1712
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
 	select BITREVERSE
-	depends on ZONE_DMA
+	depends on ZONE_DMA && HAS_IOPORT
 	help
 	  Say Y here to include support for soundcards based on the
 	  ICE1712 (Envy24) chip.
@@ -640,6 +654,7 @@ config SND_ICE1712
 
 config SND_ICE1724
 	tristate "ICE/VT1724/1720 (Envy24HT/PT)"
+	depends on HAS_IOPORT
 	select SND_RAWMIDI
 	select SND_AC97_CODEC
 	select SND_VMASTER
@@ -712,7 +727,7 @@ config SND_LX6464ES
 config SND_MAESTRO3
 	tristate "ESS Allegro/Maestro3"
 	select SND_AC97_CODEC
-	depends on ZONE_DMA
+	depends on ZONE_DMA && HAS_IOPORT
 	help
 	  Say Y here to include support for soundcards based on ESS Maestro 3
 	  (Allegro) chips.
@@ -753,6 +768,7 @@ config SND_NM256
 
 config SND_PCXHR
 	tristate "Digigram PCXHR"
+	depends on HAS_IOPORT
 	select FW_LOADER
 	select SND_PCM
 	select SND_HWDEP
@@ -764,6 +780,7 @@ config SND_PCXHR
 
 config SND_RIPTIDE
 	tristate "Conexant Riptide"
+	depends on HAS_IOPORT
 	select FW_LOADER
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
@@ -808,6 +825,7 @@ config SND_RME9652
 config SND_SE6X
 	tristate "Studio Evolution SE6X"
 	depends on SND_OXYGEN=n && SND_VIRTUOSO=n  # PCI ID conflict
+	depends on HAS_IOPORT
 	select SND_OXYGEN_LIB
 	select SND_PCM
 	select SND_MPU401_UART
@@ -830,7 +848,7 @@ config SND_SONICVIBES
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
-	depends on ZONE_DMA
+	depends on ZONE_DMA && HAS_IOPORT
 	help
 	  Say Y here to include support for soundcards based on the S3
 	  SonicVibes chip.
@@ -842,7 +860,7 @@ config SND_TRIDENT
 	tristate "Trident 4D-Wave DX/NX; SiS 7018"
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
-	depends on ZONE_DMA
+	depends on ZONE_DMA && HAS_IOPORT
 	help
 	  Say Y here to include support for soundcards based on Trident
 	  4D-Wave DX/NX or SiS 7018 chips.
@@ -852,6 +870,7 @@ config SND_TRIDENT
 
 config SND_VIA82XX
 	tristate "VIA 82C686A/B, 8233/8235 AC97 Controller"
+	depends on HAS_IOPORT
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
 	help
@@ -863,6 +882,7 @@ config SND_VIA82XX
 
 config SND_VIA82XX_MODEM
 	tristate "VIA 82C686A/B, 8233 based Modems"
+	depends on HAS_IOPORT
 	select SND_AC97_CODEC
 	help
 	  Say Y here to include support for the integrated MC97 modem on
@@ -873,6 +893,7 @@ config SND_VIA82XX_MODEM
 
 config SND_VIRTUOSO
 	tristate "Asus Virtuoso 66/100/200 (Xonar)"
+	depends on HAS_IOPORT
 	select SND_OXYGEN_LIB
 	select SND_PCM
 	select SND_MPU401_UART
@@ -889,6 +910,7 @@ config SND_VIRTUOSO
 
 config SND_VX222
 	tristate "Digigram VX222"
+	depends on HAS_IOPORT
 	select SND_VX_LIB
 	help
 	  Say Y here to include support for Digigram VX222 soundcards.
@@ -898,6 +920,7 @@ config SND_VX222
 
 config SND_YMFPCI
 	tristate "Yamaha YMF724/740/744/754"
+	depends on HAS_IOPORT
 	select SND_OPL3_LIB
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
diff --git a/sound/pcmcia/Kconfig b/sound/pcmcia/Kconfig
index 10291c43cb18..b133ad423f84 100644
--- a/sound/pcmcia/Kconfig
+++ b/sound/pcmcia/Kconfig
@@ -13,6 +13,7 @@ if SND_PCMCIA && PCMCIA
 config SND_VXPOCKET
 	tristate "Digigram VXpocket"
 	select SND_VX_LIB
+	depends on HAS_IOPORT
 	help
 	  Say Y here to include support for Digigram VXpocket and
 	  VXpocket 440 soundcards.
@@ -22,6 +23,7 @@ config SND_VXPOCKET
 
 config SND_PDAUDIOCF
 	tristate "Sound Core PDAudioCF"
+	depends on HAS_IOPORT
 	select SND_PCM
 	help
 	  Say Y here to include support for Sound Core PDAudioCF
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 31/38] speakup: add HAS_IOPORT dependency for SPEAKUP_SERIALIO
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (29 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 30/38] sound: " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 12:12 ` [PATCH v3 32/38] staging: add HAS_IOPORT dependencies Niklas Schnelle
                   ` (7 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, William Hubbs, Chris Brannon, Kirk Reiser,
	Samuel Thibault
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, speakup

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. SPEAKUP_SERIALIO thus needs to depend on HAS_IOPORT.

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/accessibility/speakup/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/accessibility/speakup/Kconfig b/drivers/accessibility/speakup/Kconfig
index 07ecbbde0384..e84fb617acc4 100644
--- a/drivers/accessibility/speakup/Kconfig
+++ b/drivers/accessibility/speakup/Kconfig
@@ -46,6 +46,7 @@ if SPEAKUP
 config SPEAKUP_SERIALIO
 	def_bool y
 	depends on ISA || COMPILE_TEST
+	depends on HAS_IOPORT
 
 config SPEAKUP_SYNTH_ACNTSA
 	tristate "Accent SA synthesizer support"
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 32/38] staging: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (30 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 31/38] speakup: add HAS_IOPORT dependency for SPEAKUP_SERIALIO Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 12:12 ` [PATCH v3 33/38] tty: serial: handle " Niklas Schnelle
                   ` (6 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman,
	Forest Bond
  Cc: Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-fbdev, linux-staging

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/staging/sm750fb/Kconfig | 2 +-
 drivers/staging/vt6655/Kconfig  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/Kconfig b/drivers/staging/sm750fb/Kconfig
index 1461c89701c3..ab3d9b057d56 100644
--- a/drivers/staging/sm750fb/Kconfig
+++ b/drivers/staging/sm750fb/Kconfig
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 config FB_SM750
 	tristate "Silicon Motion SM750 framebuffer support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_MODE_HELPERS
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
diff --git a/drivers/staging/vt6655/Kconfig b/drivers/staging/vt6655/Kconfig
index d1cd5de46dcf..077f62ebe80c 100644
--- a/drivers/staging/vt6655/Kconfig
+++ b/drivers/staging/vt6655/Kconfig
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 config VT6655
    tristate "VIA Technologies VT6655 support"
-   depends on PCI && MAC80211 && m
+   depends on PCI && HAS_IOPORT && MAC80211 && m
    help
      This is a vendor-written driver for VIA VT6655.
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 33/38] tty: serial: handle HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (31 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 32/38] staging: add HAS_IOPORT dependencies Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 12:12 ` [PATCH v3 34/38] usb: " Niklas Schnelle
                   ` (5 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Jiri Slaby
  Cc: Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-serial

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 unconditionally. For 8250 based drivers some
support MMIO only use so fence only the parts requiring I/O ports.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/tty/Kconfig                  |  2 +-
 drivers/tty/serial/8250/8250_early.c |  4 +++
 drivers/tty/serial/8250/8250_pci.c   | 14 +++++++++
 drivers/tty/serial/8250/8250_port.c  | 44 +++++++++++++++++++++++-----
 drivers/tty/serial/8250/Kconfig      |  5 ++--
 drivers/tty/serial/Kconfig           |  2 +-
 6 files changed, 59 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
index d35fc068da74..20ab18998420 100644
--- a/drivers/tty/Kconfig
+++ b/drivers/tty/Kconfig
@@ -222,7 +222,7 @@ config MOXA_INTELLIO
 
 config MOXA_SMARTIO
 	tristate "Moxa SmartIO support v. 2.0"
-	depends on SERIAL_NONSTANDARD && PCI
+	depends on SERIAL_NONSTANDARD && PCI && HAS_IOPORT
 	help
 	  Say Y here if you have a Moxa SmartIO multiport serial card and/or
 	  want to help develop a new version of this driver.
diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index 0ebde0ab8167..4192b1ae2736 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -48,8 +48,10 @@ static unsigned int serial8250_early_in(struct uart_port *port, int offset)
 		return readl(port->membase + offset);
 	case UPIO_MEM32BE:
 		return ioread32be(port->membase + offset);
+#ifdef CONFIG_HAS_IOPORT
 	case UPIO_PORT:
 		return inb(port->iobase + offset);
+#endif
 	case UPIO_AU:
 		return port->serial_in(port, reg_offset);
 	default:
@@ -75,9 +77,11 @@ static void serial8250_early_out(struct uart_port *port, int offset, int value)
 	case UPIO_MEM32BE:
 		iowrite32be(value, port->membase + offset);
 		break;
+#ifdef CONFIG_HAS_IOPORT
 	case UPIO_PORT:
 		outb(value, port->iobase + offset);
 		break;
+#endif
 	case UPIO_AU:
 		port->serial_out(port, reg_offset, value);
 		break;
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index c55be6fda0ca..70bd84a05da7 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -847,6 +847,7 @@ static int pci_netmos_init(struct pci_dev *dev)
 	return num_serial;
 }
 
+#ifdef CONFIG_HAS_IOPORT
 /*
  * These chips are available with optionally one parallel port and up to
  * two serial ports. Unfortunately they all have the same product id.
@@ -973,6 +974,7 @@ static void pci_ite887x_exit(struct pci_dev *dev)
 	ioport &= 0xffff;
 	release_region(ioport, ITE_887x_IOSIZE);
 }
+#endif /* CONFIG_HAS_IOPORT */
 
 /*
  * Oxford Semiconductor Inc.
@@ -1255,6 +1257,7 @@ static int pci_asix_setup(struct serial_private *priv,
 #define QOPR_CLOCK_X8		0x0003
 #define QOPR_CLOCK_RATE_MASK	0x0003
 
+#ifdef CONFIG_HAS_IOPORT
 /* Quatech devices have their own extra interface features */
 static struct pci_device_id quatech_cards[] = {
 	{ PCI_DEVICE_DATA(QUATECH, QSC100,   1) },
@@ -1474,6 +1477,7 @@ static int pci_quatech_setup(struct serial_private *priv,
 		pci_warn(priv->dev, "software control of RS422 features not currently supported.\n");
 	return pci_default_setup(priv, board, port, idx);
 }
+#endif /* CONFIG_HAS_IOPORT */
 
 static int pci_default_setup(struct serial_private *priv,
 		  const struct pciserial_board *board,
@@ -1753,6 +1757,7 @@ static int skip_tx_en_setup(struct serial_private *priv,
 	return pci_default_setup(priv, board, port, idx);
 }
 
+#ifdef CONFIG_HAS_IOPORT
 static void kt_handle_break(struct uart_port *p)
 {
 	struct uart_8250_port *up = up_to_u8250p(p);
@@ -1796,6 +1801,7 @@ static int kt_serial_setup(struct serial_private *priv,
 	port->port.handle_break = kt_handle_break;
 	return skip_tx_en_setup(priv, board, port, idx);
 }
+#endif /* CONFIG_HAS_IOPORT */
 
 static int pci_eg20t_init(struct pci_dev *dev)
 {
@@ -1840,6 +1846,7 @@ pci_wch_ch38x_setup(struct serial_private *priv,
 #define CH384_XINT_ENABLE_REG   0xEB
 #define CH384_XINT_ENABLE_BIT   0x02
 
+#ifdef CONFIG_HAS_IOPORT
 static int pci_wch_ch38x_init(struct pci_dev *dev)
 {
 	int max_port;
@@ -1867,6 +1874,7 @@ static void pci_wch_ch38x_exit(struct pci_dev *dev)
 	iobase = pci_resource_start(dev, 0);
 	outb(0x0, iobase + CH384_XINT_ENABLE_REG);
 }
+#endif /* CONFIG_HAS_IOPORT */
 
 
 static int
@@ -2070,6 +2078,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
 		.subdevice	= PCI_ANY_ID,
 		.setup		= ce4100_serial_setup,
 	},
+#ifdef CONFIG_HAS_IOPORT
 	{
 		.vendor		= PCI_VENDOR_ID_INTEL,
 		.device		= PCI_DEVICE_ID_INTEL_PATSBURG_KT,
@@ -2089,6 +2098,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
 		.setup		= pci_default_setup,
 		.exit		= pci_ite887x_exit,
 	},
+#endif
 	/*
 	 * National Instruments
 	 */
@@ -2210,6 +2220,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
 		.exit		= pci_ni8430_exit,
 	},
 	/* Quatech */
+#ifdef CONFIG_HAS_IOPORT
 	{
 		.vendor		= PCI_VENDOR_ID_QUATECH,
 		.device		= PCI_ANY_ID,
@@ -2218,6 +2229,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
 		.init		= pci_quatech_init,
 		.setup		= pci_quatech_setup,
 	},
+#endif
 	/*
 	 * Panacom
 	 */
@@ -2588,6 +2600,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
 		.subdevice      = PCI_ANY_ID,
 		.setup          = pci_wch_ch38x_setup,
 	},
+#ifdef CONFIG_HAS_IOPORT
 	/* WCH CH384 8S card (16850 clone) */
 	{
 		.vendor         = PCIE_VENDOR_ID_WCH,
@@ -2598,6 +2611,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
 		.exit		= pci_wch_ch38x_exit,
 		.setup          = pci_wch_ch38x_setup,
 	},
+#endif
 	/*
 	 * ASIX devices with FIFO bug
 	 */
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index fa43df05342b..f57441e31c41 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -400,6 +400,7 @@ static void au_serial_dl_write(struct uart_8250_port *up, int value)
 
 #endif
 
+#ifdef CONFIG_HAS_IOPORT
 static unsigned int hub6_serial_in(struct uart_port *p, int offset)
 {
 	offset = offset << p->regshift;
@@ -413,6 +414,7 @@ static void hub6_serial_out(struct uart_port *p, int offset, int value)
 	outb(p->hub6 - 1 + offset, p->iobase);
 	outb(value, p->iobase + 1);
 }
+#endif /* CONFIG_HAS_IOPORT */
 
 static unsigned int mem_serial_in(struct uart_port *p, int offset)
 {
@@ -462,6 +464,7 @@ static unsigned int mem32be_serial_in(struct uart_port *p, int offset)
 	return ioread32be(p->membase + offset);
 }
 
+#ifdef CONFIG_HAS_IOPORT
 static unsigned int io_serial_in(struct uart_port *p, int offset)
 {
 	offset = offset << p->regshift;
@@ -473,6 +476,24 @@ static void io_serial_out(struct uart_port *p, int offset, int value)
 	offset = offset << p->regshift;
 	outb(value, p->iobase + offset);
 }
+#endif
+static unsigned int no_serial_in(struct uart_port *p, int offset)
+{
+	return (unsigned int)-1;
+}
+
+static void no_serial_out(struct uart_port *p, int offset, int value)
+{
+}
+
+#ifdef CONFIG_HAS_IOPORT
+static inline bool is_upf_fourport(struct uart_port *port)
+{
+	return port->flags & UPF_FOURPORT;
+}
+#else
+#define is_upf_fourport(x)	false
+#endif
 
 static int serial8250_default_handle_irq(struct uart_port *port);
 
@@ -484,10 +505,12 @@ static void set_io_from_upio(struct uart_port *p)
 	up->dl_write = default_serial_dl_write;
 
 	switch (p->iotype) {
+#ifdef CONFIG_HAS_IOPORT
 	case UPIO_HUB6:
 		p->serial_in = hub6_serial_in;
 		p->serial_out = hub6_serial_out;
 		break;
+#endif
 
 	case UPIO_MEM:
 		p->serial_in = mem_serial_in;
@@ -518,10 +541,17 @@ static void set_io_from_upio(struct uart_port *p)
 		break;
 #endif
 
-	default:
+#ifdef CONFIG_HAS_IOPORT
+	case UPIO_PORT:
 		p->serial_in = io_serial_in;
 		p->serial_out = io_serial_out;
 		break;
+#endif
+
+	default:
+		WARN(1, "Unsupported UART type %x\n", p->iotype);
+		p->serial_in = no_serial_in;
+		p->serial_out = no_serial_out;
 	}
 	/* Remember loaded iotype */
 	up->cur_iotype = p->iotype;
@@ -1378,7 +1408,7 @@ static void autoconfig_irq(struct uart_8250_port *up)
 	unsigned long irqs;
 	int irq;
 
-	if (port->flags & UPF_FOURPORT) {
+	if (is_upf_fourport(port)) {
 		ICP = (port->iobase & 0xfe0) | 0x1f;
 		save_ICP = inb_p(ICP);
 		outb_p(0x80, ICP);
@@ -1397,7 +1427,7 @@ static void autoconfig_irq(struct uart_8250_port *up)
 	irqs = probe_irq_on();
 	serial8250_out_MCR(up, 0);
 	udelay(10);
-	if (port->flags & UPF_FOURPORT) {
+	if (is_upf_fourport(port)) {
 		serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS);
 	} else {
 		serial8250_out_MCR(up,
@@ -1415,7 +1445,7 @@ static void autoconfig_irq(struct uart_8250_port *up)
 	serial8250_out_MCR(up, save_mcr);
 	serial_out(up, UART_IER, save_ier);
 
-	if (port->flags & UPF_FOURPORT)
+	if (is_upf_fourport(port))
 		outb_p(save_ICP, ICP);
 
 	if (uart_console(port))
@@ -2365,7 +2395,7 @@ int serial8250_do_startup(struct uart_port *port)
 	serial_port_out(port, UART_LCR, UART_LCR_WLEN8);
 
 	spin_lock_irqsave(&port->lock, flags);
-	if (up->port.flags & UPF_FOURPORT) {
+	if (is_upf_fourport(&up->port)) {
 		if (!up->port.irq)
 			up->port.mctrl |= TIOCM_OUT1;
 	} else
@@ -2447,7 +2477,7 @@ int serial8250_do_startup(struct uart_port *port)
 	 */
 	up->ier = UART_IER_RLSI | UART_IER_RDI;
 
-	if (port->flags & UPF_FOURPORT) {
+	if (is_upf_fourport(port)) {
 		unsigned int icp;
 		/*
 		 * Enable interrupts on the AST Fourport board
@@ -2490,7 +2520,7 @@ void serial8250_do_shutdown(struct uart_port *port)
 		serial8250_release_dma(up);
 
 	spin_lock_irqsave(&port->lock, flags);
-	if (port->flags & UPF_FOURPORT) {
+	if (is_upf_fourport(port)) {
 		/* reset interrupts on the AST Fourport board */
 		inb((port->iobase & 0xfe0) | 0x1f);
 		port->mctrl |= TIOCM_OUT1;
diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index 978dc196c29b..c80a45e8bd03 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -6,7 +6,6 @@
 
 config SERIAL_8250
 	tristate "8250/16550 and compatible serial support"
-	depends on !S390
 	select SERIAL_CORE
 	select SERIAL_MCTRL_GPIO if GPIOLIB
 	help
@@ -72,7 +71,7 @@ config SERIAL_8250_16550A_VARIANTS
 
 config SERIAL_8250_FINTEK
 	bool "Support for Fintek F81216A LPC to 4 UART RS485 API"
-	depends on SERIAL_8250
+	depends on SERIAL_8250 && HAS_IOPORT
 	help
 	  Selecting this option will add support for the RS485 capabilities
 	  of the Fintek F81216A LPC to 4 UART.
@@ -160,7 +159,7 @@ config SERIAL_8250_HP300
 
 config SERIAL_8250_CS
 	tristate "8250/16550 PCMCIA device support"
-	depends on PCMCIA && SERIAL_8250
+	depends on PCMCIA && SERIAL_8250 && HAS_IOPORT
 	help
 	  Say Y here to enable support for 16-bit PCMCIA serial devices,
 	  including serial port cards, modems, and the modem functions of
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 625358f44419..c3d69074b6d6 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -878,7 +878,7 @@ config SERIAL_TXX9_STDSERIAL
 
 config SERIAL_JSM
 	tristate "Digi International NEO and Classic PCI Support"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	select SERIAL_CORE
 	help
 	  This is a driver for Digi International's Neo and Classic series
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 34/38] usb: handle HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (32 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 33/38] tty: serial: handle " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 14:56   ` Arnd Bergmann
  2023-03-14 12:12 ` [PATCH v3 35/38] video: " Niklas Schnelle
                   ` (4 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Mathias Nyman, Alan Stern
  Cc: Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-usb

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to guard sections of code calling them
as alternative access methods with CONFIG_HAS_IOPORT checks. Similarly
drivers requiring these functions need to depend on HAS_IOPORT.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/usb/core/hcd-pci.c    |   2 +
 drivers/usb/host/Kconfig      |   4 +-
 drivers/usb/host/pci-quirks.c | 125 ++++++++++++++++++----------------
 drivers/usb/host/pci-quirks.h |  31 ++++++---
 drivers/usb/host/uhci-hcd.c   |   2 +-
 drivers/usb/host/uhci-hcd.h   |  36 ++++++----
 6 files changed, 117 insertions(+), 83 deletions(-)

diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index ab2f3737764e..f2e825ee3246 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -206,8 +206,10 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct hc_driver *driver)
 		goto free_irq_vectors;
 	}
 
+#ifdef CONFIG_USB_PCI_AMD
 	hcd->amd_resume_bug = (usb_hcd_amd_remote_wakeup_quirk(dev) &&
 			driver->flags & (HCD_USB11 | HCD_USB3)) ? 1 : 0;
+#endif
 
 	if (driver->flags & HCD_MEMORY) {
 		/* EHCI, OHCI */
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index eacb603ad1b2..73315ad28a75 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -376,7 +376,7 @@ config USB_ISP116X_HCD
 
 config USB_ISP1362_HCD
 	tristate "ISP1362 HCD support"
-	depends on HAS_IOMEM
+	depends on HAS_IOPORT
 	depends on COMPILE_TEST # nothing uses this
 	help
 	  Supports the Philips ISP1362 chip as a host controller
@@ -578,7 +578,7 @@ endif # USB_OHCI_HCD
 
 config USB_UHCI_HCD
 	tristate "UHCI HCD (most Intel and VIA) support"
-	depends on USB_PCI || USB_UHCI_SUPPORT_NON_PCI_HC
+	depends on (USB_PCI && HAS_IOPORT) || USB_UHCI_SUPPORT_NON_PCI_HC
 	help
 	  The Universal Host Controller Interface is a standard by Intel for
 	  accessing the USB hardware in the PC (which is also called the USB
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index ef08d68b9714..98870f26b250 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -60,6 +60,23 @@
 #define EHCI_USBLEGCTLSTS	4		/* legacy control/status */
 #define EHCI_USBLEGCTLSTS_SOOE	(1 << 13)	/* SMI on ownership change */
 
+/* ASMEDIA quirk use */
+#define ASMT_DATA_WRITE0_REG	0xF8
+#define ASMT_DATA_WRITE1_REG	0xFC
+#define ASMT_CONTROL_REG	0xE0
+#define ASMT_CONTROL_WRITE_BIT	0x02
+#define ASMT_WRITEREG_CMD	0x10423
+#define ASMT_FLOWCTL_ADDR	0xFA30
+#define ASMT_FLOWCTL_DATA	0xBA
+#define ASMT_PSEUDO_DATA	0
+
+/* Intel quirk use */
+#define USB_INTEL_XUSB2PR      0xD0
+#define USB_INTEL_USB2PRM      0xD4
+#define USB_INTEL_USB3_PSSEN   0xD8
+#define USB_INTEL_USB3PRM      0xDC
+
+#ifdef CONFIG_USB_PCI_AMD
 /* AMD quirk use */
 #define	AB_REG_BAR_LOW		0xe0
 #define	AB_REG_BAR_HIGH		0xe1
@@ -93,21 +110,6 @@
 #define	NB_PIF0_PWRDOWN_0	0x01100012
 #define	NB_PIF0_PWRDOWN_1	0x01100013
 
-#define USB_INTEL_XUSB2PR      0xD0
-#define USB_INTEL_USB2PRM      0xD4
-#define USB_INTEL_USB3_PSSEN   0xD8
-#define USB_INTEL_USB3PRM      0xDC
-
-/* ASMEDIA quirk use */
-#define ASMT_DATA_WRITE0_REG	0xF8
-#define ASMT_DATA_WRITE1_REG	0xFC
-#define ASMT_CONTROL_REG	0xE0
-#define ASMT_CONTROL_WRITE_BIT	0x02
-#define ASMT_WRITEREG_CMD	0x10423
-#define ASMT_FLOWCTL_ADDR	0xFA30
-#define ASMT_FLOWCTL_DATA	0xBA
-#define ASMT_PSEUDO_DATA	0
-
 /*
  * amd_chipset_gen values represent AMD different chipset generations
  */
@@ -460,50 +462,6 @@ void usb_amd_quirk_pll_disable(void)
 }
 EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_disable);
 
-static int usb_asmedia_wait_write(struct pci_dev *pdev)
-{
-	unsigned long retry_count;
-	unsigned char value;
-
-	for (retry_count = 1000; retry_count > 0; --retry_count) {
-
-		pci_read_config_byte(pdev, ASMT_CONTROL_REG, &value);
-
-		if (value == 0xff) {
-			dev_err(&pdev->dev, "%s: check_ready ERROR", __func__);
-			return -EIO;
-		}
-
-		if ((value & ASMT_CONTROL_WRITE_BIT) == 0)
-			return 0;
-
-		udelay(50);
-	}
-
-	dev_warn(&pdev->dev, "%s: check_write_ready timeout", __func__);
-	return -ETIMEDOUT;
-}
-
-void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev)
-{
-	if (usb_asmedia_wait_write(pdev) != 0)
-		return;
-
-	/* send command and address to device */
-	pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_WRITEREG_CMD);
-	pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_FLOWCTL_ADDR);
-	pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
-
-	if (usb_asmedia_wait_write(pdev) != 0)
-		return;
-
-	/* send data to device */
-	pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_FLOWCTL_DATA);
-	pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_PSEUDO_DATA);
-	pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
-}
-EXPORT_SYMBOL_GPL(usb_asmedia_modifyflowcontrol);
-
 void usb_amd_quirk_pll_enable(void)
 {
 	usb_amd_quirk_pll(0);
@@ -632,7 +590,53 @@ bool usb_amd_pt_check_port(struct device *device, int port)
 	return !(value & BIT(port_shift));
 }
 EXPORT_SYMBOL_GPL(usb_amd_pt_check_port);
+#endif
+
+static int usb_asmedia_wait_write(struct pci_dev *pdev)
+{
+	unsigned long retry_count;
+	unsigned char value;
+
+	for (retry_count = 1000; retry_count > 0; --retry_count) {
+
+		pci_read_config_byte(pdev, ASMT_CONTROL_REG, &value);
+
+		if (value == 0xff) {
+			dev_err(&pdev->dev, "%s: check_ready ERROR", __func__);
+			return -EIO;
+		}
+
+		if ((value & ASMT_CONTROL_WRITE_BIT) == 0)
+			return 0;
+
+		udelay(50);
+	}
+
+	dev_warn(&pdev->dev, "%s: check_write_ready timeout", __func__);
+	return -ETIMEDOUT;
+}
+
+void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev)
+{
+	if (usb_asmedia_wait_write(pdev) != 0)
+		return;
+
+	/* send command and address to device */
+	pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_WRITEREG_CMD);
+	pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_FLOWCTL_ADDR);
+	pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
+
+	if (usb_asmedia_wait_write(pdev) != 0)
+		return;
 
+	/* send data to device */
+	pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_FLOWCTL_DATA);
+	pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_PSEUDO_DATA);
+	pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
+}
+EXPORT_SYMBOL_GPL(usb_asmedia_modifyflowcontrol);
+
+#ifdef CONFIG_HAS_IOPORT
 /*
  * Make sure the controller is completely inactive, unable to
  * generate interrupts or do DMA.
@@ -713,6 +717,7 @@ int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base)
 	return 1;
 }
 EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc);
+#endif
 
 static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)
 {
@@ -725,6 +730,7 @@ static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)
 
 static void quirk_usb_handoff_uhci(struct pci_dev *pdev)
 {
+#ifdef HAS_IOPORT
 	unsigned long base = 0;
 	int i;
 
@@ -739,6 +745,7 @@ static void quirk_usb_handoff_uhci(struct pci_dev *pdev)
 
 	if (base)
 		uhci_check_and_reset_hc(pdev, base);
+#endif
 }
 
 static int mmio_resource_enabled(struct pci_dev *pdev, int idx)
diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h
index e729de21fad7..5642318fd1d1 100644
--- a/drivers/usb/host/pci-quirks.h
+++ b/drivers/usb/host/pci-quirks.h
@@ -2,33 +2,48 @@
 #ifndef __LINUX_USB_PCI_QUIRKS_H
 #define __LINUX_USB_PCI_QUIRKS_H
 
-#ifdef CONFIG_USB_PCI
 void uhci_reset_hc(struct pci_dev *pdev, unsigned long base);
 int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base);
-int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev);
+
+#ifdef CONFIG_USB_PCI_AMD
 bool usb_amd_hang_symptom_quirk(void);
 bool usb_amd_prefetch_quirk(void);
 void usb_amd_dev_put(void);
 bool usb_amd_quirk_pll_check(void);
 void usb_amd_quirk_pll_disable(void);
 void usb_amd_quirk_pll_enable(void);
-void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev);
-void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev);
-void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
 void sb800_prefetch(struct device *dev, int on);
 bool usb_amd_pt_check_port(struct device *device, int port);
 #else
-struct pci_dev;
+static inline bool usb_amd_hang_symptom_quirk(void)
+{
+	return false;
+};
+static inline bool usb_amd_prefetch_quirk(void)
+{
+	return false;
+}
+static inline bool usb_amd_quirk_pll_check(void)
+{
+	return false;
+}
 static inline void usb_amd_quirk_pll_disable(void) {}
 static inline void usb_amd_quirk_pll_enable(void) {}
-static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {}
 static inline void usb_amd_dev_put(void) {}
-static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
 static inline void sb800_prefetch(struct device *dev, int on) {}
 static inline bool usb_amd_pt_check_port(struct device *device, int port)
 {
 	return false;
 }
+#endif /* CONFIG_USB_PCI_AMD */
+
+#ifdef CONFIG_USB_PCI
+void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev);
+void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev);
+void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
+#else
+static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {}
+static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
 #endif  /* CONFIG_USB_PCI */
 
 #endif  /*  __LINUX_USB_PCI_QUIRKS_H  */
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 7cdc2fa7c28f..fd2408b553cf 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -841,7 +841,7 @@ static int uhci_count_ports(struct usb_hcd *hcd)
 
 static const char hcd_name[] = "uhci_hcd";
 
-#ifdef CONFIG_USB_PCI
+#if defined(CONFIG_USB_PCI) && defined(CONFIG_HAS_IOPORT)
 #include "uhci-pci.c"
 #define	PCI_DRIVER		uhci_pci_driver
 #endif
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
index 0688c3e5bfe2..c77705d03ed0 100644
--- a/drivers/usb/host/uhci-hcd.h
+++ b/drivers/usb/host/uhci-hcd.h
@@ -505,41 +505,49 @@ static inline bool uhci_is_aspeed(const struct uhci_hcd *uhci)
  * we use memory mapped registers.
  */
 
+#ifdef CONFIG_HAS_IOPORT
+#define UHCI_IN(x)	x
+#define UHCI_OUT(x)	x
+#else
+#define UHCI_IN(x)	0
+#define UHCI_OUT(x)
+#endif
+
 #ifndef CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC
 /* Support PCI only */
 static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
 {
-	return inl(uhci->io_addr + reg);
+	return UHCI_IN(inl(uhci->io_addr + reg));
 }
 
 static inline void uhci_writel(const struct uhci_hcd *uhci, u32 val, int reg)
 {
-	outl(val, uhci->io_addr + reg);
+	UHCI_OUT(outl(val, uhci->io_addr + reg));
 }
 
 static inline u16 uhci_readw(const struct uhci_hcd *uhci, int reg)
 {
-	return inw(uhci->io_addr + reg);
+	return UHCI_IN(inw(uhci->io_addr + reg));
 }
 
 static inline void uhci_writew(const struct uhci_hcd *uhci, u16 val, int reg)
 {
-	outw(val, uhci->io_addr + reg);
+	UHCI_OUT(outw(val, uhci->io_addr + reg));
 }
 
 static inline u8 uhci_readb(const struct uhci_hcd *uhci, int reg)
 {
-	return inb(uhci->io_addr + reg);
+	return UHCI_IN(inb(uhci->io_addr + reg));
 }
 
 static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)
 {
-	outb(val, uhci->io_addr + reg);
+	UHCI_OUT(outb(val, uhci->io_addr + reg));
 }
 
 #else
 /* Support non-PCI host controllers */
-#ifdef CONFIG_USB_PCI
+#if defined(CONFIG_USB_PCI) && defined(HAS_IOPORT)
 /* Support PCI and non-PCI host controllers */
 #define uhci_has_pci_registers(u)	((u)->io_addr != 0)
 #else
@@ -587,7 +595,7 @@ static inline int uhci_aspeed_reg(unsigned int reg)
 static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
 {
 	if (uhci_has_pci_registers(uhci))
-		return inl(uhci->io_addr + reg);
+		return UHCI_IN(inl(uhci->io_addr + reg));
 	else if (uhci_is_aspeed(uhci))
 		return readl(uhci->regs + uhci_aspeed_reg(reg));
 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -601,7 +609,7 @@ static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
 static inline void uhci_writel(const struct uhci_hcd *uhci, u32 val, int reg)
 {
 	if (uhci_has_pci_registers(uhci))
-		outl(val, uhci->io_addr + reg);
+		UHCI_OUT(outl(val, uhci->io_addr + reg));
 	else if (uhci_is_aspeed(uhci))
 		writel(val, uhci->regs + uhci_aspeed_reg(reg));
 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -615,7 +623,7 @@ static inline void uhci_writel(const struct uhci_hcd *uhci, u32 val, int reg)
 static inline u16 uhci_readw(const struct uhci_hcd *uhci, int reg)
 {
 	if (uhci_has_pci_registers(uhci))
-		return inw(uhci->io_addr + reg);
+		return UHCI_IN(inw(uhci->io_addr + reg));
 	else if (uhci_is_aspeed(uhci))
 		return readl(uhci->regs + uhci_aspeed_reg(reg));
 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -629,7 +637,7 @@ static inline u16 uhci_readw(const struct uhci_hcd *uhci, int reg)
 static inline void uhci_writew(const struct uhci_hcd *uhci, u16 val, int reg)
 {
 	if (uhci_has_pci_registers(uhci))
-		outw(val, uhci->io_addr + reg);
+		UHCI_OUT(outw(val, uhci->io_addr + reg));
 	else if (uhci_is_aspeed(uhci))
 		writel(val, uhci->regs + uhci_aspeed_reg(reg));
 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -643,7 +651,7 @@ static inline void uhci_writew(const struct uhci_hcd *uhci, u16 val, int reg)
 static inline u8 uhci_readb(const struct uhci_hcd *uhci, int reg)
 {
 	if (uhci_has_pci_registers(uhci))
-		return inb(uhci->io_addr + reg);
+		return UHCI_IN(inb(uhci->io_addr + reg));
 	else if (uhci_is_aspeed(uhci))
 		return readl(uhci->regs + uhci_aspeed_reg(reg));
 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -657,7 +665,7 @@ static inline u8 uhci_readb(const struct uhci_hcd *uhci, int reg)
 static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)
 {
 	if (uhci_has_pci_registers(uhci))
-		outb(val, uhci->io_addr + reg);
+		UHCI_OUT(outb(val, uhci->io_addr + reg));
 	else if (uhci_is_aspeed(uhci))
 		writel(val, uhci->regs + uhci_aspeed_reg(reg));
 #ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -668,6 +676,8 @@ static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)
 		writeb(val, uhci->regs + reg);
 }
 #endif /* CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC */
+#undef UHCI_IN
+#undef UHCI_OUT
 
 /*
  * The GRLIB GRUSBHC controller can use big endian format for its descriptors.
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 35/38] video: handle HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (33 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 34/38] usb: " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-15  8:16   ` Geert Uytterhoeven
  2023-03-14 12:12 ` [PATCH v3 36/38] watchdog: add " Niklas Schnelle
                   ` (3 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Helge Deller
  Cc: Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-fbdev, dri-devel

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 and guard inline code in headers.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/video/console/Kconfig |  1 +
 drivers/video/fbdev/Kconfig   | 25 +++++++++++++------------
 include/video/vga.h           |  8 ++++++++
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 22cea5082ac4..64974eaa3ac5 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -10,6 +10,7 @@ config VGA_CONSOLE
 	depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC &&  !SUPERH && \
 		(!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \
 		!ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML
+	depends on HAS_IOPORT
 	select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE)
 	default y
 	help
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index ff3646c30d0d..b21a37497d22 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -338,7 +338,7 @@ config FB_IMX
 
 config FB_CYBER2000
 	tristate "CyberPro 2000/2010/5000 support"
-	depends on FB && PCI && (BROKEN || !SPARC64)
+	depends on FB && PCI && HAS_IOPORT && (BROKEN || !SPARC64)
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -432,6 +432,7 @@ config FB_FM2
 config FB_ARC
 	tristate "Arc Monochrome LCD board support"
 	depends on FB && (X86 || COMPILE_TEST)
+	depends on HAS_IOPORT
 	select FB_SYS_FILLRECT
 	select FB_SYS_COPYAREA
 	select FB_SYS_IMAGEBLIT
@@ -1260,7 +1261,7 @@ config FB_RADEON_DEBUG
 
 config FB_ATY128
 	tristate "ATI Rage128 display support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1284,7 +1285,7 @@ config FB_ATY128_BACKLIGHT
 
 config FB_ATY
 	tristate "ATI Mach64 display support" if PCI || ATARI
-	depends on FB && !SPARC32
+	depends on FB && HAS_IOPORT && !SPARC32
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1335,7 +1336,7 @@ config FB_ATY_BACKLIGHT
 
 config FB_S3
 	tristate "S3 Trio/Virge support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1396,7 +1397,7 @@ config FB_SAVAGE_ACCEL
 
 config FB_SIS
 	tristate "SiS/XGI display support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1427,7 +1428,7 @@ config FB_SIS_315
 
 config FB_VIA
 	tristate "VIA UniChrome (Pro) and Chrome9 display support"
-	depends on FB && PCI && GPIOLIB && I2C && (X86 || COMPILE_TEST)
+	depends on FB && PCI && GPIOLIB && I2C && HAS_IOPORT && (X86 || COMPILE_TEST)
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1466,7 +1467,7 @@ endif
 
 config FB_NEOMAGIC
 	tristate "NeoMagic display support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_MODE_HELPERS
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
@@ -1496,7 +1497,7 @@ config FB_KYRO
 
 config FB_3DFX
 	tristate "3Dfx Banshee/Voodoo3/Voodoo5 display support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_IMAGEBLIT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
@@ -1546,7 +1547,7 @@ config FB_VOODOO1
 
 config FB_VT8623
 	tristate "VIA VT8623 support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1561,7 +1562,7 @@ config FB_VT8623
 
 config FB_TRIDENT
 	tristate "Trident/CyberXXX/CyberBlade support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1584,7 +1585,7 @@ config FB_TRIDENT
 
 config FB_ARK
 	tristate "ARK 2000PV support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -2198,7 +2199,7 @@ config FB_SSD1307
 
 config FB_SM712
 	tristate "Silicon Motion SM712 framebuffer support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
diff --git a/include/video/vga.h b/include/video/vga.h
index 947c0abd04ef..f4b806b85c86 100644
--- a/include/video/vga.h
+++ b/include/video/vga.h
@@ -203,18 +203,26 @@ extern int restore_vga(struct vgastate *state);
 
 static inline unsigned char vga_io_r (unsigned short port)
 {
+#ifdef CONFIG_HAS_IOPORT
 	return inb_p(port);
+#else
+	return 0xff;
+#endif
 }
 
 static inline void vga_io_w (unsigned short port, unsigned char val)
 {
+#ifdef CONFIG_HAS_IOPORT
 	outb_p(val, port);
+#endif
 }
 
 static inline void vga_io_w_fast (unsigned short port, unsigned char reg,
 				  unsigned char val)
 {
+#ifdef CONFIG_HAS_IOPORT
 	outw(VGA_OUT16VAL (val, reg), port);
+#endif
 }
 
 static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 36/38] watchdog: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (34 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 35/38] video: " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 14:21   ` Guenter Roeck
  2023-03-14 12:12 ` [PATCH v3 37/38] wireless: " Niklas Schnelle
                   ` (2 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Wim Van Sebroeck, Guenter Roeck
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	linux-watchdog

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/watchdog/Kconfig | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index f0872970daf9..e5d6f886e25d 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -453,6 +453,7 @@ config 21285_WATCHDOG
 config 977_WATCHDOG
 	tristate "NetWinder WB83C977 watchdog"
 	depends on (FOOTBRIDGE && ARCH_NETWINDER) || (ARM && COMPILE_TEST)
+	depends on HAS_IOPORT
 	help
 	  Say Y here to include support for the WB977 watchdog included in
 	  NetWinder machines. Alternatively say M to compile the driver as
@@ -1271,6 +1272,7 @@ config ITCO_WDT
 	select WATCHDOG_CORE
 	depends on I2C || I2C=n
 	depends on MFD_INTEL_PMC_BXT || !MFD_INTEL_PMC_BXT
+	depends on HAS_IOPORT # for I2C_I801
 	select LPC_ICH if !EXPERT
 	select I2C_I801 if !EXPERT && I2C
 	help
@@ -2148,7 +2150,7 @@ comment "PCI-based Watchdog Cards"
 
 config PCIPCWATCHDOG
 	tristate "Berkshire Products PCI-PC Watchdog"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  This is the driver for the Berkshire Products PCI-PC Watchdog card.
 	  This card simply watches your kernel to make sure it doesn't freeze,
@@ -2163,7 +2165,7 @@ config PCIPCWATCHDOG
 
 config WDTPCI
 	tristate "PCI-WDT500/501 Watchdog timer"
-	depends on PCI
+	depends on PCI && HAS_IOPORT
 	help
 	  If you have a PCI-WDT500/501 watchdog board, say Y here, otherwise N.
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 37/38] wireless: add HAS_IOPORT dependencies
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (35 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 36/38] watchdog: add " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-15  5:26   ` Kalle Valo
  2023-03-14 12:12 ` [PATCH v3 38/38] asm-generic/io.h: drop inb() etc for HAS_IOPORT=n Niklas Schnelle
  2023-03-14 14:05 ` [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Arnd Bergmann
  38 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann, Kalle Valo, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Jouni Malinen
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	linux-wireless, netdev

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/net/wireless/atmel/Kconfig           | 2 +-
 drivers/net/wireless/intersil/hostap/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/atmel/Kconfig b/drivers/net/wireless/atmel/Kconfig
index ca45a1021cf4..bafdd57b049a 100644
--- a/drivers/net/wireless/atmel/Kconfig
+++ b/drivers/net/wireless/atmel/Kconfig
@@ -14,7 +14,7 @@ if WLAN_VENDOR_ATMEL
 
 config ATMEL
 	tristate "Atmel at76c50x chipset  802.11b support"
-	depends on CFG80211 && (PCI || PCMCIA)
+	depends on CFG80211 && (PCI || PCMCIA) && HAS_IOPORT
 	select WIRELESS_EXT
 	select WEXT_PRIV
 	select FW_LOADER
diff --git a/drivers/net/wireless/intersil/hostap/Kconfig b/drivers/net/wireless/intersil/hostap/Kconfig
index c865d3156cea..2edff8efbcbb 100644
--- a/drivers/net/wireless/intersil/hostap/Kconfig
+++ b/drivers/net/wireless/intersil/hostap/Kconfig
@@ -56,7 +56,7 @@ config HOSTAP_FIRMWARE_NVRAM
 
 config HOSTAP_PLX
 	tristate "Host AP driver for Prism2/2.5/3 in PLX9052 PCI adaptors"
-	depends on PCI && HOSTAP
+	depends on PCI && HOSTAP && HAS_IOPORT
 	help
 	Host AP driver's version for Prism2/2.5/3 PC Cards in PLX9052 based
 	PCI adaptors.
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v3 38/38] asm-generic/io.h: drop inb() etc for HAS_IOPORT=n
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (36 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 37/38] wireless: " Niklas Schnelle
@ 2023-03-14 12:12 ` Niklas Schnelle
  2023-03-14 14:05 ` [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Arnd Bergmann
  38 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 12:12 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann

With all subsystems and drivers either declaring their dependence on
HAS_IOPORT or fencing I/O port specific code sections we can finally
make inb()/outb() and friends compile-time dependent on HAS_IOPORT as
suggested by Linus in the linked mail. The main benefit of this is that
on platforms such as s390 which have no meaningful way of implementing
inb()/outb() their use without the proper HAS_IOPORT dependency will
result in easy to catch and fix compile-time errors instead of compiling
code that can never work.

Link: https://lore.kernel.org/lkml/CAHk-=wg80je=K7madF4e7WrRNp37e3qh6y10Svhdc7O8SZ_-8g@mail.gmail.com/
Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 include/asm-generic/io.h | 60 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 4c44a29b5e8e..a13fe19b55a9 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -539,6 +539,7 @@ static inline void writesq(volatile void __iomem *addr, const void *buffer,
 
 #if !defined(inb) && !defined(_inb)
 #define _inb _inb
+#ifdef CONFIG_HAS_IOPORT
 static inline u8 _inb(unsigned long addr)
 {
 	u8 val;
@@ -548,10 +549,15 @@ static inline u8 _inb(unsigned long addr)
 	__io_par(val);
 	return val;
 }
+#else
+u8 _inb(unsigned long addr)
+	__compiletime_error("inb()) requires CONFIG_HAS_IOPORT");
+#endif
 #endif
 
 #if !defined(inw) && !defined(_inw)
 #define _inw _inw
+#ifdef CONFIG_HAS_IOPORT
 static inline u16 _inw(unsigned long addr)
 {
 	u16 val;
@@ -561,10 +567,15 @@ static inline u16 _inw(unsigned long addr)
 	__io_par(val);
 	return val;
 }
+#else
+u16 _inw(unsigned long addr)
+	__compiletime_error("inw() requires CONFIG_HAS_IOPORT");
+#endif
 #endif
 
 #if !defined(inl) && !defined(_inl)
 #define _inl _inl
+#ifdef CONFIG_HAS_IOPORT
 static inline u32 _inl(unsigned long addr)
 {
 	u32 val;
@@ -574,36 +585,55 @@ static inline u32 _inl(unsigned long addr)
 	__io_par(val);
 	return val;
 }
+#else
+u32 _inl(unsigned long addr)
+	__compiletime_error("inl() requires CONFIG_HAS_IOPORT");
+#endif
 #endif
 
 #if !defined(outb) && !defined(_outb)
 #define _outb _outb
+#ifdef CONFIG_HAS_IOPORT
 static inline void _outb(u8 value, unsigned long addr)
 {
 	__io_pbw();
 	__raw_writeb(value, PCI_IOBASE + addr);
 	__io_paw();
 }
+#else
+void _outb(u8 value, unsigned long addr)
+	__compiletime_error("outb() requires CONFIG_HAS_IOPORT");
+#endif
 #endif
 
 #if !defined(outw) && !defined(_outw)
 #define _outw _outw
+#ifdef CONFIG_HAS_IOPORT
 static inline void _outw(u16 value, unsigned long addr)
 {
 	__io_pbw();
 	__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
 	__io_paw();
 }
+#else
+void _outw(u16 value, unsigned long addr)
+	__compiletime_error("outw() requires CONFIG_HAS_IOPORT");
+#endif
 #endif
 
 #if !defined(outl) && !defined(_outl)
 #define _outl _outl
+#ifdef CONFIG_HAS_IOPORT
 static inline void _outl(u32 value, unsigned long addr)
 {
 	__io_pbw();
 	__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
 	__io_paw();
 }
+#else
+void _outl(u32 value, unsigned long addr)
+	__compiletime_error("outl() requires CONFIG_HAS_IOPORT");
+#endif
 #endif
 
 #include <linux/logic_pio.h>
@@ -687,53 +717,83 @@ static inline void outl_p(u32 value, unsigned long addr)
 
 #ifndef insb
 #define insb insb
+#ifdef CONFIG_HAS_IOPORT
 static inline void insb(unsigned long addr, void *buffer, unsigned int count)
 {
 	readsb(PCI_IOBASE + addr, buffer, count);
 }
+#else
+void insb(unsigned long addr, void *buffer, unsigned int count)
+	__compiletime_error("insb() requires HAS_IOPORT");
+#endif
 #endif
 
 #ifndef insw
 #define insw insw
+#ifdef CONFIG_HAS_IOPORT
 static inline void insw(unsigned long addr, void *buffer, unsigned int count)
 {
 	readsw(PCI_IOBASE + addr, buffer, count);
 }
+#else
+void insw(unsigned long addr, void *buffer, unsigned int count)
+	__compiletime_error("insw() requires HAS_IOPORT");
+#endif
 #endif
 
 #ifndef insl
 #define insl insl
+#ifdef CONFIG_HAS_IOPORT
 static inline void insl(unsigned long addr, void *buffer, unsigned int count)
 {
 	readsl(PCI_IOBASE + addr, buffer, count);
 }
+#else
+void insl(unsigned long addr, void *buffer, unsigned int count)
+	__compiletime_error("insl() requires HAS_IOPORT");
+#endif
 #endif
 
 #ifndef outsb
 #define outsb outsb
+#ifdef CONFIG_HAS_IOPORT
 static inline void outsb(unsigned long addr, const void *buffer,
 			 unsigned int count)
 {
 	writesb(PCI_IOBASE + addr, buffer, count);
 }
+#else
+void outsb(unsigned long addr, const void *buffer, unsigned int count)
+	__compiletime_error("outsb() requires HAS_IOPORT");
+#endif
 #endif
 
 #ifndef outsw
 #define outsw outsw
+#ifdef CONFIG_HAS_IOPORT
 static inline void outsw(unsigned long addr, const void *buffer,
 			 unsigned int count)
 {
 	writesw(PCI_IOBASE + addr, buffer, count);
 }
+#else
+void outsw(unsigned long addr, const void *buffer, unsigned int count)
+	__compiletime_error("outsw() requires HAS_IOPORT");
+#endif
 #endif
 
 #ifndef outsl
 #define outsl outsl
+#ifdef CONFIG_HAS_IOPORT
 static inline void outsl(unsigned long addr, const void *buffer,
 			 unsigned int count)
 {
 	writesl(PCI_IOBASE + addr, buffer, count);
 }
+#else
+void outsl(unsigned long addr, const void *buffer, unsigned int count)
+	__compiletime_error("outsl() requires HAS_IOPORT");
+#endif
 #endif
 
 #ifndef insb_p
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT
  2023-03-14 12:11 ` [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT Niklas Schnelle
@ 2023-03-14 12:20   ` Jarkko Sakkinen
  2023-03-14 14:01     ` Arnd Bergmann
  2023-03-14 13:52   ` Corey Minyard
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 110+ messages in thread
From: Jarkko Sakkinen @ 2023-03-14 12:20 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Corey Minyard, Peter Huewe,
	Jason Gunthorpe, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	openipmi-developer, linux-integrity

On Tue, Mar 14, 2023 at 01:11:41PM +0100, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to add this dependency and ifdef
> sections of code using inb()/outb() as alternative access methods.
> 
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
>  drivers/char/Kconfig             |  3 ++-
>  drivers/char/ipmi/Makefile       | 11 ++++-------
>  drivers/char/ipmi/ipmi_si_intf.c |  3 ++-
>  drivers/char/ipmi/ipmi_si_pci.c  |  3 +++
>  drivers/char/pcmcia/Kconfig      |  8 ++++----
>  drivers/char/tpm/Kconfig         |  1 +
>  drivers/char/tpm/tpm_infineon.c  | 14 ++++++++++----
>  drivers/char/tpm/tpm_tis_core.c  | 19 ++++++++-----------
>  8 files changed, 34 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
> index 30fe9848dac1..c34679c6da70 100644
> --- a/drivers/char/Kconfig
> +++ b/drivers/char/Kconfig
> @@ -34,6 +34,7 @@ config TTY_PRINTK_LEVEL
>  config PRINTER
>  	tristate "Parallel printer support"
>  	depends on PARPORT
> +	depends on HAS_IOPORT
>  	help
>  	  If you intend to attach a printer to the parallel port of your Linux
>  	  box (as opposed to using a serial printer; if the connector at the
> @@ -342,7 +343,7 @@ config NVRAM
>  
>  config DEVPORT
>  	bool "/dev/port character device"
> -	depends on ISA || PCI
> +	depends on HAS_IOPORT
>  	default y
>  	help
>  	  Say Y here if you want to support the /dev/port device. The /dev/port
> diff --git a/drivers/char/ipmi/Makefile b/drivers/char/ipmi/Makefile
> index cb6138b8ded9..e0944547c9d0 100644
> --- a/drivers/char/ipmi/Makefile
> +++ b/drivers/char/ipmi/Makefile
> @@ -5,13 +5,10 @@
>  
>  ipmi_si-y := ipmi_si_intf.o ipmi_kcs_sm.o ipmi_smic_sm.o ipmi_bt_sm.o \
>  	ipmi_si_hotmod.o ipmi_si_hardcode.o ipmi_si_platform.o \
> -	ipmi_si_port_io.o ipmi_si_mem_io.o
> -ifdef CONFIG_PCI
> -ipmi_si-y += ipmi_si_pci.o
> -endif
> -ifdef CONFIG_PARISC
> -ipmi_si-y += ipmi_si_parisc.o
> -endif
> +	ipmi_si_mem_io.o
> +ipmi_si-$(CONFIG_HAS_IOPORT) += ipmi_si_port_io.o
> +ipmi_si-$(CONFIG_PCI) += ipmi_si_pci.o
> +ipmi_si-$(CONFIG_PARISC) += ipmi_si_parisc.o
>  
>  obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o
>  obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o
> diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
> index abddd7e43a9a..edbbdb804913 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -1882,7 +1882,8 @@ int ipmi_si_add_smi(struct si_sm_io *io)
>  	}
>  
>  	if (!io->io_setup) {
> -		if (io->addr_space == IPMI_IO_ADDR_SPACE) {
> +		if (IS_ENABLED(CONFIG_HAS_IOPORT) &&
> +		    io->addr_space == IPMI_IO_ADDR_SPACE) {
>  			io->io_setup = ipmi_si_port_setup;
>  		} else if (io->addr_space == IPMI_MEM_ADDR_SPACE) {
>  			io->io_setup = ipmi_si_mem_setup;
> diff --git a/drivers/char/ipmi/ipmi_si_pci.c b/drivers/char/ipmi/ipmi_si_pci.c
> index 74fa2055868b..b83d55685b22 100644
> --- a/drivers/char/ipmi/ipmi_si_pci.c
> +++ b/drivers/char/ipmi/ipmi_si_pci.c
> @@ -97,6 +97,9 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
>  	}
>  
>  	if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) {
> +		if (!IS_ENABLED(CONFIG_HAS_IOPORT))
> +			return -ENXIO;
> +
>  		io.addr_space = IPMI_IO_ADDR_SPACE;
>  		io.io_setup = ipmi_si_port_setup;
>  	} else {
> diff --git a/drivers/char/pcmcia/Kconfig b/drivers/char/pcmcia/Kconfig
> index f5d589b2be44..788422627b43 100644
> --- a/drivers/char/pcmcia/Kconfig
> +++ b/drivers/char/pcmcia/Kconfig
> @@ -8,7 +8,7 @@ menu "PCMCIA character devices"
>  
>  config SYNCLINK_CS
>  	tristate "SyncLink PC Card support"
> -	depends on PCMCIA && TTY
> +	depends on PCMCIA && TTY && HAS_IOPORT
>  	help
>  	  Enable support for the SyncLink PC Card serial adapter, running
>  	  asynchronous and HDLC communications up to 512Kbps. The port is
> @@ -21,7 +21,7 @@ config SYNCLINK_CS
>  
>  config CARDMAN_4000
>  	tristate "Omnikey Cardman 4000 support"
> -	depends on PCMCIA
> +	depends on PCMCIA && HAS_IOPORT
>  	select BITREVERSE
>  	help
>  	  Enable support for the Omnikey Cardman 4000 PCMCIA Smartcard
> @@ -33,7 +33,7 @@ config CARDMAN_4000
>  
>  config CARDMAN_4040
>  	tristate "Omnikey CardMan 4040 support"
> -	depends on PCMCIA
> +	depends on PCMCIA && HAS_IOPORT
>  	help
>  	  Enable support for the Omnikey CardMan 4040 PCMCIA Smartcard
>  	  reader.
> @@ -57,7 +57,7 @@ config SCR24X
>  
>  config IPWIRELESS
>  	tristate "IPWireless 3G UMTS PCMCIA card support"
> -	depends on PCMCIA && NETDEVICES && TTY
> +	depends on PCMCIA && NETDEVICES && TTY && HAS_IOPORT
>  	select PPP
>  	help
>  	  This is a driver for 3G UMTS PCMCIA card from IPWireless company. In
> diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
> index 927088b2c3d3..418c9ed59ffd 100644
> --- a/drivers/char/tpm/Kconfig
> +++ b/drivers/char/tpm/Kconfig
> @@ -149,6 +149,7 @@ config TCG_NSC
>  config TCG_ATMEL
>  	tristate "Atmel TPM Interface"
>  	depends on PPC64 || HAS_IOPORT_MAP
> +	depends on HAS_IOPORT
>  	help
>  	  If you have a TPM security chip from Atmel say Yes and it 
>  	  will be accessible from within Linux.  To compile this driver 
> diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
> index 9c924a1440a9..2d2ae37153ba 100644
> --- a/drivers/char/tpm/tpm_infineon.c
> +++ b/drivers/char/tpm/tpm_infineon.c
> @@ -51,34 +51,40 @@ static struct tpm_inf_dev tpm_dev;
>  
>  static inline void tpm_data_out(unsigned char data, unsigned char offset)
>  {
> +#ifdef CONFIG_HAS_IOPORT
>  	if (tpm_dev.iotype == TPM_INF_IO_PORT)
>  		outb(data, tpm_dev.data_regs + offset);
>  	else
> +#endif
>  		writeb(data, tpm_dev.mem_base + tpm_dev.data_regs + offset);
>  }
>  
>  static inline unsigned char tpm_data_in(unsigned char offset)
>  {
> +#ifdef CONFIG_HAS_IOPORT
>  	if (tpm_dev.iotype == TPM_INF_IO_PORT)
>  		return inb(tpm_dev.data_regs + offset);
> -	else
> -		return readb(tpm_dev.mem_base + tpm_dev.data_regs + offset);
> +#endif
> +	return readb(tpm_dev.mem_base + tpm_dev.data_regs + offset);
>  }
>  
>  static inline void tpm_config_out(unsigned char data, unsigned char offset)
>  {
> +#ifdef CONFIG_HAS_IOPORT
>  	if (tpm_dev.iotype == TPM_INF_IO_PORT)
>  		outb(data, tpm_dev.config_port + offset);
>  	else
> +#endif
>  		writeb(data, tpm_dev.mem_base + tpm_dev.index_off + offset);
>  }
>  
>  static inline unsigned char tpm_config_in(unsigned char offset)
>  {
> +#ifdef CONFIG_HAS_IOPORT
>  	if (tpm_dev.iotype == TPM_INF_IO_PORT)
>  		return inb(tpm_dev.config_port + offset);
> -	else
> -		return readb(tpm_dev.mem_base + tpm_dev.index_off + offset);
> +#endif
> +	return readb(tpm_dev.mem_base + tpm_dev.index_off + offset);
>  }
>  
>  /* TPM header definitions */
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 3f98e587b3e8..e43d2a1da3ea 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -897,11 +897,6 @@ static void tpm_tis_clkrun_enable(struct tpm_chip *chip, bool value)
>  		clkrun_val &= ~LPC_CLKRUN_EN;
>  		iowrite32(clkrun_val, data->ilb_base_addr + LPC_CNTRL_OFFSET);
>  
> -		/*
> -		 * Write any random value on port 0x80 which is on LPC, to make
> -		 * sure LPC clock is running before sending any TPM command.
> -		 */
> -		outb(0xCC, 0x80);
>  	} else {
>  		data->clkrun_enabled--;
>  		if (data->clkrun_enabled)
> @@ -912,13 +907,15 @@ static void tpm_tis_clkrun_enable(struct tpm_chip *chip, bool value)
>  		/* Enable LPC CLKRUN# */
>  		clkrun_val |= LPC_CLKRUN_EN;
>  		iowrite32(clkrun_val, data->ilb_base_addr + LPC_CNTRL_OFFSET);
> -
> -		/*
> -		 * Write any random value on port 0x80 which is on LPC, to make
> -		 * sure LPC clock is running before sending any TPM command.
> -		 */
> -		outb(0xCC, 0x80);
>  	}
> +
> +#ifdef CONFIG_HAS_IOPORT
> +	/*
> +	 * Write any random value on port 0x80 which is on LPC, to make
> +	 * sure LPC clock is running before sending any TPM command.
> +	 */
> +	outb(0xCC, 0x80);
> +#endif
>  }
>  
>  static const struct tpm_class_ops tpm_tis = {
> -- 
> 2.37.2
> 

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

Who should pick this?

BR, Jarkko

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 30/38] sound: add HAS_IOPORT dependencies
  2023-03-14 12:12 ` [PATCH v3 30/38] sound: " Niklas Schnelle
@ 2023-03-14 12:33   ` Takashi Iwai
  2023-05-08 16:41     ` Niklas Schnelle
  0 siblings, 1 reply; 110+ messages in thread
From: Takashi Iwai @ 2023-03-14 12:33 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Jaroslav Kysela, Takashi Iwai, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, alsa-devel

On Tue, 14 Mar 2023 13:12:08 +0100,
Niklas Schnelle wrote:
> --- a/sound/isa/Kconfig
> +++ b/sound/isa/Kconfig
> @@ -23,6 +23,7 @@ menuconfig SND_ISA
>  	bool "ISA sound devices"
>  	depends on ISA || COMPILE_TEST
>  	depends on ISA_DMA_API
> +	depends on HAS_IOPORT
>  	default y
>  	help
>  	  Support for sound devices connected via the ISA bus.

With this dependency, ...

> @@ -31,6 +32,7 @@ if SND_ISA
>  
>  config SND_ADLIB
>  	tristate "AdLib FM card"
> +	depends on HAS_IOPORT
>  	select SND_OPL3_LIB
>  	help
>  	  Say Y here to include support for AdLib FM cards.

... this and lots of other similar changes become redundant, as they
already depend on CONFIG_SND_ISA.

> --- a/sound/pcmcia/Kconfig
> +++ b/sound/pcmcia/Kconfig
> @@ -13,6 +13,7 @@ if SND_PCMCIA && PCMCIA
>  config SND_VXPOCKET
>  	tristate "Digigram VXpocket"
>  	select SND_VX_LIB
> +	depends on HAS_IOPORT
>  	help
>  	  Say Y here to include support for Digigram VXpocket and
>  	  VXpocket 440 soundcards.
> @@ -22,6 +23,7 @@ config SND_VXPOCKET
>  
>  config SND_PDAUDIOCF
>  	tristate "Sound Core PDAudioCF"
> +	depends on HAS_IOPORT
>  	select SND_PCM
>  	help
>  	  Say Y here to include support for Sound Core PDAudioCF

I guess it's easier to make CONFIG_SND_PCMCIA depending on
CONFIG_HAS_IOPORT (like done for CONFIG_SND_ISA).


thanks,

Takashi

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary
  2023-03-14 12:11 ` [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary Niklas Schnelle
@ 2023-03-14 12:37   ` Johannes Berg
  2023-03-23 13:23     ` Niklas Schnelle
  2023-03-14 12:48   ` Geert Uytterhoeven
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 110+ messages in thread
From: Johannes Berg @ 2023-03-14 12:37 UTC (permalink / raw)
  To: Niklas Schnelle, Arnd Bergmann, Richard Henderson,
	Ivan Kokshaysky, Matt Turner, Russell King, Catalin Marinas,
	Will Deacon, Geert Uytterhoeven, Michal Simek,
	Thomas Bogendoerfer, James E.J. Bottomley, Helge Deller,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Yoshinori Sato,
	Rich Felker, John Paul Adrian Glaubitz, David S. Miller,
	Richard Weinberger, Anton Ivanov, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-alpha,
	linux-arm-kernel, linux-ia64, linux-m68k, linux-mips,
	linux-parisc, linuxppc-dev, linux-riscv, linux-sh, sparclinux,
	linux-um

On Tue, 2023-03-14 at 13:11 +0100, Niklas Schnelle wrote:
> --- a/arch/um/Kconfig
> +++ b/arch/um/Kconfig
> @@ -56,6 +56,7 @@ config NO_IOPORT_MAP
>  
>  config ISA
>  	bool
> +	depends on HAS_IOPORT
> 

config ISA here is already unselectable, and nothing ever does "select
ISA" (only in some other architectures), so is there much point in this?

I'm not even sure why this exists at all.

But anyway, adding a dependency to a always-false symbol doesn't make it
less always-false :-)

Acked-by: Johannes Berg <johannes@sipsolutions.net> # for ARCH=um


Certainly will be nice to get rid of this cruft for architectures that
don't have it.

johannes

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 05/38] counter: add HAS_IOPORT dependencies
  2023-03-14 12:11 ` [PATCH v3 05/38] counter: " Niklas Schnelle
@ 2023-03-14 12:41   ` William Breathitt Gray
  2023-04-28 13:27     ` Niklas Schnelle
  0 siblings, 1 reply; 110+ messages in thread
From: William Breathitt Gray @ 2023-03-14 12:41 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-iio

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]

On Tue, Mar 14, 2023 at 01:11:43PM +0100, Niklas Schnelle 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/counter/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/counter/Kconfig b/drivers/counter/Kconfig
> index b5ba8fb02cf7..1cae5097217e 100644
> --- a/drivers/counter/Kconfig
> +++ b/drivers/counter/Kconfig
> @@ -15,6 +15,7 @@ if COUNTER
>  config 104_QUAD_8
>  	tristate "ACCES 104-QUAD-8 driver"
>  	depends on (PC104 && X86) || COMPILE_TEST
> +	depends on HAS_IOPORT
>  	select ISA_BUS_API
>  	help
>  	  Say yes here to build support for the ACCES 104-QUAD-8 quadrature
> -- 
> 2.37.2

Is HAS_IOPORT needed because this driver uses devm_ioport_map()? The
inb()/outb() functions and such are not used in this driver, so would it
suffice to depend on HAS_IOPORT_MAP instead?

William Breathitt Gray

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary
  2023-03-14 12:11 ` [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary Niklas Schnelle
  2023-03-14 12:37   ` Johannes Berg
@ 2023-03-14 12:48   ` Geert Uytterhoeven
  2023-03-14 13:29   ` Arnd Bergmann
  2023-03-14 16:37   ` Niklas Schnelle
  3 siblings, 0 replies; 110+ messages in thread
From: Geert Uytterhoeven @ 2023-03-14 12:48 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	Russell King, Catalin Marinas, Will Deacon, Michal Simek,
	Thomas Bogendoerfer, James E.J. Bottomley, Helge Deller,
	Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Yoshinori Sato,
	Rich Felker, John Paul Adrian Glaubitz, David S. Miller,
	Richard Weinberger, Anton Ivanov, Johannes Berg, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
	Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-alpha,
	linux-arm-kernel, linux-ia64, linux-m68k, linux-mips,
	linux-parisc, linuxppc-dev, linux-riscv, linux-sh, sparclinux,
	linux-um

On Tue, Mar 14, 2023 at 1:13 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:
> We introduce a new HAS_IOPORT Kconfig option to indicate support for I/O
> Port access. In a future patch HAS_IOPORT=n will disable compilation of
> the I/O accessor functions inb()/outb() and friends on architectures
> which can not meaningfully support legacy I/O spaces such as s390. Also
> add dependencies on HAS_IOPORT for the ISA and HAVE_EISA config options
> as these busses always go along with HAS_IOPORT.
>
> The "depends on" relations on HAS_IOPORT in drivers as well as ifdefs
> for HAS_IOPORT specific sections will be added in subsequent patches on
> a per subsystem basis.
>
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

>  arch/m68k/Kconfig       | 1 +

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 28/38] rtc: add HAS_IOPORT dependencies
  2023-03-14 12:12 ` [PATCH v3 28/38] rtc: " Niklas Schnelle
@ 2023-03-14 12:52   ` Alexandre Belloni
  2023-05-08 15:36     ` Niklas Schnelle
  0 siblings, 1 reply; 110+ messages in thread
From: Alexandre Belloni @ 2023-03-14 12:52 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Alessandro Zummo, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-rtc

Hello,

On 14/03/2023 13:12:06+0100, Niklas Schnelle 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/rtc/Kconfig | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 5a71579af0a1..20aa77bf0a9f 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -956,6 +956,7 @@ comment "Platform RTC drivers"
>  config RTC_DRV_CMOS
>  	tristate "PC-style 'CMOS'"
>  	depends on X86 || ARM || PPC || MIPS || SPARC64
> +	depends on HAS_IOPORT

Did you check that this will not break platforms that doesn't have RTC_PORT defined?

>  	default y if X86
>  	select RTC_MC146818_LIB
>  	help
> @@ -976,6 +977,7 @@ config RTC_DRV_CMOS
>  config RTC_DRV_ALPHA
>  	bool "Alpha PC-style CMOS"
>  	depends on ALPHA
> +	depends on HAS_IOPORT
>  	select RTC_MC146818_LIB
>  	default y
>  	help
> @@ -1193,7 +1195,7 @@ config RTC_DRV_MSM6242
>  
>  config RTC_DRV_BQ4802
>  	tristate "TI BQ4802"
> -	depends on HAS_IOMEM
> +	depends on HAS_IOMEM && HAS_IOPORT
>  	help
>  	  If you say Y here you will get support for the TI
>  	  BQ4802 RTC chip.
> -- 
> 2.37.2
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary
  2023-03-14 12:11 ` [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary Niklas Schnelle
  2023-03-14 12:37   ` Johannes Berg
  2023-03-14 12:48   ` Geert Uytterhoeven
@ 2023-03-14 13:29   ` Arnd Bergmann
  2023-03-14 16:11     ` Niklas Schnelle
  2023-03-14 16:37   ` Niklas Schnelle
  3 siblings, 1 reply; 110+ messages in thread
From: Arnd Bergmann @ 2023-03-14 13:29 UTC (permalink / raw)
  To: Niklas Schnelle, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	Russell King, Catalin Marinas, Will Deacon, Geert Uytterhoeven,
	Michal Simek, Thomas Bogendoerfer, James E . J . Bottomley,
	Helge Deller, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
	David S . Miller, Richard Weinberger, Anton Ivanov,
	Johannes Berg, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	linux-kernel, Linux-Arch, linux-pci, Arnd Bergmann, linux-alpha,
	linux-arm-kernel, linux-ia64, linux-m68k, linux-mips,
	linux-parisc, linuxppc-dev, linux-riscv, linux-sh, sparclinux,
	linux-um

On Tue, Mar 14, 2023, at 13:11, Niklas Schnelle wrote:
> We introduce a new HAS_IOPORT Kconfig option to indicate support for I/O
> Port access. In a future patch HAS_IOPORT=n will disable compilation of
> the I/O accessor functions inb()/outb() and friends on architectures
> which can not meaningfully support legacy I/O spaces such as s390. Also
> add dependencies on HAS_IOPORT for the ISA and HAVE_EISA config options
> as these busses always go along with HAS_IOPORT.
>
> The "depends on" relations on HAS_IOPORT in drivers as well as ifdefs
> for HAS_IOPORT specific sections will be added in subsequent patches on
> a per subsystem basis.

I think it would be helpful to enumerate which architectures
do not get HAS_IOPORT added, as they will be affected more.

> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

If there are no objections, I could send this first patch for the
asm-generic tree as a preparation for 6.3, so we are able to merge
the other patches through subsystem maintainer tree for 6.4.

arch/loongarch/ will now also need to select HAS_IOPORT
uncontitionally, this architecture was added after you
sent v2.

> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index a98940e64243..5eeacc72e4da 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -47,6 +47,7 @@ config PARISC
>  	select MODULES_USE_ELF_RELA
>  	select CLONE_BACKWARDS
>  	select TTY # Needed for pdc_cons.c
> +	select HAS_IOPORT if PCI

It's also needed for EISA and I think you should select it
from CONFIG_GSC in drivers/parisc/Kconfig for this purpose.

This could also be 'select HAS_IOPORT if PCI || EISA', but
that would require removing the 'depends on HAS_IOPORT'
under drivers/eisa/.

>  	select HAVE_DEBUG_STACKOVERFLOW
>  	select HAVE_ARCH_AUDITSYSCALL
>  	select HAVE_ARCH_HASH
> @@ -131,6 +132,7 @@ config STACKTRACE_SUPPORT
> 
>  config ISA_DMA_API
>  	bool
> +	depends on HAS_IOPORT
> 

This line is not really needed since there is no way to
enable ISA_DMA_API.

> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index a6c4407d3ec8..f7de646c074a 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -188,6 +188,7 @@ config PPC
>  	select GENERIC_SMP_IDLE_THREAD
>  	select GENERIC_TIME_VSYSCALL
>  	select GENERIC_VDSO_TIME_NS
> +	select HAS_IOPORT			if PCI
>  	select HAVE_ARCH_AUDITSYSCALL
>  	select HAVE_ARCH_HUGE_VMALLOC		if HAVE_ARCH_HUGE_VMAP
>  	select HAVE_ARCH_HUGE_VMAP		if PPC_RADIX_MMU || PPC_8xx
> @@ -1070,7 +1071,6 @@ menu "Bus options"
> 
>  config ISA
>  	bool "Support for ISA-bus hardware"
> -	depends on PPC_CHRP
>  	select PPC_I8259
>  	help
>  	  Find out whether you have ISA slots on your motherboard.  ISA is the

This line looks wrong, I think we should keep that dependency.
Did you get a circular dependency if you leave it in?

> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index a825bf031f49..634dd42532f3 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -162,6 +162,7 @@ config X86
>  	select GUP_GET_PXX_LOW_HIGH		if X86_PAE
>  	select HARDIRQS_SW_RESEND
>  	select HARDLOCKUP_CHECK_TIMESTAMP	if X86_64
> +	select HAS_IOPORT
>  	select HAVE_ACPI_APEI			if ACPI
>  	select HAVE_ACPI_APEI_NMI		if ACPI
>  	select HAVE_ALIGNED_STRUCT_PAGE		if SLUB
> @@ -2893,6 +2894,7 @@ if X86_32
> 
>  config ISA
>  	bool "ISA support"
> +	depends on HAS_IOPORT
>  	help

HAS_IOPORT is selected unconditionally already, so this doesn't
really do anything.

> diff --git a/lib/Kconfig.kgdb b/lib/Kconfig.kgdb
> index 3b9a44008433..c68e4d9dcecb 100644
> --- a/lib/Kconfig.kgdb
> +++ b/lib/Kconfig.kgdb
> @@ -121,7 +121,8 @@ config KDB_DEFAULT_ENABLE
> 
>  config KDB_KEYBOARD
>  	bool "KGDB_KDB: keyboard as input device"
> -	depends on VT && KGDB_KDB && !PARISC
> +	depends on HAS_IOPORT
> +	depends on VT && KGDB_KDB
>  	default n

This loses the !PARISC dependency, which I don't think is
intentional. The added HAS_IOPORT dependency makes sense
here, but I think this should be in a different patch
and not in the preparation.

    Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT
  2023-03-14 12:11 ` [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT Niklas Schnelle
  2023-03-14 12:20   ` Jarkko Sakkinen
@ 2023-03-14 13:52   ` Corey Minyard
  2023-03-14 14:17   ` Geert Uytterhoeven
  2023-03-21 14:33   ` Jason Gunthorpe
  3 siblings, 0 replies; 110+ messages in thread
From: Corey Minyard @ 2023-03-14 13:52 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Peter Huewe, Jarkko Sakkinen,
	Jason Gunthorpe, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	openipmi-developer, linux-integrity

On Tue, Mar 14, 2023 at 01:11:41PM +0100, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to add this dependency and ifdef
> sections of code using inb()/outb() as alternative access methods.

For the IPMI portions, this looks good.

Acked-by: Corey Minyard <cminyard@mvista.com>

Thanks

-corey

> 
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
>  drivers/char/Kconfig             |  3 ++-
>  drivers/char/ipmi/Makefile       | 11 ++++-------
>  drivers/char/ipmi/ipmi_si_intf.c |  3 ++-
>  drivers/char/ipmi/ipmi_si_pci.c  |  3 +++
>  drivers/char/pcmcia/Kconfig      |  8 ++++----
>  drivers/char/tpm/Kconfig         |  1 +
>  drivers/char/tpm/tpm_infineon.c  | 14 ++++++++++----
>  drivers/char/tpm/tpm_tis_core.c  | 19 ++++++++-----------
>  8 files changed, 34 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
> index 30fe9848dac1..c34679c6da70 100644
> --- a/drivers/char/Kconfig
> +++ b/drivers/char/Kconfig
> @@ -34,6 +34,7 @@ config TTY_PRINTK_LEVEL
>  config PRINTER
>  	tristate "Parallel printer support"
>  	depends on PARPORT
> +	depends on HAS_IOPORT
>  	help
>  	  If you intend to attach a printer to the parallel port of your Linux
>  	  box (as opposed to using a serial printer; if the connector at the
> @@ -342,7 +343,7 @@ config NVRAM
>  
>  config DEVPORT
>  	bool "/dev/port character device"
> -	depends on ISA || PCI
> +	depends on HAS_IOPORT
>  	default y
>  	help
>  	  Say Y here if you want to support the /dev/port device. The /dev/port
> diff --git a/drivers/char/ipmi/Makefile b/drivers/char/ipmi/Makefile
> index cb6138b8ded9..e0944547c9d0 100644
> --- a/drivers/char/ipmi/Makefile
> +++ b/drivers/char/ipmi/Makefile
> @@ -5,13 +5,10 @@
>  
>  ipmi_si-y := ipmi_si_intf.o ipmi_kcs_sm.o ipmi_smic_sm.o ipmi_bt_sm.o \
>  	ipmi_si_hotmod.o ipmi_si_hardcode.o ipmi_si_platform.o \
> -	ipmi_si_port_io.o ipmi_si_mem_io.o
> -ifdef CONFIG_PCI
> -ipmi_si-y += ipmi_si_pci.o
> -endif
> -ifdef CONFIG_PARISC
> -ipmi_si-y += ipmi_si_parisc.o
> -endif
> +	ipmi_si_mem_io.o
> +ipmi_si-$(CONFIG_HAS_IOPORT) += ipmi_si_port_io.o
> +ipmi_si-$(CONFIG_PCI) += ipmi_si_pci.o
> +ipmi_si-$(CONFIG_PARISC) += ipmi_si_parisc.o
>  
>  obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o
>  obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o
> diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
> index abddd7e43a9a..edbbdb804913 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -1882,7 +1882,8 @@ int ipmi_si_add_smi(struct si_sm_io *io)
>  	}
>  
>  	if (!io->io_setup) {
> -		if (io->addr_space == IPMI_IO_ADDR_SPACE) {
> +		if (IS_ENABLED(CONFIG_HAS_IOPORT) &&
> +		    io->addr_space == IPMI_IO_ADDR_SPACE) {
>  			io->io_setup = ipmi_si_port_setup;
>  		} else if (io->addr_space == IPMI_MEM_ADDR_SPACE) {
>  			io->io_setup = ipmi_si_mem_setup;
> diff --git a/drivers/char/ipmi/ipmi_si_pci.c b/drivers/char/ipmi/ipmi_si_pci.c
> index 74fa2055868b..b83d55685b22 100644
> --- a/drivers/char/ipmi/ipmi_si_pci.c
> +++ b/drivers/char/ipmi/ipmi_si_pci.c
> @@ -97,6 +97,9 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
>  	}
>  
>  	if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) {
> +		if (!IS_ENABLED(CONFIG_HAS_IOPORT))
> +			return -ENXIO;
> +
>  		io.addr_space = IPMI_IO_ADDR_SPACE;
>  		io.io_setup = ipmi_si_port_setup;
>  	} else {
> diff --git a/drivers/char/pcmcia/Kconfig b/drivers/char/pcmcia/Kconfig
> index f5d589b2be44..788422627b43 100644
> --- a/drivers/char/pcmcia/Kconfig
> +++ b/drivers/char/pcmcia/Kconfig
> @@ -8,7 +8,7 @@ menu "PCMCIA character devices"
>  
>  config SYNCLINK_CS
>  	tristate "SyncLink PC Card support"
> -	depends on PCMCIA && TTY
> +	depends on PCMCIA && TTY && HAS_IOPORT
>  	help
>  	  Enable support for the SyncLink PC Card serial adapter, running
>  	  asynchronous and HDLC communications up to 512Kbps. The port is
> @@ -21,7 +21,7 @@ config SYNCLINK_CS
>  
>  config CARDMAN_4000
>  	tristate "Omnikey Cardman 4000 support"
> -	depends on PCMCIA
> +	depends on PCMCIA && HAS_IOPORT
>  	select BITREVERSE
>  	help
>  	  Enable support for the Omnikey Cardman 4000 PCMCIA Smartcard
> @@ -33,7 +33,7 @@ config CARDMAN_4000
>  
>  config CARDMAN_4040
>  	tristate "Omnikey CardMan 4040 support"
> -	depends on PCMCIA
> +	depends on PCMCIA && HAS_IOPORT
>  	help
>  	  Enable support for the Omnikey CardMan 4040 PCMCIA Smartcard
>  	  reader.
> @@ -57,7 +57,7 @@ config SCR24X
>  
>  config IPWIRELESS
>  	tristate "IPWireless 3G UMTS PCMCIA card support"
> -	depends on PCMCIA && NETDEVICES && TTY
> +	depends on PCMCIA && NETDEVICES && TTY && HAS_IOPORT
>  	select PPP
>  	help
>  	  This is a driver for 3G UMTS PCMCIA card from IPWireless company. In
> diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
> index 927088b2c3d3..418c9ed59ffd 100644
> --- a/drivers/char/tpm/Kconfig
> +++ b/drivers/char/tpm/Kconfig
> @@ -149,6 +149,7 @@ config TCG_NSC
>  config TCG_ATMEL
>  	tristate "Atmel TPM Interface"
>  	depends on PPC64 || HAS_IOPORT_MAP
> +	depends on HAS_IOPORT
>  	help
>  	  If you have a TPM security chip from Atmel say Yes and it 
>  	  will be accessible from within Linux.  To compile this driver 
> diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
> index 9c924a1440a9..2d2ae37153ba 100644
> --- a/drivers/char/tpm/tpm_infineon.c
> +++ b/drivers/char/tpm/tpm_infineon.c
> @@ -51,34 +51,40 @@ static struct tpm_inf_dev tpm_dev;
>  
>  static inline void tpm_data_out(unsigned char data, unsigned char offset)
>  {
> +#ifdef CONFIG_HAS_IOPORT
>  	if (tpm_dev.iotype == TPM_INF_IO_PORT)
>  		outb(data, tpm_dev.data_regs + offset);
>  	else
> +#endif
>  		writeb(data, tpm_dev.mem_base + tpm_dev.data_regs + offset);
>  }
>  
>  static inline unsigned char tpm_data_in(unsigned char offset)
>  {
> +#ifdef CONFIG_HAS_IOPORT
>  	if (tpm_dev.iotype == TPM_INF_IO_PORT)
>  		return inb(tpm_dev.data_regs + offset);
> -	else
> -		return readb(tpm_dev.mem_base + tpm_dev.data_regs + offset);
> +#endif
> +	return readb(tpm_dev.mem_base + tpm_dev.data_regs + offset);
>  }
>  
>  static inline void tpm_config_out(unsigned char data, unsigned char offset)
>  {
> +#ifdef CONFIG_HAS_IOPORT
>  	if (tpm_dev.iotype == TPM_INF_IO_PORT)
>  		outb(data, tpm_dev.config_port + offset);
>  	else
> +#endif
>  		writeb(data, tpm_dev.mem_base + tpm_dev.index_off + offset);
>  }
>  
>  static inline unsigned char tpm_config_in(unsigned char offset)
>  {
> +#ifdef CONFIG_HAS_IOPORT
>  	if (tpm_dev.iotype == TPM_INF_IO_PORT)
>  		return inb(tpm_dev.config_port + offset);
> -	else
> -		return readb(tpm_dev.mem_base + tpm_dev.index_off + offset);
> +#endif
> +	return readb(tpm_dev.mem_base + tpm_dev.index_off + offset);
>  }
>  
>  /* TPM header definitions */
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 3f98e587b3e8..e43d2a1da3ea 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -897,11 +897,6 @@ static void tpm_tis_clkrun_enable(struct tpm_chip *chip, bool value)
>  		clkrun_val &= ~LPC_CLKRUN_EN;
>  		iowrite32(clkrun_val, data->ilb_base_addr + LPC_CNTRL_OFFSET);
>  
> -		/*
> -		 * Write any random value on port 0x80 which is on LPC, to make
> -		 * sure LPC clock is running before sending any TPM command.
> -		 */
> -		outb(0xCC, 0x80);
>  	} else {
>  		data->clkrun_enabled--;
>  		if (data->clkrun_enabled)
> @@ -912,13 +907,15 @@ static void tpm_tis_clkrun_enable(struct tpm_chip *chip, bool value)
>  		/* Enable LPC CLKRUN# */
>  		clkrun_val |= LPC_CLKRUN_EN;
>  		iowrite32(clkrun_val, data->ilb_base_addr + LPC_CNTRL_OFFSET);
> -
> -		/*
> -		 * Write any random value on port 0x80 which is on LPC, to make
> -		 * sure LPC clock is running before sending any TPM command.
> -		 */
> -		outb(0xCC, 0x80);
>  	}
> +
> +#ifdef CONFIG_HAS_IOPORT
> +	/*
> +	 * Write any random value on port 0x80 which is on LPC, to make
> +	 * sure LPC clock is running before sending any TPM command.
> +	 */
> +	outb(0xCC, 0x80);
> +#endif
>  }
>  
>  static const struct tpm_class_ops tpm_tis = {
> -- 
> 2.37.2
> 

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT
  2023-03-14 12:20   ` Jarkko Sakkinen
@ 2023-03-14 14:01     ` Arnd Bergmann
  0 siblings, 0 replies; 110+ messages in thread
From: Arnd Bergmann @ 2023-03-14 14:01 UTC (permalink / raw)
  To: Jarkko Sakkinen, Niklas Schnelle
  Cc: Greg Kroah-Hartman, Corey Minyard, Peter Huewe, Jason Gunthorpe,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J . Wysocki, Geert Uytterhoeven,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-kernel,
	Linux-Arch, linux-pci, Arnd Bergmann, openipmi-developer,
	linux-integrity

On Tue, Mar 14, 2023, at 13:20, Jarkko Sakkinen wrote:
> On Tue, Mar 14, 2023 at 01:11:41PM +0100, Niklas Schnelle wrote:

> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
>
> Who should pick this?

All patches in this series depend on patch 1, so either I merge
them all through the asm-generic tree, or I ask Linus to apply just
patch 1 for now, and then each subsystem can pick up their own
patches based on top of that.

    Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option
  2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
                   ` (37 preceding siblings ...)
  2023-03-14 12:12 ` [PATCH v3 38/38] asm-generic/io.h: drop inb() etc for HAS_IOPORT=n Niklas Schnelle
@ 2023-03-14 14:05 ` Arnd Bergmann
  38 siblings, 0 replies; 110+ messages in thread
From: Arnd Bergmann @ 2023-03-14 14:05 UTC (permalink / raw)
  To: Niklas Schnelle, Richard Cochran, Paul Walmsley, Palmer Dabbelt,
	Albert Ou
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	Geert Uytterhoeven, linux-kernel, Linux-Arch, linux-pci, Netdev,
	linux-riscv

On Tue, Mar 14, 2023, at 13:11, Niklas Schnelle wrote:
> Hello Kernel Hackers,
>
> Some platforms such as s390 do not support PCI I/O spaces. On such platforms
> I/O space accessors like inb()/outb() are stubs that can never actually work.
> The way these stubs are implemented in asm-generic/io.h leads to compiler
> warnings because any use will be a NULL pointer access on these platforms. In
> a previous patch we tried handling this with a run-time warning on access. This
> approach however was rejected by Linus[0] with the argument that this really
> should be a compile-time check and, though a much more invasive change, we
> believe that is indeed the right approach.
>
> This patch series aims to do exactly that by introducing a HAS_IOPORT config
> option akin to the existing HAS_IOMEM. When this is unset inb()/outb() and
> friends may not be defined. This is also the same approach originally planned by
> Uwe Kleine-König as mentioned in commit ce816fa88cca ("Kconfig: rename
> HAS_IOPORT to HAS_IOPORT_MAP").
>
> This series builds heavily on an original patch for demonstating the concept by
> Arnd Bergmann[1] and incoporates feedback of previous RFC versions [2] and [3].
>
> This version is based on v6.3-rc1 and is also available on my kernel.org tree
> in the has_ioport_v3 branch with the PGP signed tag has_ioport_v3_signed:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/niks/linux.git

Thanks a lot for the rebase, hopefully we can finally get this merged.
I'll go through all patches and note everything I spot that should
be improved. I'd like to make sure that at least the first patch
can get merged quickly so we can continue on the rest.

Since this is all related to asm-generic/io.h and cross-architecture
work, I can pick up anything that has nobody else maintaining it
through the asm-generic tree.

   Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 21/38] parport: PC style parport depends on HAS_IOPORT
  2023-03-14 12:11 ` [PATCH v3 21/38] parport: PC style parport depends on HAS_IOPORT Niklas Schnelle
@ 2023-03-14 14:12   ` Arnd Bergmann
  2023-05-02 13:40     ` Niklas Schnelle
  2023-05-02 15:30   ` Bjorn Helgaas
  1 sibling, 1 reply; 110+ messages in thread
From: Arnd Bergmann @ 2023-03-14 14:12 UTC (permalink / raw)
  To: Niklas Schnelle, Sudip Mukherjee
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, Linux-Arch, linux-pci, Arnd Bergmann

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT
  2023-03-14 12:11 ` [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT Niklas Schnelle
  2023-03-14 12:20   ` Jarkko Sakkinen
  2023-03-14 13:52   ` Corey Minyard
@ 2023-03-14 14:17   ` Geert Uytterhoeven
  2023-03-14 15:08     ` Arnd Bergmann
  2023-03-21 14:33   ` Jason Gunthorpe
  3 siblings, 1 reply; 110+ messages in thread
From: Geert Uytterhoeven @ 2023-03-14 14:17 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Corey Minyard, Peter Huewe,
	Jarkko Sakkinen, Jason Gunthorpe, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	openipmi-developer, linux-integrity

Hi Niklas,

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 this dependency and ifdef
> sections of code using inb()/outb() as alternative access methods.
>
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

Thanks for your patch!

> --- a/drivers/char/Kconfig
> +++ b/drivers/char/Kconfig
> @@ -34,6 +34,7 @@ config TTY_PRINTK_LEVEL
>  config PRINTER
>         tristate "Parallel printer support"
>         depends on PARPORT
> +       depends on HAS_IOPORT

This looks wrong to me.
drivers/char/lp.c uses the parport API, no direct I/O port access.

>         help
>           If you intend to attach a printer to the parallel port of your Linux
>           box (as opposed to using a serial printer; if the connector at the

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 36/38] watchdog: add HAS_IOPORT dependencies
  2023-03-14 12:12 ` [PATCH v3 36/38] watchdog: add " Niklas Schnelle
@ 2023-03-14 14:21   ` Guenter Roeck
  0 siblings, 0 replies; 110+ messages in thread
From: Guenter Roeck @ 2023-03-14 14:21 UTC (permalink / raw)
  To: Niklas Schnelle, Arnd Bergmann, Wim Van Sebroeck
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	linux-watchdog

On 3/14/23 05:12, Niklas Schnelle 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>

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/watchdog/Kconfig | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index f0872970daf9..e5d6f886e25d 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -453,6 +453,7 @@ config 21285_WATCHDOG
>   config 977_WATCHDOG
>   	tristate "NetWinder WB83C977 watchdog"
>   	depends on (FOOTBRIDGE && ARCH_NETWINDER) || (ARM && COMPILE_TEST)
> +	depends on HAS_IOPORT
>   	help
>   	  Say Y here to include support for the WB977 watchdog included in
>   	  NetWinder machines. Alternatively say M to compile the driver as
> @@ -1271,6 +1272,7 @@ config ITCO_WDT
>   	select WATCHDOG_CORE
>   	depends on I2C || I2C=n
>   	depends on MFD_INTEL_PMC_BXT || !MFD_INTEL_PMC_BXT
> +	depends on HAS_IOPORT # for I2C_I801
>   	select LPC_ICH if !EXPERT
>   	select I2C_I801 if !EXPERT && I2C
>   	help
> @@ -2148,7 +2150,7 @@ comment "PCI-based Watchdog Cards"
>   
>   config PCIPCWATCHDOG
>   	tristate "Berkshire Products PCI-PC Watchdog"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>   	help
>   	  This is the driver for the Berkshire Products PCI-PC Watchdog card.
>   	  This card simply watches your kernel to make sure it doesn't freeze,
> @@ -2163,7 +2165,7 @@ config PCIPCWATCHDOG
>   
>   config WDTPCI
>   	tristate "PCI-WDT500/501 Watchdog timer"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>   	help
>   	  If you have a PCI-WDT500/501 watchdog board, say Y here, otherwise N.
>   


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 34/38] usb: handle HAS_IOPORT dependencies
  2023-03-14 12:12 ` [PATCH v3 34/38] usb: " Niklas Schnelle
@ 2023-03-14 14:56   ` Arnd Bergmann
  0 siblings, 0 replies; 110+ messages in thread
From: Arnd Bergmann @ 2023-03-14 14:56 UTC (permalink / raw)
  To: Niklas Schnelle, Greg Kroah-Hartman, Mathias Nyman, Alan Stern
  Cc: Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Rafael J . Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, Linux-Arch, linux-pci,
	Arnd Bergmann, linux-usb

On Tue, Mar 14, 2023, at 13:12, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to guard sections of code calling them
> as alternative access methods with CONFIG_HAS_IOPORT checks. Similarly
> drivers requiring these functions need to depend on HAS_IOPORT.
>
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

I would suggest splitting this patch up into separate bits for the AMD
quirks and the UHCI driver, possibly more if there are other parts
unrelated to that.

> +#ifdef CONFIG_HAS_IOPORT
>  /*
>   * Make sure the controller is completely inactive, unable to
>   * generate interrupts or do DMA.

Maybe check for both HAS_IOPORT and USB_UHCI_HCD ?

>  static inline int io_type_enabled(struct pci_dev *pdev, unsigned int 
> mask)
>  {
> @@ -725,6 +730,7 @@ static inline int io_type_enabled(struct pci_dev 
> *pdev, unsigned int mask)
> 
>  static void quirk_usb_handoff_uhci(struct pci_dev *pdev)
>  {
> +#ifdef HAS_IOPORT
>  	unsigned long base = 0;
>  	int i;
> 
> @@ -739,6 +745,7 @@ static void quirk_usb_handoff_uhci(struct pci_dev *pdev)
> 
>  	if (base)
>  		uhci_check_and_reset_hc(pdev, base);
> +#endif
>  }

> diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
> index 0688c3e5bfe2..c77705d03ed0 100644
> --- a/drivers/usb/host/uhci-hcd.h
> +++ b/drivers/usb/host/uhci-hcd.h
> @@ -505,41 +505,49 @@ static inline bool uhci_is_aspeed(const struct 
> uhci_hcd *uhci)
>   * we use memory mapped registers.
>   */
> 
> +#ifdef CONFIG_HAS_IOPORT
> +#define UHCI_IN(x)	x
> +#define UHCI_OUT(x)	x
> +#else
> +#define UHCI_IN(x)	0
> +#define UHCI_OUT(x)
> +#endif
> +
>  #ifndef CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC
>  /* Support PCI only */
>  static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
>  {
> -	return inl(uhci->io_addr + reg);
> +	return UHCI_IN(inl(uhci->io_addr + reg));
>  }
> 

This looks a bit ugly, though I can't think of a version I
really like here though. Possibly merging this together with the
generic version would result in something better, like

#if defined(CONFIG_USB_UHCI_PCI) && defined(CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC)
/* Support PCI and non-PCI host controllers */
#define uhci_has_pci_registers(u)       ((u)->io_addr != 0)
#elif defined(CONFIG_USB_UHCI_PCI)
#define uhci_has_pci_registers(u)       1
#else           
/* Support non-PCI host controllers only */
#define uhci_has_pci_registers(u)       0
#endif 

static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
{
#ifdef CONfIG_USB_UHCI_PCI
        if (uhci_has_pci_registers(uhci))
                return inl(uhci->io_addr + reg);
        else
#endif
        if (uhci_is_aspeed(uhci))
                return readl(uhci->regs + uhci_aspeed_reg(reg));
        else
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
        if (uhci_big_endian_mmio(uhci))
                return readl_be(uhci->regs + reg);
        else
#endif
        return readl(uhci->regs + reg);
}

Obviously still ugly, not sure if anyone can come up with a better
version.

      Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT
  2023-03-14 14:17   ` Geert Uytterhoeven
@ 2023-03-14 15:08     ` Arnd Bergmann
  0 siblings, 0 replies; 110+ messages in thread
From: Arnd Bergmann @ 2023-03-14 15:08 UTC (permalink / raw)
  To: Geert Uytterhoeven, Niklas Schnelle
  Cc: Greg Kroah-Hartman, Corey Minyard, Peter Huewe, Jarkko Sakkinen,
	Jason Gunthorpe, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-kernel,
	Linux-Arch, linux-pci, Arnd Bergmann, openipmi-developer,
	linux-integrity

On Tue, Mar 14, 2023, at 15:17, Geert Uytterhoeven wrote:
>> --- a/drivers/char/Kconfig
>> +++ b/drivers/char/Kconfig
>> @@ -34,6 +34,7 @@ config TTY_PRINTK_LEVEL
>>  config PRINTER
>>         tristate "Parallel printer support"
>>         depends on PARPORT
>> +       depends on HAS_IOPORT
>
> This looks wrong to me.
> drivers/char/lp.c uses the parport API, no direct I/O port access.

It looks like include/linux/parport.h requires I/O port access
when PARPORT_PC is enabled and PARPORT_NOT_PC is disabled.
Maybe this would work:

      depends on PARPORT
      depends on HAS_IOPORT || PARPORT_NOT_PC

       Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 23/38] PCI/sysfs: Make I/O resource depend on HAS_IOPORT
  2023-03-14 12:12 ` [PATCH v3 23/38] PCI/sysfs: Make I/O resource " Niklas Schnelle
@ 2023-03-14 16:05   ` Bjorn Helgaas
  0 siblings, 0 replies; 110+ messages in thread
From: Bjorn Helgaas @ 2023-03-14 16:05 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Bjorn Helgaas, Greg Kroah-Hartman,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann

On Tue, Mar 14, 2023 at 01:12:01PM +0100, Niklas Schnelle wrote:
> If legacy I/O spaces are not supported simply return an error when
> trying to access them via pci_resource_io(). This allows inb() and
> friends to become undefined when they are known at compile time to be
> non-functional in a later patch.
> 
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
>  drivers/pci/pci-sysfs.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index dd0d9d9bc509..11e92d106761 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -1083,6 +1083,7 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
>  			       struct bin_attribute *attr, char *buf,
>  			       loff_t off, size_t count, bool write)
>  {
> +#ifdef CONFIG_HAS_IOPORT
>  	struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
>  	int bar = (unsigned long)attr->private;
>  	unsigned long port = off;
> @@ -1116,6 +1117,9 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
>  		return 4;
>  	}
>  	return -EINVAL;
> +#else
> +	return -ENXIO;
> +#endif
>  }
>  
>  static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj,
> -- 
> 2.37.2
> 

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary
  2023-03-14 13:29   ` Arnd Bergmann
@ 2023-03-14 16:11     ` Niklas Schnelle
  0 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 16:11 UTC (permalink / raw)
  To: Arnd Bergmann, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	Russell King, Catalin Marinas, Will Deacon, Geert Uytterhoeven,
	Michal Simek, Thomas Bogendoerfer, James E . J . Bottomley,
	Helge Deller, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
	David S . Miller, Richard Weinberger, Anton Ivanov,
	Johannes Berg, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	linux-kernel, Linux-Arch, linux-pci, Arnd Bergmann, linux-alpha,
	linux-arm-kernel, linux-ia64, linux-m68k, linux-mips,
	linux-parisc, linuxppc-dev, linux-riscv, linux-sh, sparclinux,
	linux-um

On Tue, 2023-03-14 at 14:29 +0100, Arnd Bergmann wrote:
> On Tue, Mar 14, 2023, at 13:11, Niklas Schnelle wrote:
> > We introduce a new HAS_IOPORT Kconfig option to indicate support for I/O
> > Port access. In a future patch HAS_IOPORT=n will disable compilation of
> > the I/O accessor functions inb()/outb() and friends on architectures
> > which can not meaningfully support legacy I/O spaces such as s390. Also
> > add dependencies on HAS_IOPORT for the ISA and HAVE_EISA config options
> > as these busses always go along with HAS_IOPORT.
> > 
> > The "depends on" relations on HAS_IOPORT in drivers as well as ifdefs
> > for HAS_IOPORT specific sections will be added in subsequent patches on
> > a per subsystem basis.
> 
> I think it would be helpful to enumerate which architectures
> do not get HAS_IOPORT added, as they will be affected more.
> 
> > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> 
> If there are no objections, I could send this first patch for the
> asm-generic tree as a preparation for 6.3, so we are able to merge
> the other patches through subsystem maintainer tree for 6.4.
> 
> arch/loongarch/ will now also need to select HAS_IOPORT
> uncontitionally, this architecture was added after you
> sent v2.

Ah right. Added "select HAS_IOPORT" for LoongArch.

> 
> > diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> > index a98940e64243..5eeacc72e4da 100644
> > --- a/arch/parisc/Kconfig
> > +++ b/arch/parisc/Kconfig
> > @@ -47,6 +47,7 @@ config PARISC
> >  	select MODULES_USE_ELF_RELA
> >  	select CLONE_BACKWARDS
> >  	select TTY # Needed for pdc_cons.c
> > +	select HAS_IOPORT if PCI
> 
> It's also needed for EISA and I think you should select it
> from CONFIG_GSC in drivers/parisc/Kconfig for this purpose.
> 
> This could also be 'select HAS_IOPORT if PCI || EISA', but
> that would require removing the 'depends on HAS_IOPORT'
> under drivers/eisa/.

I did use "select HAS_IOPORT if PCI || ISA || ATARI_ROM_ISA" in m68k so
I think ideally we would handle both in the same way. I don't have a
strong preference but I think the "select HAS_IOPORT if ..." puts it
all in a single place which is nice. Also I think this would make it
more similar architectures with unconditional HAS_IOPORT that thus
don't need "depends on HAS_IOPORT" in their "config ISA" either. As
also pointed by your comment below for x86. So will try to go this
route.

> 
> >  	select HAVE_DEBUG_STACKOVERFLOW
> >  	select HAVE_ARCH_AUDITSYSCALL
> >  	select HAVE_ARCH_HASH
> > @@ -131,6 +132,7 @@ config STACKTRACE_SUPPORT
> > 
> >  config ISA_DMA_API
> >  	bool
> > +	depends on HAS_IOPORT
> > 
> 
> This line is not really needed since there is no way to
> enable ISA_DMA_API.

Removed

> 
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index a6c4407d3ec8..f7de646c074a 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -188,6 +188,7 @@ config PPC
> >  	select GENERIC_SMP_IDLE_THREAD
> >  	select GENERIC_TIME_VSYSCALL
> >  	select GENERIC_VDSO_TIME_NS
> > +	select HAS_IOPORT			if PCI
> >  	select HAVE_ARCH_AUDITSYSCALL
> >  	select HAVE_ARCH_HUGE_VMALLOC		if HAVE_ARCH_HUGE_VMAP
> >  	select HAVE_ARCH_HUGE_VMAP		if PPC_RADIX_MMU || PPC_8xx
> > @@ -1070,7 +1071,6 @@ menu "Bus options"
> > 
> >  config ISA
> >  	bool "Support for ISA-bus hardware"
> > -	depends on PPC_CHRP
> >  	select PPC_I8259
> >  	help
> >  	  Find out whether you have ISA slots on your motherboard.  ISA is the
> 
> This line looks wrong, I think we should keep that dependency.
> Did you get a circular dependency if you leave it in?

I don't recall why this was removed. I guess it happened when I was
experimenting with adding "depends on HAS_IOPORT" for the ISA config
options but that ultimately lead to circular dependencies, must have
messed up when removing this here.

> 
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index a825bf031f49..634dd42532f3 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -162,6 +162,7 @@ config X86
> >  	select GUP_GET_PXX_LOW_HIGH		if X86_PAE
> >  	select HARDIRQS_SW_RESEND
> >  	select HARDLOCKUP_CHECK_TIMESTAMP	if X86_64
> > +	select HAS_IOPORT
> >  	select HAVE_ACPI_APEI			if ACPI
> >  	select HAVE_ACPI_APEI_NMI		if ACPI
> >  	select HAVE_ALIGNED_STRUCT_PAGE		if SLUB
> > @@ -2893,6 +2894,7 @@ if X86_32
> > 
> >  config ISA
> >  	bool "ISA support"
> > +	depends on HAS_IOPORT
> >  	help
> 
> HAS_IOPORT is selected unconditionally already, so this doesn't
> really do anything.

Removed.

> 
> > diff --git a/lib/Kconfig.kgdb b/lib/Kconfig.kgdb
> > index 3b9a44008433..c68e4d9dcecb 100644
> > --- a/lib/Kconfig.kgdb
> > +++ b/lib/Kconfig.kgdb
> > @@ -121,7 +121,8 @@ config KDB_DEFAULT_ENABLE
> > 
> >  config KDB_KEYBOARD
> >  	bool "KGDB_KDB: keyboard as input device"
> > -	depends on VT && KGDB_KDB && !PARISC
> > +	depends on HAS_IOPORT
> > +	depends on VT && KGDB_KDB
> >  	default n
> 
> This loses the !PARISC dependency, which I don't think is
> intentional. The added HAS_IOPORT dependency makes sense
> here, but I think this should be in a different patch
> and not in the preparation.
> 
>     Arnd

Agree will put into its own patch and re-add the !PARISC


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary
  2023-03-14 12:11 ` [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary Niklas Schnelle
                     ` (2 preceding siblings ...)
  2023-03-14 13:29   ` Arnd Bergmann
@ 2023-03-14 16:37   ` Niklas Schnelle
  3 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-14 16:37 UTC (permalink / raw)
  To: Arnd Bergmann, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	Russell King, Catalin Marinas, Will Deacon, Geert Uytterhoeven,
	Michal Simek, Thomas Bogendoerfer, James E.J. Bottomley,
	Helge Deller, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
	David S. Miller, Richard Weinberger, Anton Ivanov, Johannes Berg,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-alpha,
	linux-arm-kernel, linux-ia64, linux-m68k, linux-mips,
	linux-parisc, linuxppc-dev, linux-riscv, linux-sh, sparclinux,
	linux-um

On Tue, 2023-03-14 at 13:11 +0100, Niklas Schnelle wrote:
> We introduce a new HAS_IOPORT Kconfig option to indicate support for I/O
> Port access. In a future patch HAS_IOPORT=n will disable compilation of
> the I/O accessor functions inb()/outb() and friends on architectures
> which can not meaningfully support legacy I/O spaces such as s390. Also
> add dependencies on HAS_IOPORT for the ISA and HAVE_EISA config options
> as these busses always go along with HAS_IOPORT.
> 
> The "depends on" relations on HAS_IOPORT in drivers as well as ifdefs
> for HAS_IOPORT specific sections will be added in subsequent patches on
> a per subsystem basis.
> 
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
> 

@Arnd, I swear I asked you and then added Signed-off-bys for all these
Co-developed-bys as suggested by checkpatch. Sadly that must have been
during my failed attempt of converting to b4 prep / b4 send before
sending this last Friday and then it got lost. It almost worked and is
a very nice work flow except that b4 currently can only use a single
list of To/Cc fields and for this treewide series that would probably
hit mail server limits. Added it now.

Thanks,
Niklas


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 02/38] ata: add HAS_IOPORT dependencies
  2023-03-14 12:11 ` [PATCH v3 02/38] ata: add HAS_IOPORT dependencies Niklas Schnelle
@ 2023-03-15  1:23   ` Damien Le Moal
  2023-03-15  6:46     ` Arnd Bergmann
  2023-03-15  7:15   ` Damien Le Moal
  2023-03-15  8:39   ` Geert Uytterhoeven
  2 siblings, 1 reply; 110+ messages in thread
From: Damien Le Moal @ 2023-03-15  1:23 UTC (permalink / raw)
  To: Niklas Schnelle, Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-ide

On 3/14/23 21:11, Niklas Schnelle 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.

I do not see HAS_IOPORT=y defined anywhere in 6.3-rc. Is that in linux-next ?
There is a HAS_IOPORT_MAP, but I guess it is different.

> 
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
>  drivers/ata/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index b56fba76b43f..e5e67bdc2dff 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -342,6 +342,7 @@ endif # HAS_DMA
>  
>  config ATA_SFF
>  	bool "ATA SFF support (for legacy IDE and PATA)"
> +	depends on HAS_IOPORT
>  	default y
>  	help
>  	  This option adds support for ATA controllers with SFF

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 25/38] platform: add HAS_IOPORT dependencies
  2023-03-14 12:12 ` [PATCH v3 25/38] platform: " Niklas Schnelle
@ 2023-03-15  2:21   ` Tzung-Bi Shih
  0 siblings, 0 replies; 110+ messages in thread
From: Tzung-Bi Shih @ 2023-03-15  2:21 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Benson Leung, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, chrome-platform

On Tue, Mar 14, 2023 at 01:12:03PM +0100, Niklas Schnelle 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>

Acked-by: Tzung-Bi Shih <tzungbi@kernel.org>

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 37/38] wireless: add HAS_IOPORT dependencies
  2023-03-14 12:12 ` [PATCH v3 37/38] wireless: " Niklas Schnelle
@ 2023-03-15  5:26   ` Kalle Valo
  0 siblings, 0 replies; 110+ messages in thread
From: Kalle Valo @ 2023-03-15  5:26 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Jouni Malinen, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-wireless, netdev

Niklas Schnelle <schnelle@linux.ibm.com> writes:

> 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>

Acked-by: Kalle Valo <kvalo@kernel.org>

Let me know if I should take this to wireless-next.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 20/38] net: handle HAS_IOPORT dependencies
  2023-03-14 12:11 ` [PATCH v3 20/38] net: handle " Niklas Schnelle
@ 2023-03-15  5:41   ` Jakub Kicinski
  2023-03-15  9:47   ` Maciej W. Rozycki
  1 sibling, 0 replies; 110+ messages in thread
From: Jakub Kicinski @ 2023-03-15  5:41 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, David S. Miller, Eric Dumazet, Paolo Abeni,
	Michael Grzeschik, Wolfgang Grandegger, Marc Kleine-Budde,
	Jesse Brandeburg, Tony Nguyen, Maciej W. Rozycki, Ralf Baechle,
	Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, netdev,
	linux-can, intel-wired-lan, linux-hams

On Tue, 14 Mar 2023 13:11:58 +0100 Niklas Schnelle 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 requiring them. For the DEFXX driver there use of I/O
> ports is optional and we only need to fence those paths.can It also
> turns out that with HAS_IOPORT handled explicitly HAMRADIO does not need
> the !S390 dependency and successfully builds the bpqether driver.

Acked-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 18/38] mISDN: add HAS_IOPORT dependencies
  2023-03-14 12:11 ` [PATCH v3 18/38] mISDN: " Niklas Schnelle
@ 2023-03-15  5:41   ` Jakub Kicinski
  0 siblings, 0 replies; 110+ messages in thread
From: Jakub Kicinski @ 2023-03-15  5:41 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Karsten Keil, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, netdev

On Tue, 14 Mar 2023 13:11:56 +0100 Niklas Schnelle 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. With that the !S390 dependency on ISDN can be
> removed as all drivers without HAS_IOPORT requirement now build.
> 
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

I'm guessing this is going via some global route so:

Acked-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 02/38] ata: add HAS_IOPORT dependencies
  2023-03-15  1:23   ` Damien Le Moal
@ 2023-03-15  6:46     ` Arnd Bergmann
  2023-03-15  7:15       ` Damien Le Moal
  0 siblings, 1 reply; 110+ messages in thread
From: Arnd Bergmann @ 2023-03-15  6:46 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Schnelle
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, Linux-Arch, linux-pci, Arnd Bergmann, linux-ide

On Wed, Mar 15, 2023, at 02:23, Damien Le Moal wrote:
> On 3/14/23 21:11, Niklas Schnelle 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.
>
> I do not see HAS_IOPORT=y defined anywhere in 6.3-rc. Is that in linux-next ?
> There is a HAS_IOPORT_MAP, but I guess it is different.

It's defined in patch 1 of the series, so the later patches
can't be applied into subsystem trees without that.

We can either merge patch 1 as a preparation first, or keep it
all together as a series.

      Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 02/38] ata: add HAS_IOPORT dependencies
  2023-03-15  6:46     ` Arnd Bergmann
@ 2023-03-15  7:15       ` Damien Le Moal
  0 siblings, 0 replies; 110+ messages in thread
From: Damien Le Moal @ 2023-03-15  7:15 UTC (permalink / raw)
  To: Arnd Bergmann, Niklas Schnelle
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, Linux-Arch, linux-pci, Arnd Bergmann, linux-ide

On 3/15/23 15:46, Arnd Bergmann wrote:
> On Wed, Mar 15, 2023, at 02:23, Damien Le Moal wrote:
>> On 3/14/23 21:11, Niklas Schnelle 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.
>>
>> I do not see HAS_IOPORT=y defined anywhere in 6.3-rc. Is that in linux-next ?
>> There is a HAS_IOPORT_MAP, but I guess it is different.
> 
> It's defined in patch 1 of the series, so the later patches
> can't be applied into subsystem trees without that.
> 
> We can either merge patch 1 as a preparation first, or keep it
> all together as a series.

Got it. Either is fine with me. To allow option 2, I will send my ack.
Thanks !

> 
>       Arnd

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 02/38] ata: add HAS_IOPORT dependencies
  2023-03-14 12:11 ` [PATCH v3 02/38] ata: add HAS_IOPORT dependencies Niklas Schnelle
  2023-03-15  1:23   ` Damien Le Moal
@ 2023-03-15  7:15   ` Damien Le Moal
  2023-03-15  8:39   ` Geert Uytterhoeven
  2 siblings, 0 replies; 110+ messages in thread
From: Damien Le Moal @ 2023-03-15  7:15 UTC (permalink / raw)
  To: Niklas Schnelle, Arnd Bergmann
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-ide

On 3/14/23 21:11, Niklas Schnelle 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/ata/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index b56fba76b43f..e5e67bdc2dff 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -342,6 +342,7 @@ endif # HAS_DMA
>  
>  config ATA_SFF
>  	bool "ATA SFF support (for legacy IDE and PATA)"
> +	depends on HAS_IOPORT
>  	default y
>  	help
>  	  This option adds support for ATA controllers with SFF

Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 35/38] video: handle HAS_IOPORT dependencies
  2023-03-14 12:12 ` [PATCH v3 35/38] video: " Niklas Schnelle
@ 2023-03-15  8:16   ` Geert Uytterhoeven
  2023-03-15 10:19     ` Ville Syrjälä
  0 siblings, 1 reply; 110+ messages in thread
From: Geert Uytterhoeven @ 2023-03-15  8:16 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Helge Deller, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-fbdev,
	dri-devel

Hi Niklas,

On Tue, Mar 14, 2023 at 1:13 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 and guard inline code in headers.
>
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

Thanks for your patch!

> --- a/drivers/video/fbdev/Kconfig
> +++ b/drivers/video/fbdev/Kconfig

> @@ -1284,7 +1285,7 @@ config FB_ATY128_BACKLIGHT
>
>  config FB_ATY
>         tristate "ATI Mach64 display support" if PCI || ATARI
> -       depends on FB && !SPARC32
> +       depends on FB && HAS_IOPORT && !SPARC32

On Atari, this works without ATARI_ROM_ISA, hence it must not depend
on HAS_IOPORT.
The only call to inb() is inside a section protected by #ifdef
CONFIG_PCI. So:

    depends on FB && !SPARC32
    depends on ATARI || HAS_IOPORT

>         select FB_CFB_FILLRECT
>         select FB_CFB_COPYAREA
>         select FB_CFB_IMAGEBLIT

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 13/38] Input: add HAS_IOPORT dependencies
  2023-03-14 12:11 ` [PATCH v3 13/38] Input: " Niklas Schnelle
@ 2023-03-15  8:22   ` Geert Uytterhoeven
  2023-04-28 14:50     ` Niklas Schnelle
  0 siblings, 1 reply; 110+ messages in thread
From: Geert Uytterhoeven @ 2023-03-15  8:22 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Dmitry Torokhov, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	linux-input

Hi Niklas,

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>

Thanks for your patch!

> --- a/drivers/input/serio/Kconfig
> +++ b/drivers/input/serio/Kconfig
> @@ -75,6 +75,7 @@ config SERIO_Q40KBD
>  config SERIO_PARKBD
>         tristate "Parallel port keyboard adapter"
>         depends on PARPORT
> +       depends on HAS_IOPORT
>         help
>           Say Y here if you built a simple parallel port adapter to attach
>           an additional AT keyboard, XT keyboard or PS/2 mouse.

This driver seems to use only the parport and serio APIs, so it might
work on systems without HAS_IOPORT.  Dunno for sure.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 02/38] ata: add HAS_IOPORT dependencies
  2023-03-14 12:11 ` [PATCH v3 02/38] ata: add HAS_IOPORT dependencies Niklas Schnelle
  2023-03-15  1:23   ` Damien Le Moal
  2023-03-15  7:15   ` Damien Le Moal
@ 2023-03-15  8:39   ` Geert Uytterhoeven
  2023-03-15  9:12     ` Damien Le Moal
  2 siblings, 1 reply; 110+ messages in thread
From: Geert Uytterhoeven @ 2023-03-15  8:39 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Damien Le Moal, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-ide

Hi Niklas,

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>

Thanks for your patch!

> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -342,6 +342,7 @@ endif # HAS_DMA
>
>  config ATA_SFF
>         bool "ATA SFF support (for legacy IDE and PATA)"
> +       depends on HAS_IOPORT
>         default y
>         help
>           This option adds support for ATA controllers with SFF

ATA_SFF is a dependency for lots of (S)ATA drivers.
(at least) The following don't use I/O port access:

    CONFIG_SATA_RCAR (arm/arm64)
    CONFIG_PATA_FALCON (m68k/atari and m68k/q40)
    CONFIG_PATA_GAYLE (m68k/amiga)
    CONFIG_PATA_BUDDHA (m68k/amiga)

(at least) The following can use either MMIO or I/O port accesses:

    CONFIG_PATA_PLATFORM (m68k/mac)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 09/38] gpio: add HAS_IOPORT dependencies
  2023-03-14 12:11 ` [PATCH v3 09/38] gpio: add HAS_IOPORT dependencies Niklas Schnelle
@ 2023-03-15  8:42   ` Linus Walleij
  2023-04-28 14:41     ` Niklas Schnelle
  0 siblings, 1 reply; 110+ messages in thread
From: Linus Walleij @ 2023-03-15  8:42 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Bartosz Golaszewski, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-gpio

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 02/38] ata: add HAS_IOPORT dependencies
  2023-03-15  8:39   ` Geert Uytterhoeven
@ 2023-03-15  9:12     ` Damien Le Moal
  2023-03-15 11:36       ` Geert Uytterhoeven
  0 siblings, 1 reply; 110+ messages in thread
From: Damien Le Moal @ 2023-03-15  9:12 UTC (permalink / raw)
  To: Geert Uytterhoeven, Niklas Schnelle
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-ide

On 3/15/23 17:39, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> 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>
> 
> Thanks for your patch!
> 
>> --- a/drivers/ata/Kconfig
>> +++ b/drivers/ata/Kconfig
>> @@ -342,6 +342,7 @@ endif # HAS_DMA
>>
>>  config ATA_SFF
>>         bool "ATA SFF support (for legacy IDE and PATA)"
>> +       depends on HAS_IOPORT
>>         default y
>>         help
>>           This option adds support for ATA controllers with SFF
> 
> ATA_SFF is a dependency for lots of (S)ATA drivers.
> (at least) The following don't use I/O port access:
> 
>     CONFIG_SATA_RCAR (arm/arm64)
>     CONFIG_PATA_FALCON (m68k/atari and m68k/q40)
>     CONFIG_PATA_GAYLE (m68k/amiga)
>     CONFIG_PATA_BUDDHA (m68k/amiga)
> 
> (at least) The following can use either MMIO or I/O port accesses:
> 
>     CONFIG_PATA_PLATFORM (m68k/mac)

But for these arch/platforms, would there be any reason to not have HAS_IOPORT ?
It is supported right now, so we should have HAS_IOPORT for them.

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 20/38] net: handle HAS_IOPORT dependencies
  2023-03-14 12:11 ` [PATCH v3 20/38] net: handle " Niklas Schnelle
  2023-03-15  5:41   ` Jakub Kicinski
@ 2023-03-15  9:47   ` Maciej W. Rozycki
  1 sibling, 0 replies; 110+ messages in thread
From: Maciej W. Rozycki @ 2023-03-15  9:47 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michael Grzeschik, Wolfgang Grandegger,
	Marc Kleine-Budde, Jesse Brandeburg, Tony Nguyen, Ralf Baechle,
	Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, netdev,
	linux-can, intel-wired-lan, linux-hams

On Tue, 14 Mar 2023, Niklas Schnelle wrote:

> those drivers requiring them. For the DEFXX driver there use of I/O
> ports is optional and we only need to fence those paths.can It also

 Some writing mess-up here, should it read:

"For the DEFXX driver the use of I/O ports is optional and we only need to 
fence those paths. It also [...]"

?

> diff --git a/drivers/net/fddi/Kconfig b/drivers/net/fddi/Kconfig
> index 846bf41c2717..fa3f1e0fe143 100644
> --- a/drivers/net/fddi/Kconfig
> +++ b/drivers/net/fddi/Kconfig
> @@ -29,7 +29,7 @@ config DEFZA
>  
>  config DEFXX
>  	tristate "Digital DEFTA/DEFEA/DEFPA adapter support"
> -	depends on FDDI && (PCI || EISA || TC)
> +	depends on FDDI && (PCI || EISA || TC) && HAS_IOPORT

 This part would incorrectly disable the driver for !HAS_IOPORT and is not 
needed given the change below:

> diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c
> index 1fef8a9b1a0f..5f386eba9618 100644
> --- a/drivers/net/fddi/defxx.c
> +++ b/drivers/net/fddi/defxx.c
> @@ -254,7 +254,7 @@ static const char version[] =
>  #define DFX_BUS_TC(dev) 0
>  #endif
>  
> -#if defined(CONFIG_EISA) || defined(CONFIG_PCI)
> +#ifdef HAS_IOPORT
>  #define dfx_use_mmio bp->mmio
>  #else
>  #define dfx_use_mmio true

is it?

  Maciej

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 35/38] video: handle HAS_IOPORT dependencies
  2023-03-15  8:16   ` Geert Uytterhoeven
@ 2023-03-15 10:19     ` Ville Syrjälä
  2023-03-23 14:17       ` Niklas Schnelle
  0 siblings, 1 reply; 110+ messages in thread
From: Ville Syrjälä @ 2023-03-15 10:19 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Niklas Schnelle, linux-arch, Arnd Bergmann, linux-fbdev,
	Albert Ou, Arnd Bergmann, Rafael J. Wysocki, Greg Kroah-Hartman,
	Helge Deller, Paul Walmsley, linux-pci, linux-kernel, dri-devel,
	Alan Stern, Uwe Kleine-König, Bjorn Helgaas, Palmer Dabbelt,
	Mauro Carvalho Chehab

On Wed, Mar 15, 2023 at 09:16:50AM +0100, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> On Tue, Mar 14, 2023 at 1:13 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 and guard inline code in headers.
> >
> > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> 
> Thanks for your patch!
> 
> > --- a/drivers/video/fbdev/Kconfig
> > +++ b/drivers/video/fbdev/Kconfig
> 
> > @@ -1284,7 +1285,7 @@ config FB_ATY128_BACKLIGHT
> >
> >  config FB_ATY
> >         tristate "ATI Mach64 display support" if PCI || ATARI
> > -       depends on FB && !SPARC32
> > +       depends on FB && HAS_IOPORT && !SPARC32
> 
> On Atari, this works without ATARI_ROM_ISA, hence it must not depend
> on HAS_IOPORT.
> The only call to inb() is inside a section protected by #ifdef
> CONFIG_PCI. So:

That piece of code is a nop anyway. We immediately overwrite
clk_wr_offset with a hardcoded selection after the register reads.
So if you nuke that nop code then no IOPORT dependency required
at all.

> 
>     depends on FB && !SPARC32
>     depends on ATARI || HAS_IOPORT
> 
> >         select FB_CFB_FILLRECT
> >         select FB_CFB_COPYAREA
> >         select FB_CFB_IMAGEBLIT
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> 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

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 02/38] ata: add HAS_IOPORT dependencies
  2023-03-15  9:12     ` Damien Le Moal
@ 2023-03-15 11:36       ` Geert Uytterhoeven
  2023-03-15 23:57         ` Damien Le Moal
  0 siblings, 1 reply; 110+ messages in thread
From: Geert Uytterhoeven @ 2023-03-15 11:36 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Niklas Schnelle, Arnd Bergmann, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	linux-ide

Hi Damien,

On Wed, Mar 15, 2023 at 10:12 AM Damien Le Moal
<damien.lemoal@opensource.wdc.com> wrote:
> On 3/15/23 17:39, Geert Uytterhoeven wrote:
> > 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>
> >
> > Thanks for your patch!
> >
> >> --- a/drivers/ata/Kconfig
> >> +++ b/drivers/ata/Kconfig
> >> @@ -342,6 +342,7 @@ endif # HAS_DMA
> >>
> >>  config ATA_SFF
> >>         bool "ATA SFF support (for legacy IDE and PATA)"
> >> +       depends on HAS_IOPORT
> >>         default y
> >>         help
> >>           This option adds support for ATA controllers with SFF
> >
> > ATA_SFF is a dependency for lots of (S)ATA drivers.
> > (at least) The following don't use I/O port access:
> >
> >     CONFIG_SATA_RCAR (arm/arm64)
> >     CONFIG_PATA_FALCON (m68k/atari and m68k/q40)
> >     CONFIG_PATA_GAYLE (m68k/amiga)
> >     CONFIG_PATA_BUDDHA (m68k/amiga)
> >
> > (at least) The following can use either MMIO or I/O port accesses:
> >
> >     CONFIG_PATA_PLATFORM (m68k/mac)
>
> But for these arch/platforms, would there be any reason to not have HAS_IOPORT ?
> It is supported right now, so we should have HAS_IOPORT for them.

That's the point: on Amiga and Atari, HAS_IOPORT is optional, and
not related to IDE support. On Mac, it is never present.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 07/38] drm: handle HAS_IOPORT dependencies
  2023-03-14 12:11 ` [PATCH v3 07/38] drm: handle HAS_IOPORT dependencies Niklas Schnelle
@ 2023-03-15 11:54   ` Jani Nikula
  2023-03-23 15:05     ` Niklas Schnelle
  0 siblings, 1 reply; 110+ messages in thread
From: Jani Nikula @ 2023-03-15 11:54 UTC (permalink / raw)
  To: Niklas Schnelle, Arnd Bergmann, Dave Airlie, Gerd Hoffmann,
	David Airlie, Daniel Vetter
  Cc: linux-arch, Arnd Bergmann, Albert Ou, Rafael J. Wysocki,
	Greg Kroah-Hartman, Paul Walmsley, linux-pci, linux-kernel,
	dri-devel, virtualization, Alan Stern, spice-devel,
	Uwe Kleine-König, Bjorn Helgaas, Geert Uytterhoeven,
	Mauro Carvalho Chehab, Palmer Dabbelt

On Tue, 14 Mar 2023, 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. In the bochs driver there is optional MMIO
> support detected at runtime, warn if this isn't taken when
> HAS_IOPORT is not defined.

Not that I care a whole lot, but there should really only be one warning
or even failure to probe at bochs_hw_init() for !bochs->mmio &&
!IS_ENABLED(CONFIG_HAS_IOPORT), not warnings all over the place.

Moreover, the config macro is CONFIG_HAS_IOPORT instead of HAS_IOPORT
that you check for below.

BR,
Jani.

> There is also a direct and hard coded use in cirrus.c which according to
> the comment is only necessary during resume.  Let's just skip this as
> for example s390 which doesn't have I/O port support also doesen't
> support suspend/resume.
>
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
>  drivers/gpu/drm/qxl/Kconfig   |  1 +
>  drivers/gpu/drm/tiny/bochs.c  | 19 +++++++++++++++++++
>  drivers/gpu/drm/tiny/cirrus.c |  2 ++
>  3 files changed, 22 insertions(+)
>
> diff --git a/drivers/gpu/drm/qxl/Kconfig b/drivers/gpu/drm/qxl/Kconfig
> index ca3f51c2a8fe..d0e0d440c8d9 100644
> --- a/drivers/gpu/drm/qxl/Kconfig
> +++ b/drivers/gpu/drm/qxl/Kconfig
> @@ -2,6 +2,7 @@
>  config DRM_QXL
>  	tristate "QXL virtual GPU"
>  	depends on DRM && PCI && MMU
> +	depends on HAS_IOPORT
>  	select DRM_KMS_HELPER
>  	select DRM_TTM
>  	select DRM_TTM_HELPER
> diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
> index 024346054c70..da4a5d53b003 100644
> --- a/drivers/gpu/drm/tiny/bochs.c
> +++ b/drivers/gpu/drm/tiny/bochs.c
> @@ -2,6 +2,7 @@
>  
>  #include <linux/module.h>
>  #include <linux/pci.h>
> +#include <asm/bug.h>
>  
>  #include <drm/drm_aperture.h>
>  #include <drm/drm_atomic_helper.h>
> @@ -105,7 +106,11 @@ static void bochs_vga_writeb(struct bochs_device *bochs, u16 ioport, u8 val)
>  
>  		writeb(val, bochs->mmio + offset);
>  	} else {
> +#ifdef HAS_IOPORT
>  		outb(val, ioport);
> +#else
> +		WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT");
> +#endif
>  	}
>  }
>  
> @@ -119,7 +124,12 @@ static u8 bochs_vga_readb(struct bochs_device *bochs, u16 ioport)
>  
>  		return readb(bochs->mmio + offset);
>  	} else {
> +#ifdef HAS_IOPORT
>  		return inb(ioport);
> +#else
> +		WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT");
> +		return 0xff;
> +#endif
>  	}
>  }
>  
> @@ -132,8 +142,13 @@ static u16 bochs_dispi_read(struct bochs_device *bochs, u16 reg)
>  
>  		ret = readw(bochs->mmio + offset);
>  	} else {
> +#ifdef HAS_IOPORT
>  		outw(reg, VBE_DISPI_IOPORT_INDEX);
>  		ret = inw(VBE_DISPI_IOPORT_DATA);
> +#else
> +		WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT");
> +		ret = 0xffff;
> +#endif
>  	}
>  	return ret;
>  }
> @@ -145,8 +160,12 @@ static void bochs_dispi_write(struct bochs_device *bochs, u16 reg, u16 val)
>  
>  		writew(val, bochs->mmio + offset);
>  	} else {
> +#ifdef HAS_IOPORT
>  		outw(reg, VBE_DISPI_IOPORT_INDEX);
>  		outw(val, VBE_DISPI_IOPORT_DATA);
> +#else
> +		WARN_ONCE(1, "Non-MMIO bochs device needs HAS_IOPORT");
> +#endif
>  	}
>  }
>  
> diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c
> index accfa52e78c5..9da89732c5ac 100644
> --- a/drivers/gpu/drm/tiny/cirrus.c
> +++ b/drivers/gpu/drm/tiny/cirrus.c
> @@ -308,8 +308,10 @@ static int cirrus_mode_set(struct cirrus_device *cirrus,
>  
>  	cirrus_set_start_address(cirrus, 0);
>  
> +#ifdef CONFIG_HAS_IOPORT
>  	/* Unblank (needed on S3 resume, vgabios doesn't do it then) */
>  	outb(0x20, 0x3c0);
> +#endif
>  
>  	drm_dev_exit(idx);
>  	return 0;

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 02/38] ata: add HAS_IOPORT dependencies
  2023-03-15 11:36       ` Geert Uytterhoeven
@ 2023-03-15 23:57         ` Damien Le Moal
  2023-03-16 15:21           ` Arnd Bergmann
  0 siblings, 1 reply; 110+ messages in thread
From: Damien Le Moal @ 2023-03-15 23:57 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Niklas Schnelle, Arnd Bergmann, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	linux-ide

On 2023/03/15 20:36, Geert Uytterhoeven wrote:
> Hi Damien,
> 
> On Wed, Mar 15, 2023 at 10:12 AM Damien Le Moal
> <damien.lemoal@opensource.wdc.com> wrote:
>> On 3/15/23 17:39, Geert Uytterhoeven wrote:
>>> 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>
>>>
>>> Thanks for your patch!
>>>
>>>> --- a/drivers/ata/Kconfig
>>>> +++ b/drivers/ata/Kconfig
>>>> @@ -342,6 +342,7 @@ endif # HAS_DMA
>>>>
>>>>  config ATA_SFF
>>>>         bool "ATA SFF support (for legacy IDE and PATA)"
>>>> +       depends on HAS_IOPORT
>>>>         default y
>>>>         help
>>>>           This option adds support for ATA controllers with SFF
>>>
>>> ATA_SFF is a dependency for lots of (S)ATA drivers.
>>> (at least) The following don't use I/O port access:
>>>
>>>     CONFIG_SATA_RCAR (arm/arm64)
>>>     CONFIG_PATA_FALCON (m68k/atari and m68k/q40)
>>>     CONFIG_PATA_GAYLE (m68k/amiga)
>>>     CONFIG_PATA_BUDDHA (m68k/amiga)
>>>
>>> (at least) The following can use either MMIO or I/O port accesses:
>>>
>>>     CONFIG_PATA_PLATFORM (m68k/mac)
>>
>> But for these arch/platforms, would there be any reason to not have HAS_IOPORT ?
>> It is supported right now, so we should have HAS_IOPORT for them.
> 
> That's the point: on Amiga and Atari, HAS_IOPORT is optional, and
> not related to IDE support. On Mac, it is never present.

Ah. OK. I see now. So indeed, applying the dependency on the entire ATA_SFF
group of drivers is very coarse.

Niklas,

Can you change this to apply the dependency per driver ?


-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 02/38] ata: add HAS_IOPORT dependencies
  2023-03-15 23:57         ` Damien Le Moal
@ 2023-03-16 15:21           ` Arnd Bergmann
  2023-04-28 13:32             ` Niklas Schnelle
  0 siblings, 1 reply; 110+ messages in thread
From: Arnd Bergmann @ 2023-03-16 15:21 UTC (permalink / raw)
  To: Damien Le Moal, Geert Uytterhoeven
  Cc: Niklas Schnelle, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J . Wysocki, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, Linux-Arch, linux-pci, Arnd Bergmann, linux-ide

On Thu, Mar 16, 2023, at 00:57, Damien Le Moal wrote:
> On 2023/03/15 20:36, Geert Uytterhoeven wrote:

> Ah. OK. I see now. So indeed, applying the dependency on the entire ATA_SFF
> group of drivers is very coarse.


> Can you change this to apply the dependency per driver ?

I think that will fail to build because of this function
on architectures that drop their non-functional
inb/outb helpers:

int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev)
{
        unsigned long bmdma = pci_resource_start(pdev, 4);
        u8 simplex;
 
        if (bmdma == 0)
                return -ENOENT;
 
        simplex = inb(bmdma + 0x02); 
        outb(simplex & 0x60, bmdma + 0x02);
        simplex = inb(bmdma + 0x02);
        if (simplex & 0x80)
                return -EOPNOTSUPP;
        return 0;
}

This is only called from five pata drivers (ali, amd,
cmd64x, netcell, serverworks), so an easy workaround
would be to make sure those depend on HAS_IOPORT
and enclose the function definition in an #ifdef.

        Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 15/38] leds: add HAS_IOPORT dependencies
  2023-03-14 12:11 ` [PATCH v3 15/38] leds: add " Niklas Schnelle
@ 2023-03-16 16:14   ` Lee Jones
  2023-03-23 12:42     ` Niklas Schnelle
  0 siblings, 1 reply; 110+ messages in thread
From: Lee Jones @ 2023-03-16 16:14 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Pavel Machek, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-leds

On Tue, 14 Mar 2023, Niklas Schnelle 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.
>
> Acked-by: Pavel Machek <pavel@ucw.cz>
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
>  drivers/leds/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

--
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 26/38] pnp: add HAS_IOPORT dependencies
  2023-03-14 12:12 ` [PATCH v3 26/38] pnp: " Niklas Schnelle
@ 2023-03-20 17:37   ` Rafael J. Wysocki
  2023-03-21 13:56     ` Rafael J. Wysocki
  0 siblings, 1 reply; 110+ messages in thread
From: Rafael J. Wysocki @ 2023-03-20 17:37 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Jaroslav Kysela, Rafael J. Wysocki,
	Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-acpi

On Tue, Mar 14, 2023 at 1:13 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 depend on HAS_IOPORT even when
> compile testing only.
>
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
>  drivers/pnp/isapnp/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pnp/isapnp/Kconfig b/drivers/pnp/isapnp/Kconfig
> index d0479a563123..79bd48f1dd94 100644
> --- a/drivers/pnp/isapnp/Kconfig
> +++ b/drivers/pnp/isapnp/Kconfig
> @@ -4,7 +4,7 @@
>  #
>  config ISAPNP
>         bool "ISA Plug and Play support"
> -       depends on ISA || COMPILE_TEST
> +       depends on ISA || (HAS_IOPORT && COMPILE_TEST)
>         help
>           Say Y here if you would like support for ISA Plug and Play devices.
>           Some information is in <file:Documentation/driver-api/isapnp.rst>.
> --

Applied as 6.4 material, thanks!

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 26/38] pnp: add HAS_IOPORT dependencies
  2023-03-20 17:37   ` Rafael J. Wysocki
@ 2023-03-21 13:56     ` Rafael J. Wysocki
  2023-03-23 12:55       ` Niklas Schnelle
  0 siblings, 1 reply; 110+ messages in thread
From: Rafael J. Wysocki @ 2023-03-21 13:56 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Jaroslav Kysela, Rafael J. Wysocki,
	Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-acpi

On Mon, Mar 20, 2023 at 6:37 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Tue, Mar 14, 2023 at 1:13 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 depend on HAS_IOPORT even when
> > compile testing only.
> >
> > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > ---
> >  drivers/pnp/isapnp/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/pnp/isapnp/Kconfig b/drivers/pnp/isapnp/Kconfig
> > index d0479a563123..79bd48f1dd94 100644
> > --- a/drivers/pnp/isapnp/Kconfig
> > +++ b/drivers/pnp/isapnp/Kconfig
> > @@ -4,7 +4,7 @@
> >  #
> >  config ISAPNP
> >         bool "ISA Plug and Play support"
> > -       depends on ISA || COMPILE_TEST
> > +       depends on ISA || (HAS_IOPORT && COMPILE_TEST)

This breaks code selecting ISAPNP and not depending on it.  See
https://lore.kernel.org/linux-acpi/202303211932.5gtCVHCz-lkp@intel.com/T/#u
for example.

I'm dropping the patch now, please fix and resend.

> >         help
> >           Say Y here if you would like support for ISA Plug and Play devices.
> >           Some information is in <file:Documentation/driver-api/isapnp.rst>.
> > --
>
> Applied as 6.4 material, thanks!

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT
  2023-03-14 12:11 ` [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT Niklas Schnelle
                     ` (2 preceding siblings ...)
  2023-03-14 14:17   ` Geert Uytterhoeven
@ 2023-03-21 14:33   ` Jason Gunthorpe
  3 siblings, 0 replies; 110+ messages in thread
From: Jason Gunthorpe @ 2023-03-21 14:33 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Corey Minyard, Peter Huewe,
	Jarkko Sakkinen, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	openipmi-developer, linux-integrity

On Tue, Mar 14, 2023 at 01:11:41PM +0100, Niklas Schnelle wrote:
> diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
> index 9c924a1440a9..2d2ae37153ba 100644
> --- a/drivers/char/tpm/tpm_infineon.c
> +++ b/drivers/char/tpm/tpm_infineon.c
> @@ -51,34 +51,40 @@ static struct tpm_inf_dev tpm_dev;
>  
>  static inline void tpm_data_out(unsigned char data, unsigned char offset)
>  {
> +#ifdef CONFIG_HAS_IOPORT
>  	if (tpm_dev.iotype == TPM_INF_IO_PORT)
>  		outb(data, tpm_dev.data_regs + offset);

You should ifdef away TPM_INF_IO_PORT as well

Jason

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 15/38] leds: add HAS_IOPORT dependencies
  2023-03-16 16:14   ` Lee Jones
@ 2023-03-23 12:42     ` Niklas Schnelle
  2023-03-23 13:32       ` Arnd Bergmann
  2023-03-23 14:53       ` Lee Jones
  0 siblings, 2 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-23 12:42 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Pavel Machek, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-leds

On Thu, 2023-03-16 at 16:14 +0000, Lee Jones wrote:
> On Tue, 14 Mar 2023, Niklas Schnelle 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.
> > 
> > Acked-by: Pavel Machek <pavel@ucw.cz>
> > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > ---
> >  drivers/leds/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Applied, thanks

Sorry should have maybe been more clear, without patch 1 of this series
this won't work as the HAS_IOPORT config option is new and will be
missing otherwise. There's currently two options of merging this,
either all at once or first only patch 1 and then the additional
patches per subsystem until finally the last patch can remove
inb()/outb() and friends when HAS_IOPORT is unset.

Thanks,
Niklas

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 26/38] pnp: add HAS_IOPORT dependencies
  2023-03-21 13:56     ` Rafael J. Wysocki
@ 2023-03-23 12:55       ` Niklas Schnelle
  2023-03-24 18:45         ` Wysocki, Rafael J
  0 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-23 12:55 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Arnd Bergmann, Jaroslav Kysela, Rafael J. Wysocki,
	Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Geert Uytterhoeven,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-kernel,
	linux-arch, linux-pci, Arnd Bergmann, linux-acpi

On Tue, 2023-03-21 at 14:56 +0100, Rafael J. Wysocki wrote:
> On Mon, Mar 20, 2023 at 6:37 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > 
> > On Tue, Mar 14, 2023 at 1:13 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 depend on HAS_IOPORT even when
> > > compile testing only.
> > > 
> > > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > > ---
> > >  drivers/pnp/isapnp/Kconfig | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/pnp/isapnp/Kconfig b/drivers/pnp/isapnp/Kconfig
> > > index d0479a563123..79bd48f1dd94 100644
> > > --- a/drivers/pnp/isapnp/Kconfig
> > > +++ b/drivers/pnp/isapnp/Kconfig
> > > @@ -4,7 +4,7 @@
> > >  #
> > >  config ISAPNP
> > >         bool "ISA Plug and Play support"
> > > -       depends on ISA || COMPILE_TEST
> > > +       depends on ISA || (HAS_IOPORT && COMPILE_TEST)
> 
> This breaks code selecting ISAPNP and not depending on it.  See
> https://lore.kernel.org/linux-acpi/202303211932.5gtCVHCz-lkp@intel.com/T/#u
> for example.
> 
> I'm dropping the patch now, please fix and resend.
> 
> > 

Sorry if this wasn't super clear but all patches in this series depend
on patch 1 which introduces the HAS_IOPORT Kconfig option. There's
really two options, either the whole series goes via e.g. Arnd's tree
at once or we first only merge patch 1 and then add the rest per
subsystem until finally the last patch can remove inb()/outb() when
HAS_IOPORT is unset.

That said I'm a little unsure about the linked error if that is just
due to missing HAS_IOPORT or something else. I'll still have to try
with the instructions in that mail and will report back if it is
something else.

Thanks,
Niklas

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary
  2023-03-14 12:37   ` Johannes Berg
@ 2023-03-23 13:23     ` Niklas Schnelle
  0 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-23 13:23 UTC (permalink / raw)
  To: Johannes Berg, Arnd Bergmann, Richard Henderson, Ivan Kokshaysky,
	Matt Turner, Russell King, Catalin Marinas, Will Deacon,
	Geert Uytterhoeven, Michal Simek, Thomas Bogendoerfer,
	James E.J. Bottomley, Helge Deller, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, David S. Miller, Richard Weinberger,
	Anton Ivanov, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J. Wysocki,
	linux-kernel, linux-arch, linux-pci, Arnd Bergmann, linux-alpha,
	linux-arm-kernel, linux-ia64, linux-m68k, linux-mips,
	linux-parisc, linuxppc-dev, linux-riscv, linux-sh, sparclinux,
	linux-um

On Tue, 2023-03-14 at 13:37 +0100, Johannes Berg wrote:
> On Tue, 2023-03-14 at 13:11 +0100, Niklas Schnelle wrote:
> > --- a/arch/um/Kconfig
> > +++ b/arch/um/Kconfig
> > @@ -56,6 +56,7 @@ config NO_IOPORT_MAP
> >  
> >  config ISA
> >  	bool
> > +	depends on HAS_IOPORT
> > 
> 
> config ISA here is already unselectable, and nothing ever does "select
> ISA" (only in some other architectures), so is there much point in this?
> 
> I'm not even sure why this exists at all.

You're right there's not much point and I dropped this for v4. I agree
that probably the whole "config ISA" could be removed if it's always
false anyway but that seems out of scope for this patch.

> 
> But anyway, adding a dependency to a always-false symbol doesn't make it
> less always-false :-)
> 
> Acked-by: Johannes Berg <johannes@sipsolutions.net> # for ARCH=um

Thanks

> 
> 
> Certainly will be nice to get rid of this cruft for architectures that
> don't have it.
> 
> johannes

Yes, also, for s390 the broken NULL + port number access in the generic
inb()/outb() currently causes the only remaining clang warning on
defconfig builds.

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 15/38] leds: add HAS_IOPORT dependencies
  2023-03-23 12:42     ` Niklas Schnelle
@ 2023-03-23 13:32       ` Arnd Bergmann
  2023-03-23 14:02         ` Niklas Schnelle
  2023-03-23 16:11         ` Geert Uytterhoeven
  2023-03-23 14:53       ` Lee Jones
  1 sibling, 2 replies; 110+ messages in thread
From: Arnd Bergmann @ 2023-03-23 13:32 UTC (permalink / raw)
  To: Niklas Schnelle, Lee Jones
  Cc: Pavel Machek, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J . Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, Linux-Arch, linux-pci,
	Arnd Bergmann, linux-leds

On Thu, Mar 23, 2023, at 13:42, Niklas Schnelle wrote:
> On Thu, 2023-03-16 at 16:14 +0000, Lee Jones wrote:
>> On Tue, 14 Mar 2023, Niklas Schnelle 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.
>> > 
>> > Acked-by: Pavel Machek <pavel@ucw.cz>
>> > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
>> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
>> > ---
>> >  drivers/leds/Kconfig | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> Applied, thanks
>
> Sorry should have maybe been more clear, without patch 1 of this series
> this won't work as the HAS_IOPORT config option is new and will be
> missing otherwise. There's currently two options of merging this,
> either all at once or first only patch 1 and then the additional
> patches per subsystem until finally the last patch can remove
> inb()/outb() and friends when HAS_IOPORT is unset.

It's probably too late now to squeeze patch 1 into linux-6.3
as a late preparation patch for the rest of the series in 6.4.

It would be good if you could respin that patch separately
anyway, so I can add it to the asm-generic tree and make
sure we get it ready for the next merge window.

     Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 15/38] leds: add HAS_IOPORT dependencies
  2023-03-23 13:32       ` Arnd Bergmann
@ 2023-03-23 14:02         ` Niklas Schnelle
  2023-03-23 14:05           ` Arnd Bergmann
  2023-03-23 16:11         ` Geert Uytterhoeven
  1 sibling, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-23 14:02 UTC (permalink / raw)
  To: Arnd Bergmann, Lee Jones
  Cc: Pavel Machek, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J . Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, Linux-Arch, linux-pci,
	Arnd Bergmann, linux-leds

On Thu, 2023-03-23 at 14:32 +0100, Arnd Bergmann wrote:
> On Thu, Mar 23, 2023, at 13:42, Niklas Schnelle wrote:
> > On Thu, 2023-03-16 at 16:14 +0000, Lee Jones wrote:
> > > On Tue, 14 Mar 2023, Niklas Schnelle 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.
> > > > 
> > > > Acked-by: Pavel Machek <pavel@ucw.cz>
> > > > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > > > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > > > ---
> > > >  drivers/leds/Kconfig | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > Applied, thanks
> > 
> > Sorry should have maybe been more clear, without patch 1 of this series
> > this won't work as the HAS_IOPORT config option is new and will be
> > missing otherwise. There's currently two options of merging this,
> > either all at once or first only patch 1 and then the additional
> > patches per subsystem until finally the last patch can remove
> > inb()/outb() and friends when HAS_IOPORT is unset.
> 
> It's probably too late now to squeeze patch 1 into linux-6.3
> as a late preparation patch for the rest of the series in 6.4.
> 
> It would be good if you could respin that patch separately
> anyway, so I can add it to the asm-generic tree and make
> sure we get it ready for the next merge window.
> 
>      Arnd

Yes, sorry I was traveling Thursday to Monday and then spent some time
catching up and investigating an internal issue. I'm currently going
through the patches one by one incorporating comments. I fear the split
of the USB patch as well as the suggestions for video might take a bit
of time, so if you prefer I could also send just an updated patch 1
separately. How would I do this cleanly? Send as v4 without(?) a cover
letter and add a Note after the '---'?

Thanks,
Niklas

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 15/38] leds: add HAS_IOPORT dependencies
  2023-03-23 14:02         ` Niklas Schnelle
@ 2023-03-23 14:05           ` Arnd Bergmann
  0 siblings, 0 replies; 110+ messages in thread
From: Arnd Bergmann @ 2023-03-23 14:05 UTC (permalink / raw)
  To: Niklas Schnelle, Lee Jones
  Cc: Pavel Machek, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J . Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, Linux-Arch, linux-pci,
	Arnd Bergmann, linux-leds

On Thu, Mar 23, 2023, at 15:02, Niklas Schnelle wrote:
> On Thu, 2023-03-23 at 14:32 +0100, Arnd Bergmann wrote:
>> On Thu, Mar 23, 2023, at 13:42, Niklas Schnelle wrote:
>> > On Thu, 2023-03-16 at 16:14 +0000, Lee Jones wrote:
>> > > On Tue, 14 Mar 2023, Niklas Schnelle wrote:

> Yes, sorry I was traveling Thursday to Monday and then spent some time
> catching up and investigating an internal issue. I'm currently going
> through the patches one by one incorporating comments. I fear the split
> of the USB patch as well as the suggestions for video might take a bit
> of time, so if you prefer I could also send just an updated patch 1
> separately. How would I do this cleanly? Send as v4 without(?) a cover
> letter and add a Note after the '---'?

Yes, that sounds good to me. In case you need multiple
versions, I would suggest you continue counting at v4
independently for both the preparation patch and the
rest of the series.

    Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 35/38] video: handle HAS_IOPORT dependencies
  2023-03-15 10:19     ` Ville Syrjälä
@ 2023-03-23 14:17       ` Niklas Schnelle
  2023-03-23 16:08         ` Ville Syrjälä
  0 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-23 14:17 UTC (permalink / raw)
  To: Ville Syrjälä, Geert Uytterhoeven
  Cc: linux-arch, Arnd Bergmann, linux-fbdev, Albert Ou, Arnd Bergmann,
	Rafael J. Wysocki, Greg Kroah-Hartman, Helge Deller,
	Paul Walmsley, linux-pci, linux-kernel, dri-devel, Alan Stern,
	Uwe Kleine-König, Bjorn Helgaas, Palmer Dabbelt,
	Mauro Carvalho Chehab

On Wed, 2023-03-15 at 12:19 +0200, Ville Syrjälä wrote:
> On Wed, Mar 15, 2023 at 09:16:50AM +0100, Geert Uytterhoeven wrote:
> > Hi Niklas,
> > 
> > On Tue, Mar 14, 2023 at 1:13 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 and guard inline code in headers.
> > > 
> > > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > 
> > Thanks for your patch!
> > 
> > > --- a/drivers/video/fbdev/Kconfig
> > > +++ b/drivers/video/fbdev/Kconfig
> > 
> > > @@ -1284,7 +1285,7 @@ config FB_ATY128_BACKLIGHT
> > > 
> > >  config FB_ATY
> > >         tristate "ATI Mach64 display support" if PCI || ATARI
> > > -       depends on FB && !SPARC32
> > > +       depends on FB && HAS_IOPORT && !SPARC32
> > 
> > On Atari, this works without ATARI_ROM_ISA, hence it must not depend
> > on HAS_IOPORT.
> > The only call to inb() is inside a section protected by #ifdef
> > CONFIG_PCI. So:
> 
> That piece of code is a nop anyway. We immediately overwrite
> clk_wr_offset with a hardcoded selection after the register reads.
> So if you nuke that nop code then no IOPORT dependency required
> at all.
> 

I agree this "looks" like a nop but are we sure the inb() doesn't have
side effects? 
(for reference drivers/video/fbdev/aty/aty/atyfb_base.c:
atyfb_setup_generc() towards the end)

It does feel a bit out of scope for this series but if it's really a
nop nuking it surely is the cleaner solution.

Thanks,
Niklas


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 15/38] leds: add HAS_IOPORT dependencies
  2023-03-23 12:42     ` Niklas Schnelle
  2023-03-23 13:32       ` Arnd Bergmann
@ 2023-03-23 14:53       ` Lee Jones
  2023-03-23 15:33         ` Niklas Schnelle
  1 sibling, 1 reply; 110+ messages in thread
From: Lee Jones @ 2023-03-23 14:53 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Pavel Machek, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-leds

On Thu, 23 Mar 2023, Niklas Schnelle wrote:

> On Thu, 2023-03-16 at 16:14 +0000, Lee Jones wrote:
> > On Tue, 14 Mar 2023, Niklas Schnelle 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.
> > >
> > > Acked-by: Pavel Machek <pavel@ucw.cz>
> > > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > > ---
> > >  drivers/leds/Kconfig | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Applied, thanks
>
> Sorry should have maybe been more clear, without patch 1 of this series
> this won't work as the HAS_IOPORT config option is new and will be
> missing otherwise. There's currently two options of merging this,
> either all at once or first only patch 1 and then the additional
> patches per subsystem until finally the last patch can remove
> inb()/outb() and friends when HAS_IOPORT is unset.

You only sent me this patch.

If there are in-set dependencies, you need to send everyone the whole
set so that we can organise a suitable merge strategy between us.

I'll revert the patch for now.

--
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 07/38] drm: handle HAS_IOPORT dependencies
  2023-03-15 11:54   ` Jani Nikula
@ 2023-03-23 15:05     ` Niklas Schnelle
  0 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-23 15:05 UTC (permalink / raw)
  To: Jani Nikula, Arnd Bergmann, Dave Airlie, Gerd Hoffmann,
	David Airlie, Daniel Vetter
  Cc: linux-arch, Arnd Bergmann, Albert Ou, Rafael J. Wysocki,
	Greg Kroah-Hartman, Paul Walmsley, linux-pci, linux-kernel,
	dri-devel, virtualization, Alan Stern, spice-devel,
	Uwe Kleine-König, Bjorn Helgaas, Geert Uytterhoeven,
	Mauro Carvalho Chehab, Palmer Dabbelt

On Wed, 2023-03-15 at 13:54 +0200, Jani Nikula wrote:
> On Tue, 14 Mar 2023, 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. In the bochs driver there is optional MMIO
> > support detected at runtime, warn if this isn't taken when
> > HAS_IOPORT is not defined.
> 
> Not that I care a whole lot, but there should really only be one warning
> or even failure to probe at bochs_hw_init() for !bochs->mmio &&
> !IS_ENABLED(CONFIG_HAS_IOPORT), not warnings all over the place.
> 
> Moreover, the config macro is CONFIG_HAS_IOPORT instead of HAS_IOPORT
> that you check for below.
> 
> BR,
> Jani.
> 

Good Find! Yes the #ifdefs need CONFIG_HAS_IOPORT I even had it
correctly for cirrus in the same patch. For v4 I remove the separate
warnings and instead went with the below:

@@ -229,6 +242,10 @@ static int bochs_hw_init(struct drm_device *dev)
                        return -ENOMEM;
                }
        } else {
+               if (!IS_ENABLED(CONFIG_HAS_IOPORT)) {
+                       DRM_ERROR("I/O ports are not supported\n");
+                       return -EIO;
+               }
                ioaddr = VBE_DISPI_IOPORT_INDEX;
                iosize = 2;
                if (!request_region(ioaddr, iosize, "bochs-drm")) {


Thanks,
Niklas


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 15/38] leds: add HAS_IOPORT dependencies
  2023-03-23 14:53       ` Lee Jones
@ 2023-03-23 15:33         ` Niklas Schnelle
  0 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-03-23 15:33 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Pavel Machek, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-leds

On Thu, 2023-03-23 at 14:53 +0000, Lee Jones wrote:
> On Thu, 23 Mar 2023, Niklas Schnelle wrote:
> 
> > On Thu, 2023-03-16 at 16:14 +0000, Lee Jones wrote:
> > > On Tue, 14 Mar 2023, Niklas Schnelle 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.
> > > > 
> > > > Acked-by: Pavel Machek <pavel@ucw.cz>
> > > > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > > > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > > > ---
> > > >  drivers/leds/Kconfig | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > Applied, thanks
> > 
> > Sorry should have maybe been more clear, without patch 1 of this series
> > this won't work as the HAS_IOPORT config option is new and will be
> > missing otherwise. There's currently two options of merging this,
> > either all at once or first only patch 1 and then the additional
> > patches per subsystem until finally the last patch can remove
> > inb()/outb() and friends when HAS_IOPORT is unset.
> 
> You only sent me this patch.
> 
> If there are in-set dependencies, you need to send everyone the whole
> set so that we can organise a suitable merge strategy between us.
> 
> I'll revert the patch for now.
> 
> --
> Lee Jones [李琼斯]

I know this isn't ideal and I'm sorry for the confusion, extra work and
churn. As far as I know sadly it's not possible to Cc everyone for such
treewide series because the recipient list will hit the limits
supported by some systems and mails get dropped which sucks even more.
Maybe this can be solved in the future though, Konstantin Ryabitsev
actually reached out because I mentioned that I tried using b4 prep /
b4 send but couldn't exactly because it only supports a global
recipient list.

Thanks,
Niklas

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 35/38] video: handle HAS_IOPORT dependencies
  2023-03-23 14:17       ` Niklas Schnelle
@ 2023-03-23 16:08         ` Ville Syrjälä
  2023-05-08 17:09           ` Niklas Schnelle
  0 siblings, 1 reply; 110+ messages in thread
From: Ville Syrjälä @ 2023-03-23 16:08 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Geert Uytterhoeven, linux-arch, Arnd Bergmann, linux-fbdev,
	Albert Ou, Arnd Bergmann, Rafael J. Wysocki, Greg Kroah-Hartman,
	Helge Deller, Paul Walmsley, linux-pci, linux-kernel, dri-devel,
	Alan Stern, Uwe Kleine-König, Bjorn Helgaas, Palmer Dabbelt,
	Mauro Carvalho Chehab

On Thu, Mar 23, 2023 at 03:17:38PM +0100, Niklas Schnelle wrote:
> On Wed, 2023-03-15 at 12:19 +0200, Ville Syrjälä wrote:
> > On Wed, Mar 15, 2023 at 09:16:50AM +0100, Geert Uytterhoeven wrote:
> > > Hi Niklas,
> > > 
> > > On Tue, Mar 14, 2023 at 1:13 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 and guard inline code in headers.
> > > > 
> > > > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > > > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > > 
> > > Thanks for your patch!
> > > 
> > > > --- a/drivers/video/fbdev/Kconfig
> > > > +++ b/drivers/video/fbdev/Kconfig
> > > 
> > > > @@ -1284,7 +1285,7 @@ config FB_ATY128_BACKLIGHT
> > > > 
> > > >  config FB_ATY
> > > >         tristate "ATI Mach64 display support" if PCI || ATARI
> > > > -       depends on FB && !SPARC32
> > > > +       depends on FB && HAS_IOPORT && !SPARC32
> > > 
> > > On Atari, this works without ATARI_ROM_ISA, hence it must not depend
> > > on HAS_IOPORT.
> > > The only call to inb() is inside a section protected by #ifdef
> > > CONFIG_PCI. So:
> > 
> > That piece of code is a nop anyway. We immediately overwrite
> > clk_wr_offset with a hardcoded selection after the register reads.
> > So if you nuke that nop code then no IOPORT dependency required
> > at all.
> > 
> 
> I agree this "looks" like a nop but are we sure the inb() doesn't have
> side effects? 

Yes. It's just trying to check which PLL dividers/etc. are currently
used. In VGA mode it gets it from a the GENMO and in non-VGA mode from
CLOCK_CNTL. And then it says "screw that" and just uses index 3 instead.

Though I must say that mach64 GX seems to use that clk_wr_offset
very differently so I'm not sure the PCI+GX combo is even working
currently, assuming those even exist. I don't think I have anything
older than a PCI mach64 VT myself.

> (for reference drivers/video/fbdev/aty/aty/atyfb_base.c:
> atyfb_setup_generc() towards the end)
> 
> It does feel a bit out of scope for this series but if it's really a
> nop nuking it surely is the cleaner solution.
> 
> Thanks,
> Niklas

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 15/38] leds: add HAS_IOPORT dependencies
  2023-03-23 13:32       ` Arnd Bergmann
  2023-03-23 14:02         ` Niklas Schnelle
@ 2023-03-23 16:11         ` Geert Uytterhoeven
  2023-03-23 16:25           ` Arnd Bergmann
  1 sibling, 1 reply; 110+ messages in thread
From: Geert Uytterhoeven @ 2023-03-23 16:11 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Niklas Schnelle, Lee Jones, Pavel Machek, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J . Wysocki, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, linux-kernel, Linux-Arch, linux-pci, Arnd Bergmann,
	linux-leds

Hi Arnd,

On Thu, Mar 23, 2023 at 2:32 PM Arnd Bergmann <arnd@arndb.de> wrote:
> On Thu, Mar 23, 2023, at 13:42, Niklas Schnelle wrote:
> > On Thu, 2023-03-16 at 16:14 +0000, Lee Jones wrote:
> >> On Tue, 14 Mar 2023, Niklas Schnelle 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.
> >> >
> >> > Acked-by: Pavel Machek <pavel@ucw.cz>
> >> > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> >> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> >> > ---
> >> >  drivers/leds/Kconfig | 2 +-
> >> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> Applied, thanks
> >
> > Sorry should have maybe been more clear, without patch 1 of this series
> > this won't work as the HAS_IOPORT config option is new and will be
> > missing otherwise. There's currently two options of merging this,
> > either all at once or first only patch 1 and then the additional
> > patches per subsystem until finally the last patch can remove
> > inb()/outb() and friends when HAS_IOPORT is unset.
>
> It's probably too late now to squeeze patch 1 into linux-6.3
> as a late preparation patch for the rest of the series in 6.4.
>
> It would be good if you could respin that patch separately
> anyway, so I can add it to the asm-generic tree and make
> sure we get it ready for the next merge window.

Through an immutable branch, else all dependencies have to wait
for v6.5?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 15/38] leds: add HAS_IOPORT dependencies
  2023-03-23 16:11         ` Geert Uytterhoeven
@ 2023-03-23 16:25           ` Arnd Bergmann
  0 siblings, 0 replies; 110+ messages in thread
From: Arnd Bergmann @ 2023-03-23 16:25 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Niklas Schnelle, Lee Jones, Pavel Machek, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J . Wysocki, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, linux-kernel, Linux-Arch, linux-pci, Arnd Bergmann,
	linux-leds

On Thu, Mar 23, 2023, at 17:11, Geert Uytterhoeven wrote:
> On Thu, Mar 23, 2023 at 2:32 PM Arnd Bergmann <arnd@arndb.de> wrote:
>> On Thu, Mar 23, 2023, at 13:42, Niklas Schnelle wrote:
>
> Through an immutable branch, else all dependencies have to wait
> for v6.5?

Sure, will do. I suspect that there will still be something
left behind that doesn't make it into 6.4, so the final bit
(dropping broken inb/outb implementations) will have to be
6.5 material anyway, but at least we can aim on getting most
of it into 6.4.

     Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 26/38] pnp: add HAS_IOPORT dependencies
  2023-03-23 12:55       ` Niklas Schnelle
@ 2023-03-24 18:45         ` Wysocki, Rafael J
  0 siblings, 0 replies; 110+ messages in thread
From: Wysocki, Rafael J @ 2023-03-24 18:45 UTC (permalink / raw)
  To: Niklas Schnelle, Rafael J. Wysocki
  Cc: Arnd Bergmann, Jaroslav Kysela, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	linux-acpi


On 3/23/2023 1:55 PM, Niklas Schnelle wrote:
> On Tue, 2023-03-21 at 14:56 +0100, Rafael J. Wysocki wrote:
>> On Mon, Mar 20, 2023 at 6:37 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>>> On Tue, Mar 14, 2023 at 1:13 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 depend on HAS_IOPORT even when
>>>> compile testing only.
>>>>
>>>> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
>>>> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
>>>> ---
>>>>   drivers/pnp/isapnp/Kconfig | 2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/pnp/isapnp/Kconfig b/drivers/pnp/isapnp/Kconfig
>>>> index d0479a563123..79bd48f1dd94 100644
>>>> --- a/drivers/pnp/isapnp/Kconfig
>>>> +++ b/drivers/pnp/isapnp/Kconfig
>>>> @@ -4,7 +4,7 @@
>>>>   #
>>>>   config ISAPNP
>>>>          bool "ISA Plug and Play support"
>>>> -       depends on ISA || COMPILE_TEST
>>>> +       depends on ISA || (HAS_IOPORT && COMPILE_TEST)
>> This breaks code selecting ISAPNP and not depending on it.  See
>> https://lore.kernel.org/linux-acpi/202303211932.5gtCVHCz-lkp@intel.com/T/#u
>> for example.
>>
>> I'm dropping the patch now, please fix and resend.
>>
> Sorry if this wasn't super clear but all patches in this series depend
> on patch 1 which introduces the HAS_IOPORT Kconfig option. There's
> really two options, either the whole series goes via e.g. Arnd's tree
> at once or we first only merge patch 1 and then add the rest per
> subsystem until finally the last patch can remove inb()/outb() when
> HAS_IOPORT is unset.

Well, it looks like you need to decide on the approach then and tell 
people what it is.

If I see an individual patch without context, this is quite hard to 
figure out.


> That said I'm a little unsure about the linked error if that is just
> due to missing HAS_IOPORT or something else. I'll still have to try
> with the instructions in that mail and will report back if it is
> something else.
>
> Thanks,
> Niklas

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 27/38] power: add HAS_IOPORT dependencies
  2023-03-14 12:12 ` [PATCH v3 27/38] power: " Niklas Schnelle
@ 2023-03-29 23:01   ` Sebastian Reichel
  0 siblings, 0 replies; 110+ messages in thread
From: Sebastian Reichel @ 2023-03-29 23:01 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-pm

[-- Attachment #1: Type: text/plain, Size: 1022 bytes --]

Hi,

On Tue, Mar 14, 2023 at 01:12:05PM +0100, Niklas Schnelle 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>
> ---

Acked-by: Sebastian Reichel <sre@kernel.org>

-- Sebastian

>  drivers/power/reset/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
> index 8c87eeda0fec..fff07b2bd77b 100644
> --- a/drivers/power/reset/Kconfig
> +++ b/drivers/power/reset/Kconfig
> @@ -158,6 +158,7 @@ config POWER_RESET_OXNAS
>  config POWER_RESET_PIIX4_POWEROFF
>  	tristate "Intel PIIX4 power-off driver"
>  	depends on PCI
> +	depends on HAS_IOPORT
>  	depends on MIPS || COMPILE_TEST
>  	help
>  	  This driver supports powering off a system using the Intel PIIX4
> -- 
> 2.37.2
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 05/38] counter: add HAS_IOPORT dependencies
  2023-03-14 12:41   ` William Breathitt Gray
@ 2023-04-28 13:27     ` Niklas Schnelle
  0 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-04-28 13:27 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-iio

On Tue, 2023-03-14 at 08:41 -0400, William Breathitt Gray wrote:
> On Tue, Mar 14, 2023 at 01:11:43PM +0100, Niklas Schnelle 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/counter/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/counter/Kconfig b/drivers/counter/Kconfig
> > index b5ba8fb02cf7..1cae5097217e 100644
> > --- a/drivers/counter/Kconfig
> > +++ b/drivers/counter/Kconfig
> > @@ -15,6 +15,7 @@ if COUNTER
> >  config 104_QUAD_8
> >  	tristate "ACCES 104-QUAD-8 driver"
> >  	depends on (PC104 && X86) || COMPILE_TEST
> > +	depends on HAS_IOPORT
> >  	select ISA_BUS_API
> >  	help
> >  	  Say yes here to build support for the ACCES 104-QUAD-8 quadrature
> > -- 
> > 2.37.2
> 
> Is HAS_IOPORT needed because this driver uses devm_ioport_map()? The
> inb()/outb() functions and such are not used in this driver, so would it
> suffice to depend on HAS_IOPORT_MAP instead?
> 
> William Breathitt Gray

Yes, good catch HAS_IOPORT_MAP indeed seems to be enough. Will be
changed in v4. Thankfully the Kconfig change to add HAS_IOPORT has
already landed in Linus' tree so for the future these per subsystem
patches can be merged independently.

Thanks,
Niklas

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 02/38] ata: add HAS_IOPORT dependencies
  2023-03-16 15:21           ` Arnd Bergmann
@ 2023-04-28 13:32             ` Niklas Schnelle
  0 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-04-28 13:32 UTC (permalink / raw)
  To: Arnd Bergmann, Damien Le Moal, Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-kernel,
	Linux-Arch, linux-pci, Arnd Bergmann, linux-ide

On Thu, 2023-03-16 at 16:21 +0100, Arnd Bergmann wrote:
> On Thu, Mar 16, 2023, at 00:57, Damien Le Moal wrote:
> > On 2023/03/15 20:36, Geert Uytterhoeven wrote:
> 
> > Ah. OK. I see now. So indeed, applying the dependency on the entire ATA_SFF
> > group of drivers is very coarse.
> 
> 
> > Can you change this to apply the dependency per driver ?
> 
> I think that will fail to build because of this function
> on architectures that drop their non-functional
> inb/outb helpers:
> 
> int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev)
> {
>         unsigned long bmdma = pci_resource_start(pdev, 4);
>         u8 simplex;
>  
>         if (bmdma == 0)
>                 return -ENOENT;
>  
>         simplex = inb(bmdma + 0x02); 
>         outb(simplex & 0x60, bmdma + 0x02);
>         simplex = inb(bmdma + 0x02);
>         if (simplex & 0x80)
>                 return -EOPNOTSUPP;
>         return 0;
> }
> 
> This is only called from five pata drivers (ali, amd,
> cmd64x, netcell, serverworks), so an easy workaround
> would be to make sure those depend on HAS_IOPORT
> and enclose the function definition in an #ifdef.
> 
>         Arnd

There were a few additional inb()/outb() uses so a few more drivers had
to have the dependency added but for v4 it will no longer be on the
ATA_SFF option and I used your suggestion above for this function.
There was another call to it in ata_generic_init_one() that is only
done for PCI_VENDOR_ID_AL so I added an #ifdef CONFIG_PATA_ALI around
that.

Thanks,
Niklas

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 09/38] gpio: add HAS_IOPORT dependencies
  2023-03-15  8:42   ` Linus Walleij
@ 2023-04-28 14:41     ` Niklas Schnelle
  2023-05-01 12:29       ` Linus Walleij
  0 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-04-28 14:41 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Arnd Bergmann, Bartosz Golaszewski, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-gpio

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


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 13/38] Input: add HAS_IOPORT dependencies
  2023-03-15  8:22   ` Geert Uytterhoeven
@ 2023-04-28 14:50     ` Niklas Schnelle
  0 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-04-28 14:50 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Arnd Bergmann, Dmitry Torokhov, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, linux-kernel, linux-arch, linux-pci, Arnd Bergmann,
	linux-input

On Wed, 2023-03-15 at 09:22 +0100, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> 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>
> 
> Thanks for your patch!
> 
> > --- a/drivers/input/serio/Kconfig
> > +++ b/drivers/input/serio/Kconfig
> > @@ -75,6 +75,7 @@ config SERIO_Q40KBD
> >  config SERIO_PARKBD
> >         tristate "Parallel port keyboard adapter"
> >         depends on PARPORT
> > +       depends on HAS_IOPORT
> >         help
> >           Say Y here if you built a simple parallel port adapter to attach
> >           an additional AT keyboard, XT keyboard or PS/2 mouse.
> 
> This driver seems to use only the parport and serio APIs, so it might
> work on systems without HAS_IOPORT.  Dunno for sure.
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 

Thanks, yes you're right this driver compiles fine without inb()/outb()
etc. I removed the dependency, not sure if it used to have a dependency
or this was a mixup but it's corrected for v4.

Thanks,
Niklas

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 09/38] gpio: add HAS_IOPORT dependencies
  2023-04-28 14:41     ` Niklas Schnelle
@ 2023-05-01 12:29       ` Linus Walleij
  0 siblings, 0 replies; 110+ messages in thread
From: Linus Walleij @ 2023-05-01 12:29 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Bartosz Golaszewski, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-gpio

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 21/38] parport: PC style parport depends on HAS_IOPORT
  2023-03-14 14:12   ` Arnd Bergmann
@ 2023-05-02 13:40     ` Niklas Schnelle
  0 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-05-02 13:40 UTC (permalink / raw)
  To: Arnd Bergmann, Sudip Mukherjee
  Cc: Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	Geert Uytterhoeven, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-kernel, Linux-Arch, linux-pci, Arnd Bergmann

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 :-)


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 21/38] parport: PC style parport depends on HAS_IOPORT
  2023-03-14 12:11 ` [PATCH v3 21/38] parport: PC style parport depends on HAS_IOPORT Niklas Schnelle
  2023-03-14 14:12   ` Arnd Bergmann
@ 2023-05-02 15:30   ` Bjorn Helgaas
  1 sibling, 0 replies; 110+ messages in thread
From: Bjorn Helgaas @ 2023-05-02 15:30 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Arnd Bergmann, Sudip Mukherjee, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann

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
> 

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 28/38] rtc: add HAS_IOPORT dependencies
  2023-03-14 12:52   ` Alexandre Belloni
@ 2023-05-08 15:36     ` Niklas Schnelle
  2023-05-08 20:01       ` Arnd Bergmann
  0 siblings, 1 reply; 110+ messages in thread
From: Niklas Schnelle @ 2023-05-08 15:36 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Arnd Bergmann, Alessandro Zummo, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, linux-rtc

On Tue, 2023-03-14 at 13:52 +0100, Alexandre Belloni wrote:
> Hello,
> 
> On 14/03/2023 13:12:06+0100, Niklas Schnelle 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/rtc/Kconfig | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> > index 5a71579af0a1..20aa77bf0a9f 100644
> > --- a/drivers/rtc/Kconfig
> > +++ b/drivers/rtc/Kconfig
> > @@ -956,6 +956,7 @@ comment "Platform RTC drivers"
> >  config RTC_DRV_CMOS
> >  	tristate "PC-style 'CMOS'"
> >  	depends on X86 || ARM || PPC || MIPS || SPARC64
> > +	depends on HAS_IOPORT
> 
> Did you check that this will not break platforms that doesn't have RTC_PORT defined?
> > 

From what I can tell the CMOS_READ() macro this driver relies on uses
some form of inb() style I/O port access in all its definitions. So my
understanding is that this device is always accessed via I/O ports even
if the variants differ slightly and would make no sense on a platform
without any way of accessing I/O ports which is what lack of HAS_IOPORT
means. From what I can see even without RTC_PORT being defined the
CMOS_READ is still used. Hope that answers your question?

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 30/38] sound: add HAS_IOPORT dependencies
  2023-03-14 12:33   ` Takashi Iwai
@ 2023-05-08 16:41     ` Niklas Schnelle
  0 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-05-08 16:41 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Arnd Bergmann, Jaroslav Kysela, Takashi Iwai, Greg Kroah-Hartman,
	Bjorn Helgaas, Uwe Kleine-König, Mauro Carvalho Chehab,
	Alan Stern, Rafael J. Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, linux-arch, linux-pci,
	Arnd Bergmann, alsa-devel

On Tue, 2023-03-14 at 13:33 +0100, Takashi Iwai wrote:
> On Tue, 14 Mar 2023 13:12:08 +0100,
> Niklas Schnelle wrote:
> > --- a/sound/isa/Kconfig
> > +++ b/sound/isa/Kconfig
> > @@ -23,6 +23,7 @@ menuconfig SND_ISA
> >  	bool "ISA sound devices"
> >  	depends on ISA || COMPILE_TEST
> >  	depends on ISA_DMA_API
> > +	depends on HAS_IOPORT
> >  	default y
> >  	help
> >  	  Support for sound devices connected via the ISA bus.
> 
> With this dependency, ...
> 
> > @@ -31,6 +32,7 @@ if SND_ISA
> >  
> >  config SND_ADLIB
> >  	tristate "AdLib FM card"
> > +	depends on HAS_IOPORT
> >  	select SND_OPL3_LIB
> >  	help
> >  	  Say Y here to include support for AdLib FM cards.
> 
> ... this and lots of other similar changes become redundant, as they
> already depend on CONFIG_SND_ISA.
> 

Good point and semantically it makes sense too since ISA is closely
associated with I/O ports.

> > --- a/sound/pcmcia/Kconfig
> > +++ b/sound/pcmcia/Kconfig
> > @@ -13,6 +13,7 @@ if SND_PCMCIA && PCMCIA
> >  config SND_VXPOCKET
> >  	tristate "Digigram VXpocket"
> >  	select SND_VX_LIB
> > +	depends on HAS_IOPORT
> >  	help
> >  	  Say Y here to include support for Digigram VXpocket and
> >  	  VXpocket 440 soundcards.
> > @@ -22,6 +23,7 @@ config SND_VXPOCKET
> >  
> >  config SND_PDAUDIOCF
> >  	tristate "Sound Core PDAudioCF"
> > +	depends on HAS_IOPORT
> >  	select SND_PCM
> >  	help
> >  	  Say Y here to include support for Sound Core PDAudioCF
> 
> I guess it's easier to make CONFIG_SND_PCMCIA depending on
> CONFIG_HAS_IOPORT (like done for CONFIG_SND_ISA).
> 

In principle I think there could be a MMIO based PCMCIA sound card but
it appears there is none currently supported and I doubt someone adds
one so yeah that makes sense even if it isn't as clear cut as with
CONFIG_SND_ISA.

I've changed both vor v4. Thanks!

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 35/38] video: handle HAS_IOPORT dependencies
  2023-03-23 16:08         ` Ville Syrjälä
@ 2023-05-08 17:09           ` Niklas Schnelle
  0 siblings, 0 replies; 110+ messages in thread
From: Niklas Schnelle @ 2023-05-08 17:09 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: Geert Uytterhoeven, linux-arch, Arnd Bergmann, linux-fbdev,
	Albert Ou, Arnd Bergmann, Rafael J. Wysocki, Greg Kroah-Hartman,
	Helge Deller, Paul Walmsley, linux-pci, linux-kernel, dri-devel,
	Alan Stern, Uwe Kleine-König, Bjorn Helgaas, Palmer Dabbelt,
	Mauro Carvalho Chehab

On Thu, 2023-03-23 at 18:08 +0200, Ville Syrjälä wrote:
> On Thu, Mar 23, 2023 at 03:17:38PM +0100, Niklas Schnelle wrote:
> > On Wed, 2023-03-15 at 12:19 +0200, Ville Syrjälä wrote:
> > > On Wed, Mar 15, 2023 at 09:16:50AM +0100, Geert Uytterhoeven wrote:
> > > > Hi Niklas,
> > > > 
> > > > On Tue, Mar 14, 2023 at 1:13 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 and guard inline code in headers.
> > > > > 
> > > > > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > > > > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > > > 
> > > > Thanks for your patch!
> > > > 
> > > > > --- a/drivers/video/fbdev/Kconfig
> > > > > +++ b/drivers/video/fbdev/Kconfig
> > > > 
> > > > > @@ -1284,7 +1285,7 @@ config FB_ATY128_BACKLIGHT
> > > > > 
> > > > >  config FB_ATY
> > > > >         tristate "ATI Mach64 display support" if PCI || ATARI
> > > > > -       depends on FB && !SPARC32
> > > > > +       depends on FB && HAS_IOPORT && !SPARC32
> > > > 
> > > > On Atari, this works without ATARI_ROM_ISA, hence it must not depend
> > > > on HAS_IOPORT.
> > > > The only call to inb() is inside a section protected by #ifdef
> > > > CONFIG_PCI. So:
> > > 
> > > That piece of code is a nop anyway. We immediately overwrite
> > > clk_wr_offset with a hardcoded selection after the register reads.
> > > So if you nuke that nop code then no IOPORT dependency required
> > > at all.
> > > 
> > 
> > I agree this "looks" like a nop but are we sure the inb() doesn't have
> > side effects? 
> 
> Yes. It's just trying to check which PLL dividers/etc. are currently
> used. In VGA mode it gets it from a the GENMO and in non-VGA mode from
> CLOCK_CNTL. And then it says "screw that" and just uses index 3 instead.
> 

Ok, I've added a patch to remove this part of the code and with that
the driver actually builds on s390 (no HAS_IOPORT) so I also removed
the HAS_IOPORT dependency. Both will be in my v4.

Thanks,
Niklas



^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 28/38] rtc: add HAS_IOPORT dependencies
  2023-05-08 15:36     ` Niklas Schnelle
@ 2023-05-08 20:01       ` Arnd Bergmann
  2023-05-09  6:38         ` Geert Uytterhoeven
  0 siblings, 1 reply; 110+ messages in thread
From: Arnd Bergmann @ 2023-05-08 20:01 UTC (permalink / raw)
  To: Niklas Schnelle, Alexandre Belloni
  Cc: Alessandro Zummo, Greg Kroah-Hartman, Bjorn Helgaas,
	Uwe Kleine-König, Mauro Carvalho Chehab, Alan Stern,
	Rafael J . Wysocki, Geert Uytterhoeven, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, linux-kernel, Linux-Arch, linux-pci,
	Arnd Bergmann, linux-rtc

On Mon, May 8, 2023, at 17:36, Niklas Schnelle wrote:
> On Tue, 2023-03-14 at 13:52 +0100, Alexandre Belloni wrote:
>> Hello,
>> 
>> On 14/03/2023 13:12:06+0100, Niklas Schnelle 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/rtc/Kconfig | 4 +++-
>> >  1 file changed, 3 insertions(+), 1 deletion(-)
>> > 
>> > diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
>> > index 5a71579af0a1..20aa77bf0a9f 100644
>> > --- a/drivers/rtc/Kconfig
>> > +++ b/drivers/rtc/Kconfig
>> > @@ -956,6 +956,7 @@ comment "Platform RTC drivers"
>> >  config RTC_DRV_CMOS
>> >  	tristate "PC-style 'CMOS'"
>> >  	depends on X86 || ARM || PPC || MIPS || SPARC64
>> > +	depends on HAS_IOPORT
>> 
>> Did you check that this will not break platforms that doesn't have RTC_PORT defined?
>> > 
>
> From what I can tell the CMOS_READ() macro this driver relies on uses
> some form of inb() style I/O port access in all its definitions. So my
> understanding is that this device is always accessed via I/O ports even
> if the variants differ slightly and would make no sense on a platform
> without any way of accessing I/O ports which is what lack of HAS_IOPORT
> means. From what I can see even without RTC_PORT being defined the
> CMOS_READ is still used. Hope that answers your question?

I think the m68k/atari and mips/dec variants don't necessarily
qualify as PIO, those are really just pointer dereferences, and
they don't use the actual inb/outb functions.

On atari, it looks like HAS_IOPORT may be set if ATARI_ROM_ISA
is, but on dec it's never enabled.

    Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 28/38] rtc: add HAS_IOPORT dependencies
  2023-05-08 20:01       ` Arnd Bergmann
@ 2023-05-09  6:38         ` Geert Uytterhoeven
  2023-05-09  8:22           ` Arnd Bergmann
  0 siblings, 1 reply; 110+ messages in thread
From: Geert Uytterhoeven @ 2023-05-09  6:38 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Niklas Schnelle, Alexandre Belloni, Alessandro Zummo,
	Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-kernel,
	Linux-Arch, linux-pci, Arnd Bergmann, linux-rtc, linux-m68k

Hi Arnd,

On Mon, May 8, 2023 at 10:01 PM Arnd Bergmann <arnd@arndb.de> wrote:
> On Mon, May 8, 2023, at 17:36, Niklas Schnelle wrote:
> > On Tue, 2023-03-14 at 13:52 +0100, Alexandre Belloni wrote:
> >> On 14/03/2023 13:12:06+0100, Niklas Schnelle 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/rtc/Kconfig | 4 +++-
> >> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> >> > index 5a71579af0a1..20aa77bf0a9f 100644
> >> > --- a/drivers/rtc/Kconfig
> >> > +++ b/drivers/rtc/Kconfig
> >> > @@ -956,6 +956,7 @@ comment "Platform RTC drivers"
> >> >  config RTC_DRV_CMOS
> >> >    tristate "PC-style 'CMOS'"
> >> >    depends on X86 || ARM || PPC || MIPS || SPARC64
> >> > +  depends on HAS_IOPORT
> >>
> >> Did you check that this will not break platforms that doesn't have RTC_PORT defined?
> >> >
> >
> > From what I can tell the CMOS_READ() macro this driver relies on uses
> > some form of inb() style I/O port access in all its definitions. So my
> > understanding is that this device is always accessed via I/O ports even
> > if the variants differ slightly and would make no sense on a platform
> > without any way of accessing I/O ports which is what lack of HAS_IOPORT
> > means. From what I can see even without RTC_PORT being defined the
> > CMOS_READ is still used. Hope that answers your question?
>
> I think the m68k/atari and mips/dec variants don't necessarily
> qualify as PIO, those are really just pointer dereferences, and
> they don't use the actual inb/outb functions.
>
> On atari, it looks like HAS_IOPORT may be set if ATARI_ROM_ISA
> is, but on dec it's never enabled.

Atari does not use RTC_DRV_CMOS, but still relies on generic RTC
instead.

Last time (in 2013?) I tried converting to RTC_DRV_CMOS by registering
an "rtc_cmos" platform device, I couldn't get it to work.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 28/38] rtc: add HAS_IOPORT dependencies
  2023-05-09  6:38         ` Geert Uytterhoeven
@ 2023-05-09  8:22           ` Arnd Bergmann
  2023-05-09  8:51             ` Geert Uytterhoeven
  0 siblings, 1 reply; 110+ messages in thread
From: Arnd Bergmann @ 2023-05-09  8:22 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Niklas Schnelle, Alexandre Belloni, Alessandro Zummo,
	Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-kernel,
	Linux-Arch, linux-pci, Arnd Bergmann, linux-rtc, linux-m68k

On Tue, May 9, 2023, at 08:38, Geert Uytterhoeven wrote:
> On Mon, May 8, 2023 at 10:01 PM Arnd Bergmann <arnd@arndb.de> wrote:
>> On Mon, May 8, 2023, at 17:36, Niklas Schnelle wrote:
>>
>> I think the m68k/atari and mips/dec variants don't necessarily
>> qualify as PIO, those are really just pointer dereferences, and
>> they don't use the actual inb/outb functions.
>>
>> On atari, it looks like HAS_IOPORT may be set if ATARI_ROM_ISA
>> is, but on dec it's never enabled.
>
> Atari does not use RTC_DRV_CMOS, but still relies on generic RTC
> instead.

Ah right, I now remember working on that code, so we're good on
m68k then. I think it should work for everyone using

       depends on HAS_IOPORT || ARCH_DECSTATION

in that case, as that is the only exception.

> Last time (in 2013?) I tried converting to RTC_DRV_CMOS by registering
> an "rtc_cmos" platform device, I couldn't get it to work.

If you ever want to revisit this, I suspect the harder part here
is to detach arch/m68k/ from the RTC_DRV_GENERIC code first, pushing
the device registration into the individual machine specific time.c
code. It's probably not even worth trying to share the rtc-cmos
driver, but it might be useful to share the library code like
RTC_DRV_ALPHA does.

   Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 28/38] rtc: add HAS_IOPORT dependencies
  2023-05-09  8:22           ` Arnd Bergmann
@ 2023-05-09  8:51             ` Geert Uytterhoeven
  2023-05-09  9:46               ` Arnd Bergmann
  0 siblings, 1 reply; 110+ messages in thread
From: Geert Uytterhoeven @ 2023-05-09  8:51 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Niklas Schnelle, Alexandre Belloni, Alessandro Zummo,
	Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-kernel,
	Linux-Arch, linux-pci, Arnd Bergmann, linux-rtc, linux-m68k

Hi Arnd,

On Tue, May 9, 2023 at 10:23 AM Arnd Bergmann <arnd@arndb.de> wrote:
> On Tue, May 9, 2023, at 08:38, Geert Uytterhoeven wrote:
> > On Mon, May 8, 2023 at 10:01 PM Arnd Bergmann <arnd@arndb.de> wrote:
> >> On Mon, May 8, 2023, at 17:36, Niklas Schnelle wrote:
> >>
> >> I think the m68k/atari and mips/dec variants don't necessarily
> >> qualify as PIO, those are really just pointer dereferences, and
> >> they don't use the actual inb/outb functions.
> >>
> >> On atari, it looks like HAS_IOPORT may be set if ATARI_ROM_ISA
> >> is, but on dec it's never enabled.
> >
> > Atari does not use RTC_DRV_CMOS, but still relies on generic RTC
> > instead.
>
> Ah right, I now remember working on that code, so we're good on
> m68k then. I think it should work for everyone using
>
>        depends on HAS_IOPORT || ARCH_DECSTATION
>
> in that case, as that is the only exception.
>
> > Last time (in 2013?) I tried converting to RTC_DRV_CMOS by registering
> > an "rtc_cmos" platform device, I couldn't get it to work.
>
> If you ever want to revisit this, I suspect the harder part here
> is to detach arch/m68k/ from the RTC_DRV_GENERIC code first, pushing
> the device registration into the individual machine specific time.c
> code. It's probably not even worth trying to share the rtc-cmos
> driver, but it might be useful to share the library code like
> RTC_DRV_ALPHA does.

Arch/m68k is not that entangled with RTC_DRV_GENERIC, as amiga_defconfig
does not enable it, but enables CONFIG_RTC_DRV_MSM6242 and
CONFIG_RTC_DRV_RP5C01 instead.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v3 28/38] rtc: add HAS_IOPORT dependencies
  2023-05-09  8:51             ` Geert Uytterhoeven
@ 2023-05-09  9:46               ` Arnd Bergmann
  0 siblings, 0 replies; 110+ messages in thread
From: Arnd Bergmann @ 2023-05-09  9:46 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Niklas Schnelle, Alexandre Belloni, Alessandro Zummo,
	Greg Kroah-Hartman, Bjorn Helgaas, Uwe Kleine-König,
	Mauro Carvalho Chehab, Alan Stern, Rafael J . Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-kernel,
	Linux-Arch, linux-pci, Arnd Bergmann, linux-rtc, linux-m68k

On Tue, May 9, 2023, at 10:51, Geert Uytterhoeven wrote:
> On Tue, May 9, 2023 at 10:23 AM Arnd Bergmann <arnd@arndb.de> wrote:
>> On Tue, May 9, 2023, at 08:38, Geert Uytterhoeven wrote:
>> If you ever want to revisit this, I suspect the harder part here
>> is to detach arch/m68k/ from the RTC_DRV_GENERIC code first, pushing
>> the device registration into the individual machine specific time.c
>> code. It's probably not even worth trying to share the rtc-cmos
>> driver, but it might be useful to share the library code like
>> RTC_DRV_ALPHA does.
>
> Arch/m68k is not that entangled with RTC_DRV_GENERIC, as amiga_defconfig
> does not enable it, but enables CONFIG_RTC_DRV_MSM6242 and
> CONFIG_RTC_DRV_RP5C01 instead.

Ah, I see now, I misremembered this part. The only bit that
is shared on m68k is the mach_hwclk() function that is used
for either read_persistent_clock64() or rtc_generic on platforms
that have one. So any platform could indeed be converted from
mach_hwclk() to a custom rtc driver without affecting the others.

    Arnd

^ permalink raw reply	[flat|nested] 110+ messages in thread

end of thread, other threads:[~2023-05-09  9:46 UTC | newest]

Thread overview: 110+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 12:11 [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 01/38] Kconfig: introduce HAS_IOPORT option and select it as necessary Niklas Schnelle
2023-03-14 12:37   ` Johannes Berg
2023-03-23 13:23     ` Niklas Schnelle
2023-03-14 12:48   ` Geert Uytterhoeven
2023-03-14 13:29   ` Arnd Bergmann
2023-03-14 16:11     ` Niklas Schnelle
2023-03-14 16:37   ` Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 02/38] ata: add HAS_IOPORT dependencies Niklas Schnelle
2023-03-15  1:23   ` Damien Le Moal
2023-03-15  6:46     ` Arnd Bergmann
2023-03-15  7:15       ` Damien Le Moal
2023-03-15  7:15   ` Damien Le Moal
2023-03-15  8:39   ` Geert Uytterhoeven
2023-03-15  9:12     ` Damien Le Moal
2023-03-15 11:36       ` Geert Uytterhoeven
2023-03-15 23:57         ` Damien Le Moal
2023-03-16 15:21           ` Arnd Bergmann
2023-04-28 13:32             ` Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 03/38] char: impi, tpm: depend on HAS_IOPORT Niklas Schnelle
2023-03-14 12:20   ` Jarkko Sakkinen
2023-03-14 14:01     ` Arnd Bergmann
2023-03-14 13:52   ` Corey Minyard
2023-03-14 14:17   ` Geert Uytterhoeven
2023-03-14 15:08     ` Arnd Bergmann
2023-03-21 14:33   ` Jason Gunthorpe
2023-03-14 12:11 ` [PATCH v3 04/38] comedi: add HAS_IOPORT dependencies Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 05/38] counter: " Niklas Schnelle
2023-03-14 12:41   ` William Breathitt Gray
2023-04-28 13:27     ` Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 06/38] /dev/port: don't compile file operations without CONFIG_DEVPORT Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 07/38] drm: handle HAS_IOPORT dependencies Niklas Schnelle
2023-03-15 11:54   ` Jani Nikula
2023-03-23 15:05     ` Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 08/38] firmware: dmi-sysfs: handle HAS_IOPORT=n Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 09/38] gpio: add HAS_IOPORT dependencies Niklas Schnelle
2023-03-15  8:42   ` Linus Walleij
2023-04-28 14:41     ` Niklas Schnelle
2023-05-01 12:29       ` Linus Walleij
2023-03-14 12:11 ` [PATCH v3 10/38] hwmon: " Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 11/38] i2c: " Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 12/38] iio: ad7606: Kconfig: " Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 13/38] Input: " Niklas Schnelle
2023-03-15  8:22   ` Geert Uytterhoeven
2023-04-28 14:50     ` Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 14/38] Input: gameport: add ISA and " Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 15/38] leds: add " Niklas Schnelle
2023-03-16 16:14   ` Lee Jones
2023-03-23 12:42     ` Niklas Schnelle
2023-03-23 13:32       ` Arnd Bergmann
2023-03-23 14:02         ` Niklas Schnelle
2023-03-23 14:05           ` Arnd Bergmann
2023-03-23 16:11         ` Geert Uytterhoeven
2023-03-23 16:25           ` Arnd Bergmann
2023-03-23 14:53       ` Lee Jones
2023-03-23 15:33         ` Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 16/38] media: " Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 17/38] misc: " Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 18/38] mISDN: " Niklas Schnelle
2023-03-15  5:41   ` Jakub Kicinski
2023-03-14 12:11 ` [PATCH v3 19/38] mpt fusion: " Niklas Schnelle
2023-03-14 12:11 ` [PATCH v3 20/38] net: handle " Niklas Schnelle
2023-03-15  5:41   ` Jakub Kicinski
2023-03-15  9:47   ` Maciej W. Rozycki
2023-03-14 12:11 ` [PATCH v3 21/38] parport: PC style parport depends on HAS_IOPORT Niklas Schnelle
2023-03-14 14:12   ` Arnd Bergmann
2023-05-02 13:40     ` Niklas Schnelle
2023-05-02 15:30   ` Bjorn Helgaas
2023-03-14 12:12 ` [PATCH v3 22/38] PCI: Make quirk using inw() depend " Niklas Schnelle
2023-03-14 12:12 ` [PATCH v3 23/38] PCI/sysfs: Make I/O resource " Niklas Schnelle
2023-03-14 16:05   ` Bjorn Helgaas
2023-03-14 12:12 ` [PATCH v3 24/38] pcmcia: add HAS_IOPORT dependencies Niklas Schnelle
2023-03-14 12:12 ` [PATCH v3 25/38] platform: " Niklas Schnelle
2023-03-15  2:21   ` Tzung-Bi Shih
2023-03-14 12:12 ` [PATCH v3 26/38] pnp: " Niklas Schnelle
2023-03-20 17:37   ` Rafael J. Wysocki
2023-03-21 13:56     ` Rafael J. Wysocki
2023-03-23 12:55       ` Niklas Schnelle
2023-03-24 18:45         ` Wysocki, Rafael J
2023-03-14 12:12 ` [PATCH v3 27/38] power: " Niklas Schnelle
2023-03-29 23:01   ` Sebastian Reichel
2023-03-14 12:12 ` [PATCH v3 28/38] rtc: " Niklas Schnelle
2023-03-14 12:52   ` Alexandre Belloni
2023-05-08 15:36     ` Niklas Schnelle
2023-05-08 20:01       ` Arnd Bergmann
2023-05-09  6:38         ` Geert Uytterhoeven
2023-05-09  8:22           ` Arnd Bergmann
2023-05-09  8:51             ` Geert Uytterhoeven
2023-05-09  9:46               ` Arnd Bergmann
2023-03-14 12:12 ` [PATCH v3 29/38] scsi: " Niklas Schnelle
2023-03-14 12:12 ` [PATCH v3 30/38] sound: " Niklas Schnelle
2023-03-14 12:33   ` Takashi Iwai
2023-05-08 16:41     ` Niklas Schnelle
2023-03-14 12:12 ` [PATCH v3 31/38] speakup: add HAS_IOPORT dependency for SPEAKUP_SERIALIO Niklas Schnelle
2023-03-14 12:12 ` [PATCH v3 32/38] staging: add HAS_IOPORT dependencies Niklas Schnelle
2023-03-14 12:12 ` [PATCH v3 33/38] tty: serial: handle " Niklas Schnelle
2023-03-14 12:12 ` [PATCH v3 34/38] usb: " Niklas Schnelle
2023-03-14 14:56   ` Arnd Bergmann
2023-03-14 12:12 ` [PATCH v3 35/38] video: " Niklas Schnelle
2023-03-15  8:16   ` Geert Uytterhoeven
2023-03-15 10:19     ` Ville Syrjälä
2023-03-23 14:17       ` Niklas Schnelle
2023-03-23 16:08         ` Ville Syrjälä
2023-05-08 17:09           ` Niklas Schnelle
2023-03-14 12:12 ` [PATCH v3 36/38] watchdog: add " Niklas Schnelle
2023-03-14 14:21   ` Guenter Roeck
2023-03-14 12:12 ` [PATCH v3 37/38] wireless: " Niklas Schnelle
2023-03-15  5:26   ` Kalle Valo
2023-03-14 12:12 ` [PATCH v3 38/38] asm-generic/io.h: drop inb() etc for HAS_IOPORT=n Niklas Schnelle
2023-03-14 14:05 ` [PATCH v3 00/38] Kconfig: Introduce HAS_IOPORT config option Arnd Bergmann

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).