mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Input: apm-power - remove driver
@ 2026-11-09  8:09 Dmitry Torokhov
  2026-11-09 10:00 ` Arnd Bergmann
  2026-11-09 16:44 ` Nathan Chancellor
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2026-11-09  8:09 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Arnd Bergmann
  Cc: Daniel Mack, Russell King, Sasha Levin, linux-input,
	linux-kbuild, linux-arm-kernel, linux-kernel

The apm-power input handler solely listens for EV_PWR KEY_SUSPEND
events to queue APM_USER_SUSPEND via legacy APM emulation. The only
in-tree platforms generating those events are legacy Sharp Zaurus ARM
machines (spitz/borzoi/akita and collie), none of which were converted
to Device Tree. Both mach-pxa board files and mach-sa1100 were marked
deprecated in v7.3 by commit cc7852314abd ("ARM: PXA: mark remaining
board files as deprecated") and commit 7d92e50ceacd ("ARM: mark
mach-sa1100 as deprecated"), and are queued for removal in v7.5. None
of the remaining ARM platforms or other APM_EMULATION targets
(MIPS_ALCHEMY, PMAC_APM_EMU, and SH_HP6XX) emit EV_PWR input events or
enable CONFIG_INPUT_APMPOWER, and arch/arm/configs/pxa_defconfig
already dropped CONFIG_PXA_SHARPSL at the same time, leaving its
CONFIG_INPUT_APMPOWER=m entry inert.

Normalizing dashes and underscores in scripts/modules-check.sh for v7.5
exposes a module name collision (apm_power) between
drivers/input/apm-power.ko and drivers/power/supply/apm_power.ko.
Remove this obsolete input bridge to resolve the collision rather than
renaming a module whose last target platforms are going away in the
same cycle.

Reported-by: Sasha Levin <sashal@kernel.org>
Closes: https://lore.kernel.org/r/20261108225808.1809266-1-sashal@kernel.org
Link: https://lore.kernel.org/r/20261109-apm-power-input-rename-v1-1-0609e7b91825@kernel.org
Link: https://lore.kernel.org/r/e4da2f9d-d3b9-4267-9b64-b0f2cb43402a@app.fastmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/configs/pxa_defconfig |   1 -
 drivers/input/Kconfig          |  12 ----
 drivers/input/Makefile         |   2 -
 drivers/input/apm-power.c      | 122 ---------------------------------
 4 files changed, 137 deletions(-)
 delete mode 100644 drivers/input/apm-power.c

diff --git a/arch/arm/configs/pxa_defconfig b/arch/arm/configs/pxa_defconfig
index e7a7ed2b7ef7..e70d2789d1f6 100644
--- a/arch/arm/configs/pxa_defconfig
+++ b/arch/arm/configs/pxa_defconfig
@@ -224,7 +224,6 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_X=640
 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=480
 CONFIG_INPUT_JOYDEV=m
 CONFIG_INPUT_EVDEV=m
-CONFIG_INPUT_APMPOWER=m
 CONFIG_KEYBOARD_ATKBD=m
 CONFIG_KEYBOARD_QT1070=m
 CONFIG_KEYBOARD_GPIO=m
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index 88ecdf5218ee..064beedf5558 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -162,18 +162,6 @@ config INPUT_KUNIT_TEST
 
 	  If in doubt, say "N".
 
-config INPUT_APMPOWER
-	tristate "Input Power Event -> APM Bridge" if EXPERT
-	depends on INPUT && APM_EMULATION
-	help
-	  Say Y here if you want suspend key events to trigger a user
-	  requested suspend through APM. This is useful on embedded
-	  systems where such behaviour is desired without userspace
-	  interaction. If unsure, say N.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called apm-power.
-
 comment "Input Device Drivers"
 
 source "drivers/input/keyboard/Kconfig"
diff --git a/drivers/input/Makefile b/drivers/input/Makefile
index 2cd6e1c9a778..7d2af8dfd17e 100644
--- a/drivers/input/Makefile
+++ b/drivers/input/Makefile
@@ -27,6 +27,4 @@ obj-$(CONFIG_INPUT_TOUCHSCREEN)	+= touchscreen/
 obj-$(CONFIG_INPUT_MISC)	+= misc/
 obj-$(CONFIG_INPUT_KUNIT_TEST)	+= tests/
 
-obj-$(CONFIG_INPUT_APMPOWER)	+= apm-power.o
-
 obj-$(CONFIG_RMI4_CORE)		+= rmi4/
diff --git a/drivers/input/apm-power.c b/drivers/input/apm-power.c
deleted file mode 100644
index 028fcaf4c142..000000000000
--- a/drivers/input/apm-power.c
+++ /dev/null
@@ -1,122 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- *  Input Power Event -> APM Bridge
- *
- *  Copyright (c) 2007 Richard Purdie
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/module.h>
-#include <linux/input.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/tty.h>
-#include <linux/delay.h>
-#include <linux/pm.h>
-#include <linux/apm-emulation.h>
-
-static void system_power_event(unsigned int keycode)
-{
-	switch (keycode) {
-	case KEY_SUSPEND:
-		apm_queue_event(APM_USER_SUSPEND);
-		pr_info("Requesting system suspend...\n");
-		break;
-	default:
-		break;
-	}
-}
-
-static void apmpower_event(struct input_handle *handle, unsigned int type,
-			   unsigned int code, int value)
-{
-	/* only react on key down events */
-	if (value != 1)
-		return;
-
-	switch (type) {
-	case EV_PWR:
-		system_power_event(code);
-		break;
-
-	default:
-		break;
-	}
-}
-
-static int apmpower_connect(struct input_handler *handler,
-					  struct input_dev *dev,
-					  const struct input_device_id *id)
-{
-	struct input_handle *handle;
-	int error;
-
-	handle = kzalloc_obj(struct input_handle);
-	if (!handle)
-		return -ENOMEM;
-
-	handle->dev = dev;
-	handle->handler = handler;
-	handle->name = "apm-power";
-
-	error = input_register_handle(handle);
-	if (error) {
-		pr_err("Failed to register input power handler, error %d\n",
-		       error);
-		kfree(handle);
-		return error;
-	}
-
-	error = input_open_device(handle);
-	if (error) {
-		pr_err("Failed to open input power device, error %d\n", error);
-		input_unregister_handle(handle);
-		kfree(handle);
-		return error;
-	}
-
-	return 0;
-}
-
-static void apmpower_disconnect(struct input_handle *handle)
-{
-	input_close_device(handle);
-	input_unregister_handle(handle);
-	kfree(handle);
-}
-
-static const struct input_device_id apmpower_ids[] = {
-	{
-		.flags = INPUT_DEVICE_ID_MATCH_EVBIT,
-		.evbit = { BIT_MASK(EV_PWR) },
-	},
-	{ },
-};
-
-MODULE_DEVICE_TABLE(input, apmpower_ids);
-
-static struct input_handler apmpower_handler = {
-	.event =	apmpower_event,
-	.connect =	apmpower_connect,
-	.disconnect =	apmpower_disconnect,
-	.name =		"apm-power",
-	.id_table =	apmpower_ids,
-};
-
-static int __init apmpower_init(void)
-{
-	return input_register_handler(&apmpower_handler);
-}
-
-static void __exit apmpower_exit(void)
-{
-	input_unregister_handler(&apmpower_handler);
-}
-
-module_init(apmpower_init);
-module_exit(apmpower_exit);
-
-MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
-MODULE_DESCRIPTION("Input Power Event -> APM Bridge");
-MODULE_LICENSE("GPL");
-- 
2.56.0.506.g506a7eabc5-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: apm-power - remove driver
  2026-11-09  8:09 [PATCH] Input: apm-power - remove driver Dmitry Torokhov
@ 2026-11-09 10:00 ` Arnd Bergmann
  2026-11-09 16:44 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-11-09 10:00 UTC (permalink / raw)
  To: Dmitry Torokhov, Nathan Chancellor, Nicolas Schier
  Cc: Daniel Mack, Russell King, Sasha Levin, linux-input,
	linux-kbuild, linux-arm-kernel, linux-kernel

On Mon, Nov 9, 2026, at 09:09, Dmitry Torokhov wrote:
> The apm-power input handler solely listens for EV_PWR KEY_SUSPEND
> events to queue APM_USER_SUSPEND via legacy APM emulation. The only
> in-tree platforms generating those events are legacy Sharp Zaurus ARM
> machines (spitz/borzoi/akita and collie), none of which were converted
> to Device Tree. Both mach-pxa board files and mach-sa1100 were marked
> deprecated in v7.3 by commit cc7852314abd ("ARM: PXA: mark remaining
> board files as deprecated") and commit 7d92e50ceacd ("ARM: mark
> mach-sa1100 as deprecated"), and are queued for removal in v7.5. None
> of the remaining ARM platforms or other APM_EMULATION targets
> (MIPS_ALCHEMY, PMAC_APM_EMU, and SH_HP6XX) emit EV_PWR input events or
> enable CONFIG_INPUT_APMPOWER, and arch/arm/configs/pxa_defconfig
> already dropped CONFIG_PXA_SHARPSL at the same time, leaving its
> CONFIG_INPUT_APMPOWER=m entry inert.
>
> Normalizing dashes and underscores in scripts/modules-check.sh for v7.5
> exposes a module name collision (apm_power) between
> drivers/input/apm-power.ko and drivers/power/supply/apm_power.ko.
> Remove this obsolete input bridge to resolve the collision rather than
> renaming a module whose last target platforms are going away in the
> same cycle.

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

I missed this one and thought it was still needed, but your
explanation makes sense.

I think we can follow the same logic for drivers/power/supply/apm_power.c
and remove that once my board removal lands: the only actual battery
that is ever registered with battery_desc.use_for_apm=1 is for the
OLPC XO1.5, and that one does not have CONFIG_APM_EMULATION, so that
can probably all go away.

Maybe we can then fold drivers/char/apm-emulation.c back into
arch/sh/boards/mach-hp6xx/hp6xx_apm.c and drivers/macintosh/apm_emu.c
as separate copies. This started out in the mac driver to be
compatible with x86 and was later unified across architectures,
but is entirely obsolete now except for the few 20+ year old
machines that were converted to it in the past.

       Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: apm-power - remove driver
  2026-11-09  8:09 [PATCH] Input: apm-power - remove driver Dmitry Torokhov
  2026-11-09 10:00 ` Arnd Bergmann
@ 2026-11-09 16:44 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2026-11-09 16:44 UTC (permalink / raw)
  To: Dmitry Torokhov, Nicolas Schier
  Cc: Arnd Bergmann, Daniel Mack, Russell King, Sasha Levin,
	linux-input, linux-kbuild, linux-arm-kernel, linux-kernel

On Mon, Nov 09, 2026 at 12:09:44AM -0800, Dmitry Torokhov wrote:
> The apm-power input handler solely listens for EV_PWR KEY_SUSPEND
> events to queue APM_USER_SUSPEND via legacy APM emulation. The only
> in-tree platforms generating those events are legacy Sharp Zaurus ARM
> machines (spitz/borzoi/akita and collie), none of which were converted
> to Device Tree. Both mach-pxa board files and mach-sa1100 were marked
> deprecated in v7.3 by commit cc7852314abd ("ARM: PXA: mark remaining
> board files as deprecated") and commit 7d92e50ceacd ("ARM: mark
> mach-sa1100 as deprecated"), and are queued for removal in v7.5. None
> of the remaining ARM platforms or other APM_EMULATION targets
> (MIPS_ALCHEMY, PMAC_APM_EMU, and SH_HP6XX) emit EV_PWR input events or
> enable CONFIG_INPUT_APMPOWER, and arch/arm/configs/pxa_defconfig
> already dropped CONFIG_PXA_SHARPSL at the same time, leaving its
> CONFIG_INPUT_APMPOWER=m entry inert.
> 
> Normalizing dashes and underscores in scripts/modules-check.sh for v7.5
> exposes a module name collision (apm_power) between
> drivers/input/apm-power.ko and drivers/power/supply/apm_power.ko.
> Remove this obsolete input bridge to resolve the collision rather than
> renaming a module whose last target platforms are going away in the
> same cycle.
> 
> Reported-by: Sasha Levin <sashal@kernel.org>
> Closes: https://lore.kernel.org/r/20261108225808.1809266-1-sashal@kernel.org
> Link: https://lore.kernel.org/r/20261109-apm-power-input-rename-v1-1-0609e7b91825@kernel.org
> Link: https://lore.kernel.org/r/e4da2f9d-d3b9-4267-9b64-b0f2cb43402a@app.fastmail.com
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Thanks a lot for helping with this.

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

Nicolas, do you prefer taking this via kbuild-next directly or having
Dmitry take it via the input tree and giving us an immutable branch? I
assume the chance of conflicts or follow-ups are low, so we can probably
just take it directly but I don't want to assume your preference.

-- 
Cheers,
Nathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-09 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09  8:09 [PATCH] Input: apm-power - remove driver Dmitry Torokhov
2026-11-09 10:00 ` Arnd Bergmann
2026-11-09 16:44 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®