On Wed, Oct 30, 2024 at 05:13:15PM +0200, Andy Shevchenko wrote: > On Wed, Oct 30, 2024 at 12:36:41PM +0000, Arnd Bergmann wrote: > > From: Arnd Bergmann <arnd@xxxxxxxx> > > > > CONFIG_HAS_IOPORT will soon become optional and cause a build time > > failure when it is disabled but a driver calls inb()/outb(). At the > > moment, all architectures that can support ACPI have port I/O, but this > > is not necessarily the case in the future on non-x86 architectures. > > The result is a set of errors like: > > > > drivers/acpi/osl.c: In function 'acpi_os_read_port': > > include/asm-generic/io.h:542:14: error: call to '_inb' declared with attribute error: inb()) requires CONFIG_HAS_IOPORT > > > > Nothing should actually call these functions in this configuration, > > and if it does, the result would be undefined behavior today, possibly > > a NULL pointer dereference. > > > > Change the low-level functions to return a proper error code when > > HAS_IOPORT is disabled. > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> ... > > + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) { > > + /* > > + * set all-1 result as if reading from non-existing > > + * I/O port > > + */ > > Don't know if Rafael can / want to tweak this, but would be nice to follow > standard style for multi-line comments. > > /* > * Set all-1 result as if reading from non-existing > * I/O port. > */ > > > + *value = GENMASK(width, 0); Actually, shouldn't this be width - 1 ? > > + return AE_NOT_IMPLEMENTED; > > + } -- With Best Regards, Andy Shevchenko