]> Gentwo Git Trees - linux/.git/commitdiff
power: supply: apm_power: only unset own apm_get_power_status
authorAhelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Thu, 16 Oct 2025 22:05:18 +0000 (00:05 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Mon, 3 Nov 2025 00:01:57 +0000 (01:01 +0100)
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>
drivers/power/supply/apm_power.c

index 9236e007857860e1001d192d9f1a5fe7204332f8..9933cdc5c387a1876ce0e36955b34c4072a3e39d 100644 (file)
@@ -364,7 +364,8 @@ static int __init apm_battery_init(void)
 
 static void __exit apm_battery_exit(void)
 {
-       apm_get_power_status = NULL;
+       if (apm_get_power_status == apm_battery_apm_get_power_status)
+               apm_get_power_status = NULL;
 }
 
 module_init(apm_battery_init);