Skip to content

treewide: Remove I/O port accessors for HAS_IOPORT=n

Niklas Schnelle alsa-devel chrome-platform dri-devel intel-wired-lan linux-acpi linux-arch linux-can linux-fbdev linux-gpio linux-hams linux-hwmon linux-i2c linux-ide linux-iio linux-input linux-integrity linux-leds linux-m68k linux-media linux-pci linux-pm linux-rtc linux-scsi linux-serial linux-staging linux-usb linux-watchdog linux-wireless lkml netdev virtualization 2 versions – Applied

Status from this message: Applied, thanks

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest44 patches 40 repliesApplied
  2. v441 patches 46 repliesApplied

Changes from v3 from the cover letter

- Rebased on v6.4-rc2 which includes the Kconfig HAS_IOPORT option
- Fixed some wrong #ifdef HAS_IOPORT to #ifdef CONFIG_HAS_IOPORT
- Split the usb subsystem patch into 3 parts (Arnd)
- Removed unneeded HAS_IOPORT dependency for SERIO_PARKBD (Geert Uytterhoeven)
- Removed no-op I/O access from FB_ATY (Ville Syrjälä)
- Simplified HAS_IOPORT dependencies for the sound subsystem (Takashi Iwai)
- Slightly reworded the subject line of the last patch which removes the I/O port accessor functions.

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/44kgdb: add HAS_IOPORT dependencylib/Kconfig.kgdb+1 -00 replies
2/44ata: add HAS_IOPORT dependenciesdrivers/ata/Kconfig drivers/ata/libata-sff.c+18 -141 reply
3/44char: add HAS_IOPORT dependenciesdrivers/char/Kconfig+2 -11 reply
4/44char: ipmi: handle HAS_IOPORT dependenciesdrivers/char/ipmi/Makefile drivers/char/ipmi/ipmi_si_intf.c drivers/char/ipmi/ipmi_si_pci.c+9 -80 replies
5/44char: tpm: handle HAS_IOPORT dependenciesdrivers/char/tpm/Kconfig drivers/char/tpm/tpm_infineon.c drivers/char/tpm/tpm_tis_core.c+21 -152 replies
6/44comedi: add HAS_IOPORT dependenciesdrivers/comedi/Kconfig+68 -350 replies
7/44counter: add HAS_IOPORT_MAP dependencydrivers/counter/Kconfig+1 -02 replies
8/44/dev/port: don't compile file operations without CONFIG_DEVPORTdrivers/char/mem.c+5 -10 replies
9/44drm: handle HAS_IOPORT dependenciesdrivers/gpu/drm/qxl/Kconfig drivers/gpu/drm/tiny/bochs.c drivers/gpu/drm/tiny/cirrus.c+20 -03 replies
10/44firmware: dmi-sysfs: handle HAS_IOPORT=ndrivers/firmware/dmi-sysfs.c+4 -00 replies
11/44gpio: add HAS_IOPORT dependenciesdrivers/gpio/Kconfig+13 -131 reply
12/44hwmon: add HAS_IOPORT dependenciesdrivers/hwmon/Kconfig+18 -30 replies
13/44i2c: add HAS_IOPORT dependenciesdrivers/i2c/busses/Kconfig+17 -142 replies
14/44iio: ad7606: Kconfig: add HAS_IOPORT dependenciesdrivers/iio/adc/Kconfig+1 -12 replies
15/44Input: add HAS_IOPORT dependenciesdrivers/input/serio/Kconfig drivers/input/touchscreen/Kconfig+2 -00 replies
16/44Input: gameport: add ISA and HAS_IOPORT dependenciesdrivers/input/gameport/Kconfig include/linux/gameport.h+10 -31 reply
17/44leds: add HAS_IOPORT dependenciesdrivers/leds/Kconfig+1 -11 reply
18/44media: add HAS_IOPORT dependenciesdrivers/media/pci/dm1105/Kconfig drivers/media/radio/Kconfig drivers/media/rc/Kconfig+20 -20 replies
19/44misc: add HAS_IOPORT dependenciesdrivers/misc/altera-stapl/Makefile drivers/misc/altera-stapl/altera.c+7 -20 replies
20/44mISDN: add HAS_IOPORT dependenciesdrivers/isdn/Kconfig drivers/isdn/hardware/mISDN/Kconfig+6 -70 replies
21/44mpt fusion: add HAS_IOPORT dependenciesdrivers/message/fusion/Kconfig+1 -10 replies
22/44net: handle HAS_IOPORT dependenciesdrivers/net/Kconfig drivers/net/arcnet/Kconfig drivers/net/can/cc770/Kconfig +15 more+25 -220 replies
23/44parport: PC style parport depends on HAS_IOPORTdrivers/parport/Kconfig include/linux/parport.h+3 -20 replies
24/44PCI: Make quirk using inw() depend on HAS_IOPORTdrivers/pci/quirks.c+2 -00 replies
25/44PCI/sysfs: Make I/O resource depend on HAS_IOPORTdrivers/pci/pci-sysfs.c+4 -00 replies
26/44pcmcia: add HAS_IOPORT dependenciesdrivers/pcmcia/Kconfig+2 -30 replies
27/44platform: add HAS_IOPORT dependenciesdrivers/platform/chrome/Kconfig drivers/platform/chrome/wilco_ec/Kconfig+2 -00 replies
28/44pnp: add HAS_IOPORT dependenciesdrivers/pnp/isapnp/Kconfig+1 -11 reply
29/44power: add HAS_IOPORT dependenciesdrivers/power/reset/Kconfig+1 -00 replies
30/44rtc: add HAS_IOPORT dependenciesdrivers/rtc/Kconfig+3 -15 replies
31/44scsi: add HAS_IOPORT dependenciesdrivers/scsi/Kconfig drivers/scsi/aic7xxx/Kconfig.aic79xx drivers/scsi/aic7xxx/Kconfig.aic7xxx +5 more+26 -213 replies
32/44sound: add HAS_IOPORT dependenciessound/drivers/Kconfig sound/isa/Kconfig sound/pci/Kconfig +1 more+39 -114 replies
33/44speakup: add HAS_IOPORT dependency for SPEAKUP_SERIALIOdrivers/accessibility/speakup/Kconfig+1 -00 replies
34/44staging: add HAS_IOPORT dependenciesdrivers/staging/sm750fb/Kconfig drivers/staging/vt6655/Kconfig+2 -20 replies
35/44tty: serial: handle HAS_IOPORT dependenciesdrivers/tty/Kconfig drivers/tty/serial/8250/8250_early.c drivers/tty/serial/8250/8250_pci.c +3 more+60 -131 reply
36/44usb: add HAS_IOPORT dependenciesdrivers/usb/host/Kconfig+2 -20 replies
37/44usb: uhci: handle HAS_IOPORT dependenciesdrivers/usb/host/uhci-hcd.c drivers/usb/host/uhci-hcd.h+18 -81 reply
38/44usb: pci-quirks: handle HAS_IOPORT dependenciesdrivers/usb/Kconfig drivers/usb/core/hcd-pci.c drivers/usb/host/pci-quirks.c +1 more+101 -661 reply
39/44vgacon: add HAS_IOPORT dependenciesdrivers/video/console/Kconfig+1 -00 replies
40/44fbdev: add HAS_IOPORT dependenciesdrivers/video/fbdev/Kconfig+12 -110 replies
41/44video: Handle HAS_IOPORT dependenciesdrivers/video/fbdev/Kconfig include/video/vga.h+27 -110 replies
42/44watchdog: add HAS_IOPORT dependenciesdrivers/watchdog/Kconfig+4 -20 replies
43/44wireless: add HAS_IOPORT dependenciesdrivers/net/wireless/atmel/Kconfig drivers/net/wireless/intersil/hostap/Kconfig+2 -23 replies
44/44asm-generic/io.h: Remove I/O port accessors for HAS_IOPORT=ninclude/asm-generic/io.h+60 -00 replies

