Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

power: supply: apm_power: only unset own apm_get_power_status

Mirroring drivers/macintosh/apm_emu.c, this means that
modprobe apm_power && modprobe $anotherdriver && modprobe -r apm_power
leaves $anotherdriver's apm_get_power_status instead of deleting it.

Fixes: 3788ec932bfd ("[BATTERY] APM emulation driver for class batteries")
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Link: https://patch.msgid.link/xczpgox57hxbunkcbdl5fxhc4gnsajsipldfidi7355afezk64@tarta.nabijaczleweli.xyz
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

Ahelenia Ziemiańska and committed by
Sebastian Reichel
bd44ea12 3fd1695f

+2 -1
+2 -1
drivers/power/supply/apm_power.c
··· 364 364 365 365 static void __exit apm_battery_exit(void) 366 366 { 367 - apm_get_power_status = NULL; 367 + if (apm_get_power_status == apm_battery_apm_get_power_status) 368 + apm_get_power_status = NULL; 368 369 } 369 370 370 371 module_init(apm_battery_init);