mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bowen Yu <yubowen8@huawei.com>
To: <linuxarm@huawei.com>, <liudingyuan@h-partners.com>,
	<andi.shyti@kernel.org>, <linux-i2c@vger.kernel.org>,
	<acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<rafael@kernel.org>, <lenb@kernel.org>
Cc: <zhanjie9@hisilicon.com>, <prime.zeng@hisilicon.com>,
	<wanghuiqiang@huawei.com>, <xuwei5@huawei.com>,
	<yubowen8@huawei.com>, <ouyiyong1@huawei.com>
Subject: [PATCH v5 1/2] ACPI: Add stub for acpi_has_method() for !CONFIG_ACPI
Date: Tue, 29 Sep 2026 20:13:47 +0800	[thread overview]
Message-ID: <20260929121348.109556-2-yubowen8@huawei.com> (raw)
In-Reply-To: <20260929121348.109556-1-yubowen8@huawei.com>

acpi_has_method() is declared in <acpi/acpi_bus.h>, which is only
included by <linux/acpi.h> when CONFIG_ACPI is enabled. Unlike the
ACPICA core helpers (acpi_evaluate_object(), acpi_format_exception(),
...) that get automatic static-inline stubs via the
ACPI_EXTERNAL_RETURN_* macros when !CONFIG_ACPI, acpi_has_method() is
Linux glue and has no stub in the #else section of <linux/acpi.h>.

This forces drivers referencing acpi_has_method() to wrap the call
site in #ifdef CONFIG_ACPI to avoid -Werror=implicit-function-declaration
on !CONFIG_ACPI builds -- a valid config for drivers that
"depends on ARM64 || COMPILE_TEST" with no ACPI dependency.

Add a static inline stub returning false, consistent with the existing
stubs for acpi_check_dsm() and friends, so drivers can drop the #ifdef
and rely on the runtime acpi_disabled check instead.

Signed-off-by: Bowen Yu <yubowen8@huawei.com>
---
 include/linux/acpi.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ddacac812094..141a322435c2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1028,6 +1028,11 @@ static inline bool acpi_driver_match_device(struct device *dev,
 	return false;
 }
 
+static inline bool acpi_has_method(acpi_handle handle, char *name)
+{
+	return false;
+}
+
 static inline bool acpi_check_dsm(acpi_handle handle, const guid_t *guid,
 				  u64 rev, u64 funcs)
 {
-- 
2.33.0


  reply	other threads:[~2026-09-29 12:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 12:13 [PATCH v5 0/2] HiSilicon I2C bus recovery support Bowen Yu
2026-09-29 12:13 ` Bowen Yu [this message]
2026-09-29 12:28   ` [PATCH v5 1/2] ACPI: Add stub for acpi_has_method() for !CONFIG_ACPI Rafael J. Wysocki (Intel)
2026-09-29 12:13 ` [PATCH v5 2/2] i2c: hisi: Add I2C bus recovery support Bowen Yu
2026-10-13 13:44   ` Jie Zhan
2026-10-27 10:51   ` Andi Shyti
2026-10-30  2:39     ` yubowen (H)

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=20260929121348.109556-2-yubowen8@huawei.com \
    --to=yubowen8@huawei.com \
    --cc=acpi@vger.kernel.org \
    --cc=andi.shyti@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liudingyuan@h-partners.com \
    --cc=ouyiyong1@huawei.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=rafael@kernel.org \
    --cc=wanghuiqiang@huawei.com \
    --cc=xuwei5@huawei.com \
    --cc=zhanjie9@hisilicon.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®