From: hgchu Date: Fri, 12 Jan 2018 02:12:10 +0000 (+0900) Subject: scsi: ufs: guarantee hold and release for vendor's operation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bea8340eb9a6dd53cc651e41df24169f4db57c1a;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git scsi: ufs: guarantee hold and release for vendor's operation Change-Id: I966cd27b854a8fff23c76fbd01ae8c638d01f1d8 Signed-off-by: hgchu --- diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 9686aa31ffaa..515ee921002d 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -3998,8 +3998,10 @@ static int ufshcd_change_power_mode(struct ufs_hba *hba, dev_err(hba->dev, "%s: power mode change failed %d\n", __func__, ret); } else { + ufshcd_hold(hba, false); ret = ufshcd_vops_pwr_change_notify(hba, POST_CHANGE, NULL, pwr_mode); + ufshcd_release(hba); if (ret) goto out; @@ -4021,6 +4023,7 @@ int ufshcd_config_pwr_mode(struct ufs_hba *hba, struct ufs_pa_layer_attr final_params = { 0 }; int ret; + ufshcd_hold(hba, false); ret = ufshcd_vops_pwr_change_notify(hba, PRE_CHANGE, desired_pwr_mode, &final_params); @@ -4035,6 +4038,7 @@ int ufshcd_config_pwr_mode(struct ufs_hba *hba, if (!ret) ufshcd_print_pwr_info(hba); out: + ufshcd_release(hba); return ret; } EXPORT_SYMBOL_GPL(ufshcd_config_pwr_mode); @@ -4258,6 +4262,8 @@ static inline int ufshcd_disable_device_tx_lcc(struct ufs_hba *hba) static int ufshcd_hba_enable(struct ufs_hba *hba) { int ret; + ufshcd_hold(hba, false); + if (hba->vops && hba->vops->host_reset) hba->vops->host_reset(hba); if (hba->quirks & UFSHCD_QUIRK_USE_OF_HCE) { @@ -4270,6 +4276,8 @@ static int ufshcd_hba_enable(struct ufs_hba *hba) } else { ret = __ufshcd_hba_enable(hba); } + ufshcd_release(hba); + if (ret) dev_err(hba->dev, "Host controller enable failed\n"); @@ -4288,6 +4296,9 @@ static int ufshcd_link_startup(struct ufs_hba *hba) int retries = DME_LINKSTARTUP_RETRIES; bool link_startup_again = false; + + ufshcd_hold(hba, false); + /* * If UFS device isn't active then we will have to issue link startup * 2 times to make sure the device state move to active. @@ -4344,6 +4355,8 @@ link_startup: ret = ufshcd_make_hba_operational(hba); out: + ufshcd_release(hba); + if (ret) { dev_err(hba->dev, "link startup failed %d\n", ret); ufshcd_print_host_state(hba);