In a future patch HAS_IOPORT=n will disable inb()/outb() and friends at
compile time. We thus need to add this dependency and ifdef sections of
code using inb()/outb() as alternative access methods.
Acked-by: Corey Minyard <cminyard@mvista.com>
Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Message-Id: <
20240404104506.
3352637-2-schnelle@linux.ibm.com>
Signed-off-by: Corey Minyard <minyard@acm.org>
 
 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
 
        }
 
        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;
 
        }
 
        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 {