DLKM:optimise sar sensor remove function

-release related resource about sarsensor registered in probe
   -issue:DLKM // kernel panic when rmmod sx9311_sar module

Change-Id: I5d87494bdf4d1b29135abf6b345b3f7cbc28112f
Signed-off-by: wunan3 <wunan3@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1261468
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Wen Xie <xiewen3@motorola.com>
Reviewed-by: Wang Wang <wangwang1@lenovo.com>
Submit-Approved: Jira Key
This commit is contained in:
wunan3 2018-10-26 20:48:38 +08:00 • committed by Nan Wu
commit 9103601cf6

View file

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