From 9103601cf688fdfe4f65e9c2e4fe48ed1451f741 Mon Sep 17 00:00:00 2001 From: wunan3 Date: Fri, 26 Oct 2018 20:48:38 +0800 Subject: [PATCH] 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 Reviewed-on: https://gerrit.mot.com/1261468 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Wen Xie Reviewed-by: Wang Wang Submit-Approved: Jira Key --- drivers/misc/sx9310/sx9310_triple.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);