[PATCH v2 05/10] platform: dell: laptop: Compile out i8042 usage without SERIO_I8042

From: Brian Mak

Date: Mon Nov 23 2026 - 18:10:43 EST


dell-laptop uses the i8042 controller for two things: controlling the
touchpad LED on certain models and receiving rfkill hotkey events when
dell-rbtn is not available. When SERIO_I8042 is disabled, the i8042
stubs return -ENODEV, and neither path handles that gracefully:

- The touchpad LED is registered anyway, and writes to it do nothing.
- On Latitude and Precision models with a hardware rfkill switch and
no dell-rbtn, i8042_install_filter() fails, and dell-laptop fails to
load entirely.

Only register the touchpad LED when SERIO_I8042 is enabled. When
neither dell-rbtn nor i8042 is available, skip rfkill instead of
failing to load, since there would be no way to track the hardware
switch state. Clear the rfkill pointers after unwinding so that
dell_cleanup_rfkill() does not free them again.

This prepares for dropping the hard SERIO_I8042 dependency, so that
dell-laptop can be built on platforms without an i8042 controller, such
as ARM64.

Signed-off-by: Brian Mak <bmak@xxxxxxxxxx>
---
drivers/platform/dell/dell-laptop.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/dell/dell-laptop.c b/drivers/platform/dell/dell-laptop.c
index 89e85c7f7132..514449fa6e05 100644
--- a/drivers/platform/dell/dell-laptop.c
+++ b/drivers/platform/dell/dell-laptop.c
@@ -892,13 +892,17 @@ static int __init dell_setup_rfkill(void)
} else if (ret != -ENODEV) {
pr_warn("Unable to register dell rbtn notifier\n");
goto err_filter;
- } else {
+ } else if (IS_ENABLED(CONFIG_SERIO_I8042)) {
ret = i8042_install_filter(dell_laptop_i8042_filter, NULL);
if (ret) {
pr_warn("Unable to install key filter\n");
goto err_filter;
}
pr_info("Using i8042 filter function for receiving events\n");
+ } else {
+ pr_info("No source for receiving events, rfkill disabled\n");
+ ret = 0;
+ goto err_filter;
}

return 0;
@@ -915,6 +919,9 @@ static int __init dell_setup_rfkill(void)
rfkill_unregister(wifi_rfkill);
err_wifi:
rfkill_destroy(wifi_rfkill);
+ wifi_rfkill = NULL;
+ bluetooth_rfkill = NULL;
+ wwan_rfkill = NULL;

return ret;
}
@@ -1014,6 +1021,11 @@ static void touchpad_led_exit(void)
led_classdev_unregister(&touchpad_led);
}

+static bool dell_has_touchpad_led(void)
+{
+ return IS_ENABLED(CONFIG_SERIO_I8042) && quirks && quirks->touchpad_led;
+}
+
/*
* Derived from information in smbios-keyboard-ctl:
*
@@ -2487,7 +2499,7 @@ static int __init dell_init(void)
goto fail_rfkill;
}

- if (quirks && quirks->touchpad_led)
+ if (dell_has_touchpad_led())
touchpad_led_init(&platform_device->dev);

kbd_led_init(&platform_device->dev);
@@ -2564,7 +2576,7 @@ static int __init dell_init(void)
debugfs_remove_recursive(dell_laptop_dir);
dell_battery_exit();
kbd_led_exit();
- if (quirks && quirks->touchpad_led)
+ if (dell_has_touchpad_led())
touchpad_led_exit();
dell_cleanup_rfkill();
fail_rfkill:
@@ -2581,7 +2593,7 @@ static void __exit dell_exit(void)
{
dell_laptop_unregister_notifier(&dell_laptop_notifier);
debugfs_remove_recursive(dell_laptop_dir);
- if (quirks && quirks->touchpad_led)
+ if (dell_has_touchpad_led())
touchpad_led_exit();
kbd_led_exit();
dell_battery_exit();
--
2.53.0