diff mbox series

[2/3] Input: atkbd - drop atkbd_skip_deactivate flag

Message ID 20231005201544.26983-3-hdegoede@redhat.com
State New
Headers show
Series [1/3] Input: atkbd - add skip_commands module parameter | expand

Commit Message

Hans de Goede Oct. 5, 2023, 8:15 p.m. UTC
Drop the atkbd_skip_deactivate flag and make the DMI quirk for LG laptops
set atkbd_skip_commands = ATKBD_SKIP_DEACTIVATE instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/input/keyboard/atkbd.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 7c16f9cc1e40..19a01e763871 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -257,12 +257,6 @@  static void (*atkbd_platform_fixup)(struct atkbd *, const void *data);
 static void *atkbd_platform_fixup_data;
 static unsigned int (*atkbd_platform_scancode_fixup)(struct atkbd *, unsigned int);
 
-/*
- * Certain keyboards to not like ATKBD_CMD_RESET_DIS and stop responding
- * to many commands until full reset (ATKBD_CMD_RESET_BAT) is performed.
- */
-static bool atkbd_skip_deactivate;
-
 static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf,
 				ssize_t (*handler)(struct atkbd *, char *));
 static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, size_t count,
@@ -855,8 +849,7 @@  static int atkbd_probe(struct atkbd *atkbd)
  * Make sure nothing is coming from the keyboard and disturbs our
  * internal state.
  */
-	if (!atkbd_skip_deactivate)
-		atkbd_deactivate(atkbd);
+	atkbd_deactivate(atkbd);
 
 	return 0;
 }
@@ -1781,9 +1774,12 @@  static int __init atkbd_setup_scancode_fixup(const struct dmi_system_id *id)
 	return 1;
 }
 
-static int __init atkbd_deactivate_fixup(const struct dmi_system_id *id)
+static int __init atkbd_skip_commands_fixup(const struct dmi_system_id *id)
 {
-	atkbd_skip_deactivate = true;
+	/* Module parameter overrules quirks */
+	if (!atkbd_skip_commands)
+		atkbd_skip_commands = (long)id->driver_data;
+
 	return 1;
 }
 
@@ -1931,10 +1927,15 @@  static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = {
 		.driver_data = atkbd_oqo_01plus_scancode_fixup,
 	},
 	{
+		/*
+		 * LG keyboards seem to not like ATKBD_CMD_RESET_DIS and stop responding
+		 * to many commands until full reset (ATKBD_CMD_RESET_BAT) is performed.
+		 */
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
 		},
-		.callback = atkbd_deactivate_fixup,
+		.callback = atkbd_skip_commands_fixup,
+		.driver_data = (void *)ATKBD_SKIP_DEACTIVATE,
 	},
 	{ }
 };