Commit 89e1570a authored by Sebastian Reichel's avatar Sebastian Reichel Committed by Vinod Koul

phy: phy-rockchip-inno-usb2: simplify getting match data

Simplify the code by directly getting the match data via
device_get_match_data() instead of open coding its functionality.
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20230522170324.61349-7-sebastian.reichel@collabora.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent b4351123
...@@ -1305,7 +1305,6 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) ...@@ -1305,7 +1305,6 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
struct phy_provider *provider; struct phy_provider *provider;
struct rockchip_usb2phy *rphy; struct rockchip_usb2phy *rphy;
const struct rockchip_usb2phy_cfg *phy_cfgs; const struct rockchip_usb2phy_cfg *phy_cfgs;
const struct of_device_id *match;
unsigned int reg; unsigned int reg;
int index, ret; int index, ret;
...@@ -1313,12 +1312,6 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) ...@@ -1313,12 +1312,6 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
if (!rphy) if (!rphy)
return -ENOMEM; return -ENOMEM;
match = of_match_device(dev->driver->of_match_table, dev);
if (!match || !match->data) {
dev_err(dev, "phy configs are not assigned!\n");
return -EINVAL;
}
if (!dev->parent || !dev->parent->of_node) { if (!dev->parent || !dev->parent->of_node) {
rphy->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,usbgrf"); rphy->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,usbgrf");
if (IS_ERR(rphy->grf)) { if (IS_ERR(rphy->grf)) {
...@@ -1359,12 +1352,15 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) ...@@ -1359,12 +1352,15 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
} }
rphy->dev = dev; rphy->dev = dev;
phy_cfgs = match->data; phy_cfgs = device_get_match_data(dev);
rphy->chg_state = USB_CHG_STATE_UNDEFINED; rphy->chg_state = USB_CHG_STATE_UNDEFINED;
rphy->chg_type = POWER_SUPPLY_TYPE_UNKNOWN; rphy->chg_type = POWER_SUPPLY_TYPE_UNKNOWN;
rphy->irq = platform_get_irq_optional(pdev, 0); rphy->irq = platform_get_irq_optional(pdev, 0);
platform_set_drvdata(pdev, rphy); platform_set_drvdata(pdev, rphy);
if (!phy_cfgs)
return dev_err_probe(dev, -EINVAL, "phy configs are not assigned!\n");
ret = rockchip_usb2phy_extcon_register(rphy); ret = rockchip_usb2phy_extcon_register(rphy);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment