power: mmi_pl_chg_manager: uninstall driver module

change the remove func of mmi_pl_chg_manager that fixed the panic
issue when uninstall mmi_pl_chg_manager driver

Change-Id: Ifbac5fadfef8e6e6dbdf4e11a892c27ac7b4cc71
Signed-off-by: xuwt2 <xuwt2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1245080
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Master Yoda
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
xuwt2 2018-09-21 15:53:11 +08:00 • committed by Wentao Xu
commit 9a7380886d

View file

@ -2164,6 +2164,12 @@ static void create_sysfs_entries(struct mmi_pl_chg_manager *chip)
mmi_pl_err(chip, "Couldn't create factory_pmic_enable\n");
}
static void remove_sysfs_entries(struct mmi_pl_chg_manager *chip)
{
device_remove_file(chip->dev, &dev_attr_flashc_vbat);
device_remove_file(chip->dev, &dev_attr_factory_flashc_enable);
device_remove_file(chip->dev, &dev_attr_factory_pmic_enable);
}
static enum power_supply_property mmi_pl_pm_props[] = {
POWER_SUPPLY_PROP_PD_CURRENT_MAX,
@ -2387,6 +2393,12 @@ static int mmi_pl_chg_manager_remove(struct platform_device *pdev)
{
struct mmi_pl_chg_manager *chip = platform_get_drvdata(pdev);
remove_sysfs_entries(chip);
cancel_delayed_work_sync(&chip->mmi_pl_sm_work);
power_supply_unreg_notifier(&chip->psy_nb);
power_supply_unregister(chip->mmi_pl_pm_psy );
platform_set_drvdata(pdev, NULL);
devm_kfree(&pdev->dev, chip);
return 0;