scsi: ufs: Split ufshcd_probe_hba() based on its called flow
authorBean Huo <beanhuo@micron.com>
Mon, 20 Jan 2020 13:08:15 +0000 (14:08 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 21 Jan 2020 00:16:10 +0000 (19:16 -0500)
commit1b9e21412f72d6f89e2bcc5f24b5e9a010c8a74f
tree14c22e0bf24457a4f6ea62198ade8167c636ff38
parent097500666ec9912a9245160e0e53c1e3944d80d9
scsi: ufs: Split ufshcd_probe_hba() based on its called flow

This patch has two major non-functionality changes:

1. Take scanning host if-statement out from ufshcd_probe_hba(), and move
into a new added function ufshcd_add_lus().  In this new function
ufshcd_add_lus(), the main functionalitis include: ICC initialization, add
well-known LUs, devfreq initialization, UFS bsg probe and scsi host
scan. The reason for this change is that these functionalities only being
called during booting stage flow ufshcd_init()->ufshcd_async_scan(). In the
processes of error handling and power management ufshcd_suspend(),
ufshcd_resume(), ufshcd_probe_hba() being called, but these functionalitis
above metioned are not hit.

2. Move context of initialization of parameters associated with the UFS
device to a new added function ufshcd_device_params_init().  The reason of
this change is that all of these parameters are used by driver, but only
need to be initialized once when booting. Combine them into an integral
function, make them easier maintain.

Link: https://lore.kernel.org/r/20200120130820.1737-4-huobean@gmail.com
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c