Skip to content

Commit 31a5d9c

Browse files
Stanley Chumartinkpetersen
authored andcommitted
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/[email protected] Reviewed-by: Bean Huo <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent bd14bf0 commit 31a5d9c

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

drivers/scsi/ufs/ufshcd.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,23 @@ static void ufshcd_print_pwr_info(struct ufs_hba *hba)
581581
hba->pwr_info.hs_rate);
582582
}
583583

584+
static void ufshcd_device_reset(struct ufs_hba *hba)
585+
{
586+
int err;
587+
588+
err = ufshcd_vops_device_reset(hba);
589+
590+
if (!err) {
591+
ufshcd_set_ufs_dev_active(hba);
592+
if (ufshcd_is_wb_allowed(hba)) {
593+
hba->wb_enabled = false;
594+
hba->wb_buf_flush_enabled = false;
595+
}
596+
}
597+
if (err != -EOPNOTSUPP)
598+
ufshcd_update_evt_hist(hba, UFS_EVT_DEV_RESET, err);
599+
}
600+
584601
void ufshcd_delay_us(unsigned long us, unsigned long tolerance)
585602
{
586603
if (!us)
@@ -3933,7 +3950,7 @@ int ufshcd_link_recovery(struct ufs_hba *hba)
39333950
spin_unlock_irqrestore(hba->host->host_lock, flags);
39343951

39353952
/* Reset the attached device */
3936-
ufshcd_vops_device_reset(hba);
3953+
ufshcd_device_reset(hba);
39373954

39383955
ret = ufshcd_host_reset_and_restore(hba);
39393956

@@ -6935,7 +6952,7 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba)
69356952

69366953
do {
69376954
/* Reset the attached device */
6938-
ufshcd_vops_device_reset(hba);
6955+
ufshcd_device_reset(hba);
69396956

69406957
err = ufshcd_host_reset_and_restore(hba);
69416958
} while (err && --retries);
@@ -8708,7 +8725,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
87088725
* further below.
87098726
*/
87108727
if (ufshcd_is_ufs_dev_deepsleep(hba)) {
8711-
ufshcd_vops_device_reset(hba);
8728+
ufshcd_device_reset(hba);
87128729
WARN_ON(!ufshcd_is_link_off(hba));
87138730
}
87148731
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)
87188735
set_dev_active:
87198736
/* Can also get here needing to exit DeepSleep */
87208737
if (ufshcd_is_ufs_dev_deepsleep(hba)) {
8721-
ufshcd_vops_device_reset(hba);
8738+
ufshcd_device_reset(hba);
87228739
ufshcd_host_reset_and_restore(hba);
87238740
}
87248741
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)
93179334
}
93189335

93199336
/* Reset the attached device */
9320-
ufshcd_vops_device_reset(hba);
9337+
ufshcd_device_reset(hba);
93219338

93229339
ufshcd_init_crypto(hba);
93239340

drivers/scsi/ufs/ufshcd.h

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,21 +1216,12 @@ static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)
12161216
hba->vops->dbg_register_dump(hba);
12171217
}
12181218

1219-
static inline void ufshcd_vops_device_reset(struct ufs_hba *hba)
1219+
static inline int ufshcd_vops_device_reset(struct ufs_hba *hba)
12201220
{
1221-
if (hba->vops && hba->vops->device_reset) {
1222-
int err = hba->vops->device_reset(hba);
1223-
1224-
if (!err) {
1225-
ufshcd_set_ufs_dev_active(hba);
1226-
if (ufshcd_is_wb_allowed(hba)) {
1227-
hba->wb_enabled = false;
1228-
hba->wb_buf_flush_enabled = false;
1229-
}
1230-
}
1231-
if (err != -EOPNOTSUPP)
1232-
ufshcd_update_evt_hist(hba, UFS_EVT_DEV_RESET, err);
1233-
}
1221+
if (hba->vops && hba->vops->device_reset)
1222+
return hba->vops->device_reset(hba);
1223+
1224+
return -EOPNOTSUPP;
12341225
}
12351226

12361227
static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,

0 commit comments

Comments
 (0)