Commit 31a5d9ca authored by Stanley Chu's avatar Stanley Chu Committed by Martin K. Petersen

scsi: ufs: Un-inline ufshcd_vops_device_reset function

More and more statements are being added to ufshcd_vops_device_reset() and
this function is being called from multiple locations in the driver.
Un-inline the function to allow the compiler to make better decisions.

Link: https://lore.kernel.org/r/20201208135635.15326-3-stanley.chu@mediatek.comReviewed-by: default avatarBean Huo <beanhuo@micron.com>
Signed-off-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent bd14bf0e
...@@ -581,6 +581,23 @@ static void ufshcd_print_pwr_info(struct ufs_hba *hba) ...@@ -581,6 +581,23 @@ static void ufshcd_print_pwr_info(struct ufs_hba *hba)
hba->pwr_info.hs_rate); hba->pwr_info.hs_rate);
} }
static void ufshcd_device_reset(struct ufs_hba *hba)
{
int err;
err = ufshcd_vops_device_reset(hba);
if (!err) {
ufshcd_set_ufs_dev_active(hba);
if (ufshcd_is_wb_allowed(hba)) {
hba->wb_enabled = false;
hba->wb_buf_flush_enabled = false;
}
}
if (err != -EOPNOTSUPP)
ufshcd_update_evt_hist(hba, UFS_EVT_DEV_RESET, err);
}
void ufshcd_delay_us(unsigned long us, unsigned long tolerance) void ufshcd_delay_us(unsigned long us, unsigned long tolerance)
{ {
if (!us) if (!us)
...@@ -3933,7 +3950,7 @@ int ufshcd_link_recovery(struct ufs_hba *hba) ...@@ -3933,7 +3950,7 @@ int ufshcd_link_recovery(struct ufs_hba *hba)
spin_unlock_irqrestore(hba->host->host_lock, flags); spin_unlock_irqrestore(hba->host->host_lock, flags);
/* Reset the attached device */ /* Reset the attached device */
ufshcd_vops_device_reset(hba); ufshcd_device_reset(hba);
ret = ufshcd_host_reset_and_restore(hba); ret = ufshcd_host_reset_and_restore(hba);
...@@ -6935,7 +6952,7 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba) ...@@ -6935,7 +6952,7 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba)
do { do {
/* Reset the attached device */ /* Reset the attached device */
ufshcd_vops_device_reset(hba); ufshcd_device_reset(hba);
err = ufshcd_host_reset_and_restore(hba); err = ufshcd_host_reset_and_restore(hba);
} while (err && --retries); } while (err && --retries);
...@@ -8708,7 +8725,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) ...@@ -8708,7 +8725,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
* further below. * further below.
*/ */
if (ufshcd_is_ufs_dev_deepsleep(hba)) { if (ufshcd_is_ufs_dev_deepsleep(hba)) {
ufshcd_vops_device_reset(hba); ufshcd_device_reset(hba);
WARN_ON(!ufshcd_is_link_off(hba)); WARN_ON(!ufshcd_is_link_off(hba));
} }
if (ufshcd_is_link_hibern8(hba) && !ufshcd_uic_hibern8_exit(hba)) if (ufshcd_is_link_hibern8(hba) && !ufshcd_uic_hibern8_exit(hba))
...@@ -8718,7 +8735,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) ...@@ -8718,7 +8735,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
set_dev_active: set_dev_active:
/* Can also get here needing to exit DeepSleep */ /* Can also get here needing to exit DeepSleep */
if (ufshcd_is_ufs_dev_deepsleep(hba)) { if (ufshcd_is_ufs_dev_deepsleep(hba)) {
ufshcd_vops_device_reset(hba); ufshcd_device_reset(hba);
ufshcd_host_reset_and_restore(hba); ufshcd_host_reset_and_restore(hba);
} }
if (!ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE)) if (!ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE))
...@@ -9317,7 +9334,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) ...@@ -9317,7 +9334,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
} }
/* Reset the attached device */ /* Reset the attached device */
ufshcd_vops_device_reset(hba); ufshcd_device_reset(hba);
ufshcd_init_crypto(hba); ufshcd_init_crypto(hba);
......
...@@ -1216,21 +1216,12 @@ static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba) ...@@ -1216,21 +1216,12 @@ static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)
hba->vops->dbg_register_dump(hba); hba->vops->dbg_register_dump(hba);
} }
static inline void ufshcd_vops_device_reset(struct ufs_hba *hba) static inline int ufshcd_vops_device_reset(struct ufs_hba *hba)
{ {
if (hba->vops && hba->vops->device_reset) { if (hba->vops && hba->vops->device_reset)
int err = hba->vops->device_reset(hba); return hba->vops->device_reset(hba);
if (!err) { return -EOPNOTSUPP;
ufshcd_set_ufs_dev_active(hba);
if (ufshcd_is_wb_allowed(hba)) {
hba->wb_enabled = false;
hba->wb_buf_flush_enabled = false;
}
}
if (err != -EOPNOTSUPP)
ufshcd_update_evt_hist(hba, UFS_EVT_DEV_RESET, err);
}
} }
static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba, static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment