On Sat, Sep 24, 2022 at 07:02:58PM +0300, Dmitry Baryshkov wrote: > Split the code using PHY programming tables into separate functions, > which take a single struct qmp_phy_cfg_tables instance. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> > --- > drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 80 ++++++++++++++---------- > 1 file changed, 48 insertions(+), 32 deletions(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > index 30806816c8b0..6e8c74585670 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > @@ -1877,15 +1877,53 @@ static void qmp_pcie_configure(void __iomem *base, > qmp_pcie_configure_lane(base, regs, tbl, num, 0xff); > } > > -static int qmp_pcie_serdes_init(struct qmp_phy *qphy) > +static void qmp_pcie_serdes_init(struct qmp_phy *qphy, const struct qmp_phy_cfg_tables *tables) > { > const struct qmp_phy_cfg *cfg = qphy->cfg; > void __iomem *serdes = qphy->serdes; > > - qmp_pcie_configure(serdes, cfg->regs, cfg->common.serdes_tbl, cfg->common.serdes_tbl_num); > - qmp_pcie_configure(serdes, cfg->regs, cfg->extra->serdes_tbl, cfg->extra->serdes_tbl_num); > + if (!tables) > + return; > > - return 0; > + qmp_pcie_configure(serdes, cfg->regs, tables->serdes_tbl, tables->serdes_tbl_num); See what I mean about "_tbl" being redundant in "tables->serdes_tbl"? > +} > static int qmp_pcie_init(struct phy *phy) > @@ -1957,15 +1995,13 @@ static int qmp_pcie_power_on(struct phy *phy) > struct qmp_phy *qphy = phy_get_drvdata(phy); > struct qcom_qmp *qmp = qphy->qmp; > const struct qmp_phy_cfg *cfg = qphy->cfg; > - void __iomem *tx = qphy->tx; > - void __iomem *rx = qphy->rx; > void __iomem *pcs = qphy->pcs; > - void __iomem *pcs_misc = qphy->pcs_misc; > void __iomem *status; > unsigned int mask, val, ready; > int ret; > > - qmp_pcie_serdes_init(qphy); > + qmp_pcie_serdes_init(qphy, &cfg->common); > + qmp_pcie_serdes_init(qphy, cfg->extra); And "common" and "extra" doesn't really say what it is you're passing here. > > ret = clk_prepare_enable(qphy->pipe_clk); > if (ret) { Johan