apm-emulation: remove unused __apm_get_power_status

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: 7726942fb1 ("[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>
This commit is contained in:
Ahelenia Ziemiańska
2025-10-17 00:05:10 +02:00
committed by Greg Kroah-Hartman
parent b94eb28cb3
commit f20c1dbe82

View 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);