[PATCH] x86/apm: Code cleanup

Kunwu Chan posted 1 patch 1 year, 11 months ago
arch/x86/kernel/apm_32.c | 29 -----------------------------
1 file changed, 29 deletions(-)
[PATCH] x86/apm: Code cleanup
Posted by Kunwu Chan 1 year, 11 months ago
This part was commented in about 19 years before.
If there are no plans to enable this part code in the future,
we can remove this dead code.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
 arch/x86/kernel/apm_32.c | 29 -----------------------------
 1 file changed, 29 deletions(-)

diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 76a5ced278c2..b37ab1095707 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -1055,35 +1055,6 @@ static int apm_get_power_status(u_short *status, u_short *bat, u_short *life)
 	return APM_SUCCESS;
 }
 
-#if 0
-static int apm_get_battery_status(u_short which, u_short *status,
-				  u_short *bat, u_short *life, u_short *nbat)
-{
-	u32 eax;
-	u32 ebx;
-	u32 ecx;
-	u32 edx;
-	u32 esi;
-
-	if (apm_info.connection_version < 0x0102) {
-		/* pretend we only have one battery. */
-		if (which != 1)
-			return APM_BAD_DEVICE;
-		*nbat = 1;
-		return apm_get_power_status(status, bat, life);
-	}
-
-	if (apm_bios_call(APM_FUNC_GET_STATUS, (0x8000 | (which)), 0, &eax,
-			  &ebx, &ecx, &edx, &esi))
-		return (eax >> 8) & 0xff;
-	*status = ebx;
-	*bat = ecx;
-	*life = edx;
-	*nbat = esi;
-	return APM_SUCCESS;
-}
-#endif
-
 /**
  *	apm_engage_power_management	-	enable PM on a device
  *	@device: identity of device
-- 
2.39.2
[tip: x86/cleanups] x86/apm_32: Remove dead function apm_get_battery_status()
Posted by tip-bot2 for Kunwu Chan 1 year, 10 months ago
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     e37ae6433a5eeb5fb66e3de4b97cdda68ee2c5e8
Gitweb:        https://git.kernel.org/tip/e37ae6433a5eeb5fb66e3de4b97cdda68ee2c5e8
Author:        Kunwu Chan <chentao@kylinos.cn>
AuthorDate:    Fri, 26 Jan 2024 11:08:24 +08:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Wed, 21 Feb 2024 19:38:03 +01:00

x86/apm_32: Remove dead function apm_get_battery_status()

This part was commented out 25 years ago in:

  commit d43c43b46ebfdb437b78206fcc1992c4d2e8c15e
  Author: linus1 <torvalds@linuxfoundation.org>
  Date:   Tue Sep 7 11:00:00 1999 -0600

      Import 2.3.26pre1

and probably no one knows why. Probably it was unused even then.

Just remove it.

  [ bp: Expand commit message. ]

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20240126030824.579711-1-chentao@kylinos.cn
---
 arch/x86/kernel/apm_32.c | 29 -----------------------------
 1 file changed, 29 deletions(-)

diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 76a5ced..b37ab10 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -1055,35 +1055,6 @@ static int apm_get_power_status(u_short *status, u_short *bat, u_short *life)
 	return APM_SUCCESS;
 }
 
-#if 0
-static int apm_get_battery_status(u_short which, u_short *status,
-				  u_short *bat, u_short *life, u_short *nbat)
-{
-	u32 eax;
-	u32 ebx;
-	u32 ecx;
-	u32 edx;
-	u32 esi;
-
-	if (apm_info.connection_version < 0x0102) {
-		/* pretend we only have one battery. */
-		if (which != 1)
-			return APM_BAD_DEVICE;
-		*nbat = 1;
-		return apm_get_power_status(status, bat, life);
-	}
-
-	if (apm_bios_call(APM_FUNC_GET_STATUS, (0x8000 | (which)), 0, &eax,
-			  &ebx, &ecx, &edx, &esi))
-		return (eax >> 8) & 0xff;
-	*status = ebx;
-	*bat = ecx;
-	*life = edx;
-	*nbat = esi;
-	return APM_SUCCESS;
-}
-#endif
-
 /**
  *	apm_engage_power_management	-	enable PM on a device
  *	@device: identity of device