Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: qcom-qmp-pcie: clean up probe initialisation

Stop abusing the driver data pointer and instead pass the driver state
structure directly to the initialisation helpers during probe.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20221105145939.20318-6-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Johan Hovold and committed by
Vinod Koul
52b99773 393ed5d5

+23 -26
+23 -26
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
··· 2037 2037 return 0; 2038 2038 } 2039 2039 2040 - static int qmp_pcie_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) 2040 + static int qmp_pcie_vreg_init(struct qmp_pcie *qmp) 2041 2041 { 2042 - struct qmp_pcie *qmp = dev_get_drvdata(dev); 2042 + const struct qmp_phy_cfg *cfg = qmp->cfg; 2043 + struct device *dev = qmp->dev; 2043 2044 int num = cfg->num_vregs; 2044 2045 int i; 2045 2046 ··· 2054 2053 return devm_regulator_bulk_get(dev, num, qmp->vregs); 2055 2054 } 2056 2055 2057 - static int qmp_pcie_reset_init(struct device *dev, const struct qmp_phy_cfg *cfg) 2056 + static int qmp_pcie_reset_init(struct qmp_pcie *qmp) 2058 2057 { 2059 - struct qmp_pcie *qmp = dev_get_drvdata(dev); 2058 + const struct qmp_phy_cfg *cfg = qmp->cfg; 2059 + struct device *dev = qmp->dev; 2060 2060 int i; 2061 2061 int ret; 2062 2062 ··· 2076 2074 return 0; 2077 2075 } 2078 2076 2079 - static int qmp_pcie_clk_init(struct device *dev, const struct qmp_phy_cfg *cfg) 2077 + static int qmp_pcie_clk_init(struct qmp_pcie *qmp) 2080 2078 { 2081 - struct qmp_pcie *qmp = dev_get_drvdata(dev); 2079 + const struct qmp_phy_cfg *cfg = qmp->cfg; 2080 + struct device *dev = qmp->dev; 2082 2081 int num = cfg->num_clks; 2083 2082 int i; 2084 2083 ··· 2167 2164 .owner = THIS_MODULE, 2168 2165 }; 2169 2166 2170 - static int qmp_pcie_create(struct device *dev, struct device_node *np, 2171 - void __iomem *serdes, const struct qmp_phy_cfg *cfg) 2167 + static int qmp_pcie_create(struct qmp_pcie *qmp, struct device_node *np) 2172 2168 { 2173 - struct qmp_pcie *qmp = dev_get_drvdata(dev); 2169 + const struct qmp_phy_cfg *cfg = qmp->cfg; 2170 + struct device *dev = qmp->dev; 2174 2171 struct phy *generic_phy; 2175 2172 int ret; 2176 2173 2177 2174 qmp->mode = PHY_MODE_PCIE_RC; 2178 - 2179 - qmp->cfg = cfg; 2180 - qmp->serdes = serdes; 2181 2175 2182 2176 /* 2183 2177 * Get memory resources for the PHY: ··· 2247 2247 struct device *dev = &pdev->dev; 2248 2248 struct device_node *child; 2249 2249 struct phy_provider *phy_provider; 2250 - void __iomem *serdes; 2251 - const struct qmp_phy_cfg *cfg = NULL; 2252 2250 struct qmp_pcie *qmp; 2253 2251 int ret; 2254 2252 ··· 2255 2257 return -ENOMEM; 2256 2258 2257 2259 qmp->dev = dev; 2258 - dev_set_drvdata(dev, qmp); 2259 2260 2260 - cfg = of_device_get_match_data(dev); 2261 - if (!cfg) 2261 + qmp->cfg = of_device_get_match_data(dev); 2262 + if (!qmp->cfg) 2262 2263 return -EINVAL; 2263 2264 2264 - WARN_ON_ONCE(!cfg->pwrdn_ctrl); 2265 - WARN_ON_ONCE(!cfg->phy_status); 2265 + WARN_ON_ONCE(!qmp->cfg->pwrdn_ctrl); 2266 + WARN_ON_ONCE(!qmp->cfg->phy_status); 2266 2267 2267 - serdes = devm_platform_ioremap_resource(pdev, 0); 2268 - if (IS_ERR(serdes)) 2269 - return PTR_ERR(serdes); 2268 + qmp->serdes = devm_platform_ioremap_resource(pdev, 0); 2269 + if (IS_ERR(qmp->serdes)) 2270 + return PTR_ERR(qmp->serdes); 2270 2271 2271 - ret = qmp_pcie_clk_init(dev, cfg); 2272 + ret = qmp_pcie_clk_init(qmp); 2272 2273 if (ret) 2273 2274 return ret; 2274 2275 2275 - ret = qmp_pcie_reset_init(dev, cfg); 2276 + ret = qmp_pcie_reset_init(qmp); 2276 2277 if (ret) 2277 2278 return ret; 2278 2279 2279 - ret = qmp_pcie_vreg_init(dev, cfg); 2280 + ret = qmp_pcie_vreg_init(qmp); 2280 2281 if (ret) 2281 2282 return ret; 2282 2283 ··· 2283 2286 if (!child) 2284 2287 return -EINVAL; 2285 2288 2286 - ret = qmp_pcie_create(dev, child, serdes, cfg); 2289 + ret = qmp_pcie_create(qmp, child); 2287 2290 if (ret) 2288 2291 goto err_node_put; 2289 2292