platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code
[ Upstream commit b52cbca22cbf6c9d2700c1e576d0ddcc670e49d5 ] asus-nb-wmi calls i8042_install_filter() in some cases, but it never calls i8042_remove_filter(). This means that a dangling pointer to the filter function is left after rmmod leading to crashes. Fix this by moving the i8042-filter installation to the shared asus-wmi code and also remove it from the shared code on driver unbind. Fixes: b5643539b825 ("platform/x86: asus-wmi: Filter buggy scan codes on ASUS Q500A") Cc: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20231120154235.610808-2-hdegoede@redhat.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c6cb40bcad
commit
f660e1f606
3 changed files with 9 additions and 12 deletions
|
@ -243,6 +243,7 @@ config ASUS_WMI
|
||||||
depends on RFKILL || RFKILL = n
|
depends on RFKILL || RFKILL = n
|
||||||
depends on HOTPLUG_PCI
|
depends on HOTPLUG_PCI
|
||||||
depends on ACPI_VIDEO || ACPI_VIDEO = n
|
depends on ACPI_VIDEO || ACPI_VIDEO = n
|
||||||
|
depends on SERIO_I8042 || SERIO_I8042 = n
|
||||||
select INPUT_SPARSEKMAP
|
select INPUT_SPARSEKMAP
|
||||||
select LEDS_CLASS
|
select LEDS_CLASS
|
||||||
select NEW_LEDS
|
select NEW_LEDS
|
||||||
|
@ -256,7 +257,6 @@ config ASUS_WMI
|
||||||
config ASUS_NB_WMI
|
config ASUS_NB_WMI
|
||||||
tristate "Asus Notebook WMI Driver"
|
tristate "Asus Notebook WMI Driver"
|
||||||
depends on ASUS_WMI
|
depends on ASUS_WMI
|
||||||
depends on SERIO_I8042 || SERIO_I8042 = n
|
|
||||||
help
|
help
|
||||||
This is a driver for newer Asus notebooks. It adds extra features
|
This is a driver for newer Asus notebooks. It adds extra features
|
||||||
like wireless radio and bluetooth control, leds, hotkeys, backlight...
|
like wireless radio and bluetooth control, leds, hotkeys, backlight...
|
||||||
|
|
|
@ -490,8 +490,6 @@ static const struct dmi_system_id asus_quirks[] = {
|
||||||
|
|
||||||
static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
|
static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
|
|
||||||
quirks = &quirk_asus_unknown;
|
quirks = &quirk_asus_unknown;
|
||||||
dmi_check_system(asus_quirks);
|
dmi_check_system(asus_quirks);
|
||||||
|
|
||||||
|
@ -506,15 +504,6 @@ static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
|
||||||
|
|
||||||
if (tablet_mode_sw != -1)
|
if (tablet_mode_sw != -1)
|
||||||
quirks->tablet_switch_mode = tablet_mode_sw;
|
quirks->tablet_switch_mode = tablet_mode_sw;
|
||||||
|
|
||||||
if (quirks->i8042_filter) {
|
|
||||||
ret = i8042_install_filter(quirks->i8042_filter);
|
|
||||||
if (ret) {
|
|
||||||
pr_warn("Unable to install key filter\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pr_info("Using i8042 filter function for receiving events\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct key_entry asus_nb_wmi_keymap[] = {
|
static const struct key_entry asus_nb_wmi_keymap[] = {
|
||||||
|
|
|
@ -2779,6 +2779,12 @@ static int asus_wmi_add(struct platform_device *pdev)
|
||||||
goto fail_wmi_handler;
|
goto fail_wmi_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (asus->driver->quirks->i8042_filter) {
|
||||||
|
err = i8042_install_filter(asus->driver->quirks->i8042_filter);
|
||||||
|
if (err)
|
||||||
|
pr_warn("Unable to install key filter - %d\n", err);
|
||||||
|
}
|
||||||
|
|
||||||
asus_wmi_battery_init(asus);
|
asus_wmi_battery_init(asus);
|
||||||
|
|
||||||
asus_wmi_debugfs_init(asus);
|
asus_wmi_debugfs_init(asus);
|
||||||
|
@ -2810,6 +2816,8 @@ static int asus_wmi_remove(struct platform_device *device)
|
||||||
struct asus_wmi *asus;
|
struct asus_wmi *asus;
|
||||||
|
|
||||||
asus = platform_get_drvdata(device);
|
asus = platform_get_drvdata(device);
|
||||||
|
if (asus->driver->quirks->i8042_filter)
|
||||||
|
i8042_remove_filter(asus->driver->quirks->i8042_filter);
|
||||||
wmi_remove_notify_handler(asus->driver->event_guid);
|
wmi_remove_notify_handler(asus->driver->event_guid);
|
||||||
asus_wmi_backlight_exit(asus);
|
asus_wmi_backlight_exit(asus);
|
||||||
asus_wmi_input_exit(asus);
|
asus_wmi_input_exit(asus);
|
||||||
|
|
Loading…
Add table
Reference in a new issue