]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
apm-emulation: remove unused __apm_get_power_status
authorAhelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Thu, 16 Oct 2025 22:05:10 +0000 (00:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Oct 2025 05:59:57 +0000 (07:59 +0200)
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 <nabijaczleweli@nabijaczleweli.xyz>
Link: https://patch.msgid.link/ba3nzxffdpuz2eo5kbpm5iez2rcdves3qpd4kvnmshxwjburwo@tarta.nabijaczleweli.xyz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/apm-emulation.c

index 53ce352f7197d486630798357e4a8d11f2b73302..4aa5d1c76f83b0a05b5b4eacc2cb23d63f62fe03 100644 (file)
@@ -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);