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-usb: 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/20221028160435.26948-8-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Johan Hovold and committed by
Vinod Koul
413db06c 8ec02ba8

+22 -24
+22 -24
drivers/phy/qualcomm/phy-qcom-qmp-usb.c
··· 2250 2250 qmp_usb_runtime_resume, NULL) 2251 2251 }; 2252 2252 2253 - static int qmp_usb_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) 2253 + static int qmp_usb_vreg_init(struct qmp_usb *qmp) 2254 2254 { 2255 - struct qmp_usb *qmp = dev_get_drvdata(dev); 2255 + const struct qmp_phy_cfg *cfg = qmp->cfg; 2256 + struct device *dev = qmp->dev; 2256 2257 int num = cfg->num_vregs; 2257 2258 int i; 2258 2259 ··· 2267 2266 return devm_regulator_bulk_get(dev, num, qmp->vregs); 2268 2267 } 2269 2268 2270 - static int qmp_usb_reset_init(struct device *dev, const struct qmp_phy_cfg *cfg) 2269 + static int qmp_usb_reset_init(struct qmp_usb *qmp) 2271 2270 { 2272 - struct qmp_usb *qmp = dev_get_drvdata(dev); 2271 + const struct qmp_phy_cfg *cfg = qmp->cfg; 2272 + struct device *dev = qmp->dev; 2273 2273 int i; 2274 2274 int ret; 2275 2275 ··· 2289 2287 return 0; 2290 2288 } 2291 2289 2292 - static int qmp_usb_clk_init(struct device *dev, const struct qmp_phy_cfg *cfg) 2290 + static int qmp_usb_clk_init(struct qmp_usb *qmp) 2293 2291 { 2294 - struct qmp_usb *qmp = dev_get_drvdata(dev); 2292 + const struct qmp_phy_cfg *cfg = qmp->cfg; 2293 + struct device *dev = qmp->dev; 2295 2294 int num = cfg->num_clks; 2296 2295 int i; 2297 2296 ··· 2388 2385 return devm_of_iomap(dev, np, index, NULL); 2389 2386 } 2390 2387 2391 - static int qmp_usb_create(struct device *dev, struct device_node *np, 2392 - void __iomem *serdes, const struct qmp_phy_cfg *cfg) 2388 + static int qmp_usb_create(struct qmp_usb *qmp, struct device_node *np) 2393 2389 { 2394 - struct qmp_usb *qmp = dev_get_drvdata(dev); 2390 + const struct qmp_phy_cfg *cfg = qmp->cfg; 2391 + struct device *dev = qmp->dev; 2395 2392 struct phy *generic_phy; 2396 2393 bool exclusive = true; 2397 2394 int ret; ··· 2405 2402 if (of_device_is_compatible(dev->of_node, "qcom,sm8350-qmp-usb3-uni-phy")) 2406 2403 exclusive = false; 2407 2404 2408 - qmp->cfg = cfg; 2409 - qmp->serdes = serdes; 2410 2405 /* 2411 2406 * Get memory resources for the PHY: 2412 2407 * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. ··· 2469 2468 struct device *dev = &pdev->dev; 2470 2469 struct device_node *child; 2471 2470 struct phy_provider *phy_provider; 2472 - void __iomem *serdes; 2473 - const struct qmp_phy_cfg *cfg = NULL; 2474 2471 struct qmp_usb *qmp; 2475 2472 int ret; 2476 2473 ··· 2477 2478 return -ENOMEM; 2478 2479 2479 2480 qmp->dev = dev; 2480 - dev_set_drvdata(dev, qmp); 2481 2481 2482 - cfg = of_device_get_match_data(dev); 2483 - if (!cfg) 2482 + qmp->cfg = of_device_get_match_data(dev); 2483 + if (!qmp->cfg) 2484 2484 return -EINVAL; 2485 2485 2486 - serdes = devm_platform_ioremap_resource(pdev, 0); 2487 - if (IS_ERR(serdes)) 2488 - return PTR_ERR(serdes); 2486 + qmp->serdes = devm_platform_ioremap_resource(pdev, 0); 2487 + if (IS_ERR(qmp->serdes)) 2488 + return PTR_ERR(qmp->serdes); 2489 2489 2490 - if (cfg->has_phy_dp_com_ctrl) { 2490 + if (qmp->cfg->has_phy_dp_com_ctrl) { 2491 2491 qmp->dp_com = devm_platform_ioremap_resource(pdev, 1); 2492 2492 if (IS_ERR(qmp->dp_com)) 2493 2493 return PTR_ERR(qmp->dp_com); 2494 2494 } 2495 2495 2496 - ret = qmp_usb_clk_init(dev, cfg); 2496 + ret = qmp_usb_clk_init(qmp); 2497 2497 if (ret) 2498 2498 return ret; 2499 2499 2500 - ret = qmp_usb_reset_init(dev, cfg); 2500 + ret = qmp_usb_reset_init(qmp); 2501 2501 if (ret) 2502 2502 return ret; 2503 2503 2504 - ret = qmp_usb_vreg_init(dev, cfg); 2504 + ret = qmp_usb_vreg_init(qmp); 2505 2505 if (ret) 2506 2506 return ret; 2507 2507 ··· 2518 2520 */ 2519 2521 pm_runtime_forbid(dev); 2520 2522 2521 - ret = qmp_usb_create(dev, child, serdes, cfg); 2523 + ret = qmp_usb_create(qmp, child); 2522 2524 if (ret) 2523 2525 goto err_node_put; 2524 2526