diff --git a/drivers/misc/sx9310/sx9310_triple.c b/drivers/misc/sx9310/sx9310_triple.c index d9063cddd7cb..302545988448 100644 --- a/drivers/misc/sx9310/sx9310_triple.c +++ b/drivers/misc/sx9310/sx9310_triple.c @@ -1439,11 +1439,13 @@ static int sx9310_remove(struct i2c_client *client) psx93XX_t this = i2c_get_clientdata(client); pDevice = this->pDevice; + pplatData = client->dev.platform_data; if (this && pDevice) { #if defined(CONFIG_FB) fb_unregister_client(&this->fb_notif); #endif power_supply_unreg_notifier(&this->ps_notif); + cancel_work_sync(&this->ps_notify_work); #ifdef USE_SENSORS_CLASS sensors_classdev_unregister(&sensors_capsensor_top_cdev); @@ -1453,6 +1455,8 @@ static int sx9310_remove(struct i2c_client *client) input_unregister_device( pDevice->pbuttonInformation->input_bottom); + if (gpio_is_valid(pplatData ->irq_gpio)) + gpio_free(pplatData ->irq_gpio); if (this->board->cap_svdd_en) { regulator_disable(this->board->cap_svdd); regulator_put(this->board->cap_svdd); @@ -1464,7 +1468,7 @@ static int sx9310_remove(struct i2c_client *client) } sysfs_remove_group(&client->dev.kobj, &sx9310_attr_group); - pplatData = client->dev.platform_data; + class_unregister(&capsense_class); if (pplatData && pplatData->exit_platform_hw) pplatData->exit_platform_hw(); kfree(this->pDevice);