[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZyJNC44r11a83FlI@smile.fi.intel.com>
Date: Wed, 30 Oct 2024 17:13:15 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Arnd Bergmann <arnd@...nel.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Len Brown <lenb@...nel.org>,
Jarred White <jarredwhite@...ux.microsoft.com>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] [v3] acpi: allow building without CONFIG_HAS_IOPORT
On Wed, Oct 30, 2024 at 12:36:41PM +0000, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> 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@...ux.intel.com>
...
> + 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);
> + return AE_NOT_IMPLEMENTED;
> + }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists