Re: [PATCH 4/4] msi-laptop: Add i8042 filter to sync sw state with BIOS when function key pressed

From: Joey Lee
Date: Fri May 14 2010 - 18:49:59 EST


Hi all,

Thank's for Dmitry and Garg's review and point our my driver's problem.

Please kindly review my attached additional patch for clean up all
objects used by MSI scm model when driver initial fail or exit.




Thank's
Joey Lee

æ åï2010-05-13 æ 15:54 -0700ïGreg KH æåï
> On Thu, May 13, 2010 at 05:53:04AM -0600, Joey Lee wrote:
> > Hi Dmitry,
> >
> > Thank's for your review.
> >
> > æ åï2010-05-13 æ 00:52 -0700ïDmitry Torokhov æåï
> > > On Wed, May 12, 2010 at 11:56:47AM -0700, Greg KH wrote:
> > > > static int __init msi_init(void)
> > > > @@ -819,6 +875,7 @@ static void __exit msi_cleanup(void)
> > > > platform_driver_unregister(&msipf_driver);
> > > > backlight_device_unregister(msibl_device);
> > > >
> > > > + i8042_remove_filter(msi_laptop_i8042_filter);
> > >
> > > You also need cancel_delayed_work_sync() here. Sorry for not noticing
> > > this before.
> > >
> >
> > Yes, you are right, need add cancel_delayed_work_sync().
>
> Want to make up an additional patch to add on top of this that does it?
>
> thanks,
>
> greg k-h

>From 6dd1bf2049496e932e681534c0e1f0ffc0b7a47d Mon Sep 17 00:00:00 2001
From: Lee, Chun-Yi <jlee@xxxxxxxxxx>
Date: Sat, 15 May 2010 06:18:54 +0800
Subject: [PATCH] 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: Lee, Chun-Yi <jlee@xxxxxxxxxx>
---
drivers/platform/x86/msi-laptop.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
index cd2c15e..e536232 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
@@ -811,6 +811,11 @@ static int __init msi_init(void)

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);

fail_platform_device1:
@@ -830,15 +835,17 @@ fail_backlight:

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);
platform_device_unregister(msipf_device);
platform_driver_unregister(&msipf_driver);
backlight_device_unregister(msibl_device);

- i8042_remove_filter(msi_laptop_i8042_filter);
- rfkill_cleanup();
-
/* Enable automatic brightness control again */
if (auto_brightness != 2)
set_auto_brightness(1);
--
1.6.0.2