Hi Dmitry, On Wed, 02 Dec 2009 01:24:25 -0800, Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> wrote : > diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c > index c284217..8868610 100644 > --- a/drivers/platform/x86/hp-wmi.c > +++ b/drivers/platform/x86/hp-wmi.c > @@ -411,14 +342,29 @@ static int __init hp_wmi_input_setup(void) > hp_wmi_tablet_state()); > input_sync(hp_wmi_input_dev); > > - err = input_register_device(hp_wmi_input_dev); > + err = wmi_install_notify_handler(HPWMI_EVENT_GUID, hp_wmi_notify, NULL); > + if (err) > + goto err_free_keymap; > > - if (err) { > - input_free_device(hp_wmi_input_dev); > - return err; > - } > + err = input_register_device(hp_wmi_input_dev); > + if (err) > + goto err_uninstall_notifier; > > return 0; > + > + err_uninstall_notifier: > + wmi_remove_notify_handler(HPWMI_EVENT_GUID); > + err_free_keymap: > + (hp_wmi_input_dev); > + err_free_dev: > + input_free_device(hp_wmi_input_dev); > + return err; > +} > + > +static void __exit hp_wmi_input_destroy(void) > +{ > + wmi_remove_notify_handler(HPWMI_EVENT_GUID); > + input_unregister_device(hp_wmi_input_dev); > } I'm not sure if you're calling sparse_keymap_free on the exit path. > > static void cleanup_sysfs(struct platform_device *device) > @@ -564,10 +509,9 @@ static int __init hp_wmi_init(void) > > static void __exit hp_wmi_exit(void) > { > - if (wmi_has_guid(HPWMI_EVENT_GUID)) { > - wmi_remove_notify_handler(HPWMI_EVENT_GUID); > - input_unregister_device(hp_wmi_input_dev); > - } > + if (wmi_has_guid(HPWMI_EVENT_GUID)) > + hp_wmi_input_destroy(); > + > if (hp_wmi_platform_dev) { > platform_device_del(hp_wmi_platform_dev); > platform_driver_unregister(&hp_wmi_driver); > OK, I'm guilty, I copied my sparse keymap adaptation for msi-wmi from this patch :-) -- Anisse -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html