Skip to content

Commit

Permalink
scsi: ufs: ufs-exynos: Factor out priv data init
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chanho Park authored and Martin K. Petersen committed Oct 28, 2021
1 parent a271885 commit 3f02cc9
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions drivers/scsi/ufs/ufs-exynos.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,18 @@ static int exynos_ufs_parse_dt(struct device *dev, struct exynos_ufs *ufs)
return ret;
}

static inline void exynos_ufs_priv_init(struct ufs_hba *hba,
struct exynos_ufs *ufs)
{
ufs->hba = hba;
ufs->opts = ufs->drv_data->opts;
ufs->rx_sel_idx = PA_MAXDATALANES;
if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX)
ufs->rx_sel_idx = 0;
hba->priv = (void *)ufs;
hba->quirks = ufs->drv_data->quirks;
}

static int exynos_ufs_init(struct ufs_hba *hba)
{
struct device *dev = hba->dev;
Expand Down Expand Up @@ -995,13 +1007,8 @@ static int exynos_ufs_init(struct ufs_hba *hba)
if (ret)
goto phy_off;

ufs->hba = hba;
ufs->opts = ufs->drv_data->opts;
ufs->rx_sel_idx = PA_MAXDATALANES;
if (ufs->opts & EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX)
ufs->rx_sel_idx = 0;
hba->priv = (void *)ufs;
hba->quirks = ufs->drv_data->quirks;
exynos_ufs_priv_init(hba, ufs);

if (ufs->drv_data->drv_init) {
ret = ufs->drv_data->drv_init(dev, ufs);
if (ret) {
Expand Down

0 comments on commit 3f02cc9

Please sign in to comment.