Skip to content

Commit 3f02cc9

Browse files
cometzeromartinkpetersen
authored andcommitted
scsi: ufs: ufs-exynos: Factor out priv data init
To leverage the initialization code for the other variant of the exynos-ufs driver, factor out the assignment part. Link: https://lore.kernel.org/r/20211018124216.153072-10-chanho61.park@samsung.com Cc: Alim Akhtar <alim.akhtar@samsung.com> Cc: Kiwoong Kim <kwmad.kim@samsung.com> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Signed-off-by: Chanho Park <chanho61.park@samsung.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent a271885 commit 3f02cc9

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

drivers/scsi/ufs/ufs-exynos.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,18 @@ static int exynos_ufs_parse_dt(struct device *dev, struct exynos_ufs *ufs)
946946
return ret;
947947
}
948948

949+
static inline void exynos_ufs_priv_init(struct ufs_hba *hba,
950+
struct exynos_ufs *ufs)
951+
{
952+
ufs->hba = hba;
953+
ufs->opts = ufs->drv_data->opts;
954+
ufs->rx_sel_idx = PA_MAXDATALANES;
955+
if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX)
956+
ufs->rx_sel_idx = 0;
957+
hba->priv = (void *)ufs;
958+
hba->quirks = ufs->drv_data->quirks;
959+
}
960+
949961
static int exynos_ufs_init(struct ufs_hba *hba)
950962
{
951963
struct device *dev = hba->dev;
@@ -995,13 +1007,8 @@ static int exynos_ufs_init(struct ufs_hba *hba)
9951007
if (ret)
9961008
goto phy_off;
9971009

998-
ufs->hba = hba;
999-
ufs->opts = ufs->drv_data->opts;
1000-
ufs->rx_sel_idx = PA_MAXDATALANES;
1001-
if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX)
1002-
ufs->rx_sel_idx = 0;
1003-
hba->priv = (void *)ufs;
1004-
hba->quirks = ufs->drv_data->quirks;
1010+
exynos_ufs_priv_init(hba, ufs);
1011+
10051012
if (ufs->drv_data->drv_init) {
10061013
ret = ufs->drv_data->drv_init(dev, ufs);
10071014
if (ret) {

0 commit comments

Comments
 (0)