Reviews trailers per patch

22 of 44 patches have a Reviewed-by or Acked-by.

PatchMarc Kleine-BuddeJakub KicinskiMaciej W. RozyckiTzung-Bi ShihDamien Le MoalCorey MinyardLinus WalleijPavel MachekBjorn HelgaasSean YoungGuenter RoeckSebastian ReichelJonathan CameronRafael J. WysockiKalle ValoSamuel ThibaultJaroslav KyselaTakashi IwaiAlan SternJarkko SakkinenGreg Kroah-Hartman
1/44
2/44A-b A-b
3/44
4/44A-b
5/44R-b A-b
6/44
7/44
8/44
9/44
10/44
11/44R-b
12/44A-b
13/44
14/44A-b
15/44
16/44
17/44A-b
18/44R-b
19/44
20/44A-b
21/44
22/44A-b A-b A-b
23/44
24/44A-b
25/44A-b
26/44
27/44A-b
28/44A-b A-b
29/44A-b
30/44A-b
31/44
32/44A-b R-b
33/44R-b
34/44
35/44A-b
36/44
37/44R-b
38/44
39/44
40/44
41/44
42/44A-b
43/44A-b
44/44

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 21 reviewers.

Read the v5 thread

Cover letter [PATCH v5 00/44] treewide: Remove I/O port accessors for HAS_IOPORT=n

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 does exactly that by utilizing the HAS_IOPORT Kconfig option introduced in v6.4-rc1 via the spun out first patch[1] of a previous version. With the final patch of this series HAS_IOPORT=n means that inb()/outb() and friends are not 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"). With the HAS_IOPORT Kconfig option merged already per-subsystem patches can now also be merged independently and only the last patch needs to wait.

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

A few patches have already been applied but I've kept those which are not yet in v6.4-rc3.

