mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
phy: lynx-28g: refactor lane probing to lynx_28g_probe_lane()
This simplifies the main control flow a little bit and makes the logic reusable for probing the lanes with OF nodes if those exist. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://patch.msgid.link/20251125114847.804961-3-vladimir.oltean@nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
committed by
Vinod Koul
parent
bd2f0117c2
commit
a125feee07
@@ -579,12 +579,33 @@ static struct phy *lynx_28g_xlate(struct device *dev,
|
||||
return priv->lane[idx].phy;
|
||||
}
|
||||
|
||||
static int lynx_28g_probe_lane(struct lynx_28g_priv *priv, int id,
|
||||
struct device_node *dn)
|
||||
{
|
||||
struct lynx_28g_lane *lane = &priv->lane[id];
|
||||
struct phy *phy;
|
||||
|
||||
memset(lane, 0, sizeof(*lane));
|
||||
|
||||
phy = devm_phy_create(priv->dev, dn, &lynx_28g_ops);
|
||||
if (IS_ERR(phy))
|
||||
return PTR_ERR(phy);
|
||||
|
||||
lane->priv = priv;
|
||||
lane->phy = phy;
|
||||
lane->id = id;
|
||||
phy_set_drvdata(phy, lane);
|
||||
lynx_28g_lane_read_configuration(lane);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lynx_28g_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct phy_provider *provider;
|
||||
struct lynx_28g_priv *priv;
|
||||
int i;
|
||||
int err;
|
||||
|
||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
@@ -597,21 +618,10 @@ static int lynx_28g_probe(struct platform_device *pdev)
|
||||
|
||||
lynx_28g_pll_read_configuration(priv);
|
||||
|
||||
for (i = 0; i < LYNX_28G_NUM_LANE; i++) {
|
||||
struct lynx_28g_lane *lane = &priv->lane[i];
|
||||
struct phy *phy;
|
||||
|
||||
memset(lane, 0, sizeof(*lane));
|
||||
|
||||
phy = devm_phy_create(&pdev->dev, NULL, &lynx_28g_ops);
|
||||
if (IS_ERR(phy))
|
||||
return PTR_ERR(phy);
|
||||
|
||||
lane->priv = priv;
|
||||
lane->phy = phy;
|
||||
lane->id = i;
|
||||
phy_set_drvdata(phy, lane);
|
||||
lynx_28g_lane_read_configuration(lane);
|
||||
for (int i = 0; i < LYNX_28G_NUM_LANE; i++) {
|
||||
err = lynx_28g_probe_lane(priv, i, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
dev_set_drvdata(dev, priv);
|
||||
|
||||
Reference in New Issue
Block a user