All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>, Len Brown <lenb@kernel.org>,
	Jarred White <jarredwhite@linux.microsoft.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] [v3] acpi: allow building without CONFIG_HAS_IOPORT
Date: Wed, 30 Oct 2024 17:13:15 +0200	[thread overview]
Message-ID: <ZyJNC44r11a83FlI@smile.fi.intel.com> (raw)
In-Reply-To: <20241030123701.1538919-2-arnd@kernel.org>

On Wed, Oct 30, 2024 at 12:36:41PM +0000, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.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@linux.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



  reply	other threads:[~2024-10-30 15:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30 12:36 [PATCH 1/2] [v3] acpi: processor_perflib: extend X86 dependency Arnd Bergmann
2024-10-30 12:36 ` [PATCH 2/2] [v3] acpi: allow building without CONFIG_HAS_IOPORT Arnd Bergmann
2024-10-30 15:13   ` Andy Shevchenko [this message]
2024-10-30 15:14     ` Andy Shevchenko
2024-11-05 20:44 ` [PATCH 1/2] [v3] acpi: processor_perflib: extend X86 dependency Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZyJNC44r11a83FlI@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=jarredwhite@linux.microsoft.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.