This version is based on v6.4-rc3 and is also available on my kernel.org tree in the has_ioport_v5:

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

Thanks,
Niklas Schnelle

Changes froom v4:
- Rebased on v6.4-rc3
- ata: Moved #ifdef CONFIG_PATA_ALI into ata_pci_bmdma_clear_simplex() (Damien Le Moal)
- char: Fixed ipmi typo and split the char subsystem patch into 3 parts for char, tpm, and ipmi (Greg K-H)
- rtc: Added missing "|| MACH_DECSTATION" (Maciej W. Rozycki)
- usb: Made UHCI_OUT() empty variant "do {} while (0)" and removed unneeded unconditional UHCI_IN() / UHCI_OUT() uses (Arnd, Alan Stern, Greg K-H)
- usb: pci-quirks: Added missing USB_PCI dependency
- video: Split into vgacon and fbdev patches
- Removed atyfb patch as it was merged in v6.4-rc3

Changes from v3:
- Rebased on v6.4-rc2 which includes the Kconfig HAS_IOPORT option
- Fixed some wrong #ifdef HAS_IOPORT to #ifdef CONFIG_HAS_IOPORT
- Split the usb subsystem patch into 3 parts (Arnd)
- Removed unneeded HAS_IOPORT dependency for SERIO_PARKBD (Geert Uytterhoeven)
- Removed no-op I/O access from FB_ATY (Ville Syrjälä)
- Simplified HAS_IOPORT dependencies for the sound subsystem (Takashi Iwai)
- Slightly reworded the subject line of the last patch which removes the I/O port accessor functions.

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/[email protected]/
[2] https://lore.kernel.org/lkml/CAK8P3a0MNbx-iuzW_-=0ab6-TTZzwV-PT_6gAC1Gp5PgYyHcrA@mail.gmail.com/
[3] https://yhbt.net/lore/all/[email protected]/
[4] https://lore.kernel.org/all/[email protected]/
[5] https://lore.kernel.org/lkml/[email protected]/
[6] https://lore.kernel.org/all/[email protected]/

Niklas Schnelle (44):
kgdb: add HAS_IOPORT dependency
ata: add HAS_IOPORT dependencies
char: add HAS_IOPORT dependencies
char: ipmi: handle HAS_IOPORT dependencies
char: tpm: handle HAS_IOPORT dependencies
comedi: add HAS_IOPORT dependencies
counter: add HAS_IOPORT_MAP dependency
/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: add HAS_IOPORT dependencies
usb: uhci: handle HAS_IOPORT dependencies
usb: pci-quirks: handle HAS_IOPORT dependencies
vgacon: add HAS_IOPORT dependencies
fbdev: add HAS_IOPORT dependencies
video: Handle HAS_IOPORT dependencies
watchdog: add HAS_IOPORT dependencies
wireless: add HAS_IOPORT dependencies asm-generic/io.h: Remove I/O port accessors for HAS_IOPORT=n

 drivers/accessibility/speakup/Kconfig        |   1 +
 drivers/ata/Kconfig                          |  28 ++---
 drivers/ata/libata-sff.c                     |   4 +
 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/tpm/Kconfig                     |   1 +
 drivers/char/tpm/tpm_infineon.c              |  16 ++-
 drivers/char/tpm/tpm_tis_core.c              |  19 ++-
 drivers/comedi/Kconfig                       | 103 +++++++++------
 drivers/counter/Kconfig                      |   1 +
 drivers/firmware/dmi-sysfs.c                 |   4 +
 drivers/gpio/Kconfig                         |  26 ++--
 drivers/gpu/drm/qxl/Kconfig                  |   1 +
 drivers/gpu/drm/tiny/bochs.c                 |  17 +++
 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                  |   1 +
 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/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                      |   3 +-
 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                          |   4 +-
 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/Kconfig                          |  10 ++
 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                |  30 +++--
 drivers/usb/host/uhci-hcd.c                  |   2 +-
 drivers/usb/host/uhci-hcd.h                  |  24 ++--
 drivers/video/console/Kconfig                |   1 +
 drivers/video/fbdev/Kconfig                  |  22 ++--
 drivers/watchdog/Kconfig                     |   6 +-
 include/asm-generic/io.h                     |  60 +++++++++
 include/linux/gameport.h                     |   9 +-
 include/linux/parport.h                      |   2 +-
 include/video/vga.h                          |  35 ++++--
 lib/Kconfig.kgdb                             |   1 +
 net/ax25/Kconfig                             |   2 +-
 sound/drivers/Kconfig                        |   3 +
 sound/isa/Kconfig                            |   1 +
 sound/pci/Kconfig                            |  45 +++++--
 sound/pcmcia/Kconfig                         |   1 +
 97 files changed, 641 insertions(+), 297 deletions(-)

base-commit: 44c026a73be8038f03dbdeef028b642880cf1511

Signature · 1 line
2.39.2