From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Mario Limonciello <mario.limonciello@amd.com>,
kernel test robot <lkp@intel.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Sasha Levin <sashal@kernel.org>,
rjw@rjwysocki.net, lenb@kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH AUTOSEL 6.6 11/18] ACPI: Add missing prototype for non CONFIG_SUSPEND/CONFIG_X86 case
Date: Fri, 30 May 2025 08:40:40 -0400 [thread overview]
Message-ID: <20250530124047.2575954-11-sashal@kernel.org> (raw)
In-Reply-To: <20250530124047.2575954-1-sashal@kernel.org>
From: Mario Limonciello <mario.limonciello@amd.com>
[ Upstream commit e1bdbbc98279164d910d2de82a745f090a8b249f ]
acpi_register_lps0_dev() and acpi_unregister_lps0_dev() may be used
in drivers that don't require CONFIG_SUSPEND or compile on !X86.
Add prototypes for those cases.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502191627.fRgoBwcZ-lkp@intel.com/
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/20250407183656.1503446-1-superm1@kernel.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
**YES** This commit should be backported to stable kernel trees.
**Analysis:** This commit fixes a clear build error that affects users
in specific, but valid, kernel configurations. Here's the detailed
analysis: **1. Clear Bug Fix:** The commit addresses missing function
prototypes for `acpi_register_lps0_dev()` and
`acpi_unregister_lps0_dev()` when `CONFIG_SUSPEND` or `CONFIG_X86` are
not enabled. This causes compilation failures when drivers that use
these functions are built without these config options. **2. Code
Changes Analysis:** - **File Modified:** `include/linux/acpi.h` at lines
1108-1162 - **Before:** The `struct acpi_s2idle_dev_ops` was only
defined within the `#if defined(CONFIG_SUSPEND) && defined(CONFIG_X86)`
block, and the stub functions for `acpi_register_lps0_dev()` and
`acpi_unregister_lps0_dev()` were missing from the `#else` clause. -
**After:** The struct definition is moved outside the conditional block,
and stub functions are added in the `#else` clause that return `-ENODEV`
for registration and do nothing for unregistration. **3. Real-world
Impact:** From examining the kernel tree, several drivers use these
functions: - `/home/sasha/linux/drivers/platform/x86/amd/pmc/pmc.c` -
AMD PMC driver calls `acpi_register_lps0_dev()` and
`acpi_unregister_lps0_dev()` -
`/home/sasha/linux/arch/x86/platform/atom/punit_atom_debug.c` - Intel
Atom debug driver - `/home/sasha/linux/drivers/platform/x86/pmc_atom.c`
- Intel PMC Atom driver These drivers can be enabled on platforms or
configurations where `CONFIG_SUSPEND` or `CONFIG_X86` might not be set,
causing build failures. **4. Minimal Risk:** - **Size:** Very small
change - only adds stub function prototypes - **Scope:** Limited to
header file, no runtime behavior changes for existing working
configurations - **Side Effects:** None - the stubs return appropriate
error codes and maintain API compatibility **5. Comparison with Similar
Commits:** Looking at the provided similar commits, this follows the
same pattern as commits #2, #3, and #4 (all marked as NO), which were
prototype/warning fixes. However, this commit differs crucially because:
- It fixes actual **build failures** (not just warnings) - The kernel
test robot specifically reported compilation errors - It affects **real
drivers** that are in use **6. Stable Tree Criteria Compliance:** - ✅
Fixes important bugs (build failures) - ✅ Doesn't introduce new features
- ✅ Doesn't make architectural changes - ✅ Has minimal risk of
regression - ✅ Is confined to a specific subsystem (ACPI headers) The
commit message explicitly mentions "kernel test robot" reporting build
failures, indicating this is a real issue affecting automated testing
and potentially user builds. The fix is exactly what's needed for proper
API completeness - providing stub implementations when the real
functionality isn't available.
include/linux/acpi.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 1b76d2f83eac6..7c6f4006389da 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1098,13 +1098,13 @@ void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
u32 val_a, u32 val_b);
-#if defined(CONFIG_SUSPEND) && defined(CONFIG_X86)
struct acpi_s2idle_dev_ops {
struct list_head list_node;
void (*prepare)(void);
void (*check)(void);
void (*restore)(void);
};
+#if defined(CONFIG_SUSPEND) && defined(CONFIG_X86)
int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg);
void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg);
int acpi_get_lps0_constraint(struct acpi_device *adev);
@@ -1113,6 +1113,13 @@ static inline int acpi_get_lps0_constraint(struct device *dev)
{
return ACPI_STATE_UNKNOWN;
}
+static inline int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg)
+{
+ return -ENODEV;
+}
+static inline void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg)
+{
+}
#endif /* CONFIG_SUSPEND && CONFIG_X86 */
#ifndef CONFIG_IA64
void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
--
2.39.5
next prev parent reply other threads:[~2025-05-30 12:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-30 12:40 [PATCH AUTOSEL 6.6 01/18] ACPICA: fix acpi operand cache leak in dswstate.c Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 02/18] ASoC: amd: yc: Add quirk for Lenovo Yoga Pro 7 14ASP9 Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 03/18] clocksource: Fix the CPUs' choice in the watchdog per CPU verification Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 04/18] tools/nolibc: use intmax definitions from compiler Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 05/18] power: supply: collie: Fix wakeup source leaks on device unbind Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 06/18] mmc: Add quirk to disable DDR50 tuning Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 07/18] ACPICA: Avoid sequence overread in call to strncmp() Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 08/18] mmc: sdhci-esdhc-imx: Save tuning value when card stays powered in suspend Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 09/18] ASoC: tas2770: Power cycle amp on ISENSE/VSENSE change Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 10/18] ACPI: bus: Bail out if acpi_kobj registration fails Sasha Levin
2025-05-30 12:40 ` Sasha Levin [this message]
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 12/18] ACPICA: fix acpi parse and parseext cache leaks Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 13/18] power: supply: bq27xxx: Retrieve again when busy Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 14/18] ACPICA: utilities: Fix overflow check in vsnprintf() Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 15/18] ASoC: tegra210_ahub: Add check to of_device_get_match_data() Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 16/18] gpiolib: of: Add polarity quirk for s5m8767 Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 17/18] PM: runtime: fix denying of auto suspend in pm_suspend_timer_fn() Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 18/18] ACPI: battery: negate current when discharging Sasha Levin
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=20250530124047.2575954-11-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mario.limonciello@amd.com \
--cc=patches@lists.linux.dev \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@rjwysocki.net \
--cc=stable@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox