phy/rockchip: Use of_device_get_match_data()

Use of_device_get_match_data() to simplify the code.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220304011755.2061529-1-chi.minghao@zte.com.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
Minghao Chi (CGEL ZTE) 2022-03-04 01:17:55 +00:00 committed by Vinod Koul
parent 3eb836df4d
commit 2404387f52
1 changed files with 2 additions and 4 deletions

View File

@ -1105,15 +1105,14 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct resource *res; struct resource *res;
const struct rockchip_usb3phy_port_cfg *phy_cfgs; const struct rockchip_usb3phy_port_cfg *phy_cfgs;
const struct of_device_id *match;
int index, ret; int index, ret;
tcphy = devm_kzalloc(dev, sizeof(*tcphy), GFP_KERNEL); tcphy = devm_kzalloc(dev, sizeof(*tcphy), GFP_KERNEL);
if (!tcphy) if (!tcphy)
return -ENOMEM; return -ENOMEM;
match = of_match_device(dev->driver->of_match_table, dev); phy_cfgs = of_device_get_match_data(dev);
if (!match || !match->data) { if (!phy_cfgs) {
dev_err(dev, "phy configs are not assigned!\n"); dev_err(dev, "phy configs are not assigned!\n");
return -EINVAL; return -EINVAL;
} }
@ -1123,7 +1122,6 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
if (IS_ERR(tcphy->base)) if (IS_ERR(tcphy->base))
return PTR_ERR(tcphy->base); return PTR_ERR(tcphy->base);
phy_cfgs = match->data;
/* find out a proper config which can be matched with dt. */ /* find out a proper config which can be matched with dt. */
index = 0; index = 0;
while (phy_cfgs[index].reg) { while (phy_cfgs[index].reg) {