Commit 7ab52521 authored by Lee, Chun-Yi's avatar Lee, Chun-Yi Committed by Matthew Garrett

Clean up all objects used by scm model when driver initial fail or exit

Clean up i8042 filter, rfkill and cancel delayed work when msi-laptop driver initial fail or exit on MSI scm model.
Signed-off-by: default avatarLee, Chun-Yi <jlee@novell.com>
parent 1ac34072
...@@ -859,6 +859,11 @@ static int __init msi_init(void) ...@@ -859,6 +859,11 @@ static int __init msi_init(void)
fail_platform_device2: fail_platform_device2:
if (load_scm_model) {
i8042_remove_filter(msi_laptop_i8042_filter);
cancel_delayed_work_sync(&msi_rfkill_work);
rfkill_cleanup();
}
platform_device_del(msipf_device); platform_device_del(msipf_device);
fail_platform_device1: fail_platform_device1:
...@@ -878,6 +883,11 @@ static int __init msi_init(void) ...@@ -878,6 +883,11 @@ static int __init msi_init(void)
static void __exit msi_cleanup(void) static void __exit msi_cleanup(void)
{ {
if (load_scm_model) {
i8042_remove_filter(msi_laptop_i8042_filter);
cancel_delayed_work_sync(&msi_rfkill_work);
rfkill_cleanup();
}
sysfs_remove_group(&msipf_device->dev.kobj, &msipf_attribute_group); sysfs_remove_group(&msipf_device->dev.kobj, &msipf_attribute_group);
if (!old_ec_model && threeg_exists) if (!old_ec_model && threeg_exists)
...@@ -886,9 +896,6 @@ static void __exit msi_cleanup(void) ...@@ -886,9 +896,6 @@ static void __exit msi_cleanup(void)
platform_driver_unregister(&msipf_driver); platform_driver_unregister(&msipf_driver);
backlight_device_unregister(msibl_device); backlight_device_unregister(msibl_device);
i8042_remove_filter(msi_laptop_i8042_filter);
rfkill_cleanup();
/* Enable automatic brightness control again */ /* Enable automatic brightness control again */
if (auto_brightness != 2) if (auto_brightness != 2)
set_auto_brightness(1); set_auto_brightness(1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment