[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zwj1p3uMEA24a0sU@smile.fi.intel.com>
Date: Fri, 11 Oct 2024 12:53:43 +0300
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>,
	Mario Limonciello <mario.limonciello@....com>,
	Jarred White <jarredwhite@...ux.microsoft.com>,
	Perry Yuan <perry.yuan@....com>,
	Easwar Hariharan <eahariha@...ux.microsoft.com>,
	linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] acpi: allow building without CONFIG_HAS_IOPORT
On Fri, Oct 11, 2024 at 06:18:18AM +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.
...
> +	if (!IS_ENABLED(CONFIG_HAS_IOPORT)) {
> +		*value = BIT_MASK(width);
> +		return AE_NOT_IMPLEMENTED;
Perhaps it has already been discussed, but why do we need to file value with
semi-garbage when we know it's invalid anyway?
> +	}
-- 
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists
 
