Re: [PATCH 05/13] comedi: 8255_pci: Conditionally remove devices that use port I/O

From: Ian Abbott
Date: Wed Sep 13 2023 - 11:04:50 EST


On 13/09/2023 13:03, Arnd Bergmann wrote:
On Wed, Sep 13, 2023, at 13:20, Ian Abbott wrote:
In a future patch, the port I/O functions (`inb()`, `outb()`, and
friends will only be declared in the `HAS_IOPORT` configuration option
is enabled.

The 8255_pci module supports PCI digital I/O devices from various
manufacturers that consist of one or more 8255 Programmable Peripheral
Interface chips (or equivalent hardware) to provide their digital I/O
ports. Some of the devices use port I/O and some only use memory-mapped
I/O.

Conditionally compile in support for the devices that need port I/O if
and only if the `CONFIG_HAS_PORTIO` macro is defined. Change
`pci_8255_auto_attach()` to return an error if the device actually
requires port I/O (based on the PCI BAR resource flags) but the
`HAS_IOPORT` configuration is not enabled.

Cc: Arnd Bergmann <arnd@xxxxxxxxxx>
Cc: Niklas Schnelle <schnelle@xxxxxxxxxxxxx>
Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
---
drivers/comedi/drivers/8255_pci.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/comedi/drivers/8255_pci.c
b/drivers/comedi/drivers/8255_pci.c
index 0fec048e3a53..4c4c0ef1db05 100644
--- a/drivers/comedi/drivers/8255_pci.c
+++ b/drivers/comedi/drivers/8255_pci.c
@@ -57,6 +57,7 @@
#include <linux/comedi/comedi_8255.h>

enum pci_8255_boardid {
+#ifdef CONFIG_HAS_PORTIO

I think this is a typo: HAS_IOPORT vs HAS_PORTIO?

Arnd

Oops! Well-spotted. Actually, this affects several of the patches!

--
-=( Ian Abbott <abbotti@xxxxxxxxx> || MEV Ltd. is a company )=-
-=( registered in England & Wales. Regd. number: 02862268. )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-