Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

comedi: comedi_8255: Conditionally remove I/O port support

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 comedi_8255 module supports both port I/O and memory-mapped I/O.

Conditionally compile the parts of the module that use port I/O if and
only if the `CONFIG_HAS_IOPORT` macro is defined so that it can still be
built if the port I/O functions have not been declared. If the
`CONFIG_HAS_IOPORT` macro is undefined, replace the GPL-exported
`subdev_8255_io_init()` function with a dummy static inline version that
just returns `-ENXIO`.

Cc: Arnd Bergmann <arnd@kernel.org>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20230913170712.111719-8-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ian Abbott and committed by
Greg Kroah-Hartman
7187a093 5c57b1cc

+19
+8
drivers/comedi/drivers/comedi_8255.c
··· 38 38 unsigned long context); 39 39 }; 40 40 41 + #ifdef CONFIG_HAS_IOPORT 42 + 41 43 static int subdev_8255_io(struct comedi_device *dev, 42 44 int dir, int port, int data, unsigned long regbase) 43 45 { ··· 49 47 } 50 48 return inb(dev->iobase + regbase + port); 51 49 } 50 + 51 + #endif /* CONFIG_HAS_IOPORT */ 52 52 53 53 static int subdev_8255_mmio(struct comedi_device *dev, 54 54 int dir, int port, int data, unsigned long regbase) ··· 173 169 return 0; 174 170 } 175 171 172 + #ifdef CONFIG_HAS_IOPORT 173 + 176 174 /** 177 175 * subdev_8255_io_init - initialize DIO subdevice for driving I/O mapped 8255 178 176 * @dev: comedi device owning subdevice ··· 191 185 return __subdev_8255_init(dev, s, subdev_8255_io, regbase); 192 186 } 193 187 EXPORT_SYMBOL_GPL(subdev_8255_io_init); 188 + 189 + #endif /* CONFIG_HAS_IOPORT */ 194 190 195 191 /** 196 192 * subdev_8255_mm_init - initialize DIO subdevice for driving mmio-mapped 8255
+11
include/linux/comedi/comedi_8255.h
··· 10 10 #ifndef _COMEDI_8255_H 11 11 #define _COMEDI_8255_H 12 12 13 + #include <linux/errno.h> 14 + 13 15 #define I8255_SIZE 0x04 14 16 15 17 #define I8255_DATA_A_REG 0x00 ··· 29 27 struct comedi_device; 30 28 struct comedi_subdevice; 31 29 30 + #ifdef CONFIG_HAS_IOPORT 32 31 int subdev_8255_io_init(struct comedi_device *dev, struct comedi_subdevice *s, 33 32 unsigned long regbase); 33 + #else 34 + static inline int subdev_8255_io_init(struct comedi_device *dev, 35 + struct comedi_subdevice *s, 36 + unsigned long regbase) 37 + { 38 + return -ENXIO; 39 + } 40 + #endif 34 41 35 42 int subdev_8255_mm_init(struct comedi_device *dev, struct comedi_subdevice *s, 36 43 unsigned long regbase);