From f20c1dbe82f52ff24a366e1e72c4f19031915808 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ahelenia=20Ziemia=C5=84ska?= Date: Fri, 17 Oct 2025 00:05:10 +0200 Subject: [PATCH] apm-emulation: remove unused __apm_get_power_status MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The API for apm_get_power_status is "call it if it isn't NULL", except it's also initialised with a no-op __apm_get_power_status. This was added alongside apm_get_power_status in 2007. The apm_get_power_status symbol is used in these files: arch/arm/mach-pxa/sharpsl_pm.c:extern void (*apm_get_power_status)(struct apm_power_info *); arch/arm/mach-pxa/sharpsl_pm.c: apm_get_power_status = sharpsl_apm_get_power_status; arch/sh/boards/mach-hp6xx/hp6xx_apm.c: apm_get_power_status = hp6x0_apm_get_power_status; drivers/char/apm-emulation.c:void (*apm_get_power_status)(struct apm_power_info *) = __apm_get_power_status; drivers/char/apm-emulation.c:EXPORT_SYMBOL(apm_get_power_status); drivers/char/apm-emulation.c: if (apm_get_power_status) drivers/char/apm-emulation.c: apm_get_power_status(&info); drivers/macintosh/apm_emu.c: apm_get_power_status = pmu_apm_get_power_status; drivers/macintosh/apm_emu.c: if (apm_get_power_status == pmu_apm_get_power_status) drivers/macintosh/apm_emu.c: apm_get_power_status = NULL; drivers/power/supply/apm_power.c: apm_get_power_status = apm_battery_apm_get_power_status; drivers/power/supply/apm_power.c: apm_get_power_status = NULL; include/linux/apm-emulation.h:extern void (*apm_get_power_status)(struct apm_power_info *); All of them are compatible with the API (post-remove UAFs notwithstanding) and don't even read it except to compare with their own values; on a cursory glance this doesn't seem to have ever not been the case. Fixes: 7726942fb15e ("[APM] Add shared version of APM emulation") Signed-off-by: Ahelenia Ziemiańska Link: https://patch.msgid.link/ba3nzxffdpuz2eo5kbpm5iez2rcdves3qpd4kvnmshxwjburwo@tarta.nabijaczleweli.xyz Signed-off-by: Greg Kroah-Hartman --- drivers/char/apm-emulation.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c index 53ce352f7197d..4aa5d1c76f83b 100644 --- a/drivers/char/apm-emulation.c +++ b/drivers/char/apm-emulation.c @@ -142,18 +142,10 @@ static struct apm_queue kapmd_queue; static DEFINE_MUTEX(state_lock); -/* - * Compatibility cruft until the IPAQ people move over to the new - * interface. - */ -static void __apm_get_power_status(struct apm_power_info *info) -{ -} - /* * This allows machines to provide their own "apm get power status" function. */ -void (*apm_get_power_status)(struct apm_power_info *) = __apm_get_power_status; +void (*apm_get_power_status)(struct apm_power_info *); EXPORT_SYMBOL(apm_get_power_status); -- 2.47.3