Commit bfff5d8e authored by Rosen Penev's avatar Rosen Penev Committed by Jakub Kicinski

net: ag71xx: get reset control using devm api

Currently, the of variant is missing reset_control_put in error paths.
The devm variant does not require it.

Allows removing mdio_reset from the struct as it is not used outside the
function.
Signed-off-by: default avatarRosen Penev <rosenp@gmail.com>
Reviewed-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/20240905194938.8453-6-rosenp@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 441a2798
...@@ -379,7 +379,6 @@ struct ag71xx { ...@@ -379,7 +379,6 @@ struct ag71xx {
u32 fifodata[3]; u32 fifodata[3];
int mac_idx; int mac_idx;
struct reset_control *mdio_reset;
struct clk *clk_mdio; struct clk *clk_mdio;
}; };
...@@ -689,6 +688,7 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) ...@@ -689,6 +688,7 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
{ {
struct device *dev = &ag->pdev->dev; struct device *dev = &ag->pdev->dev;
struct net_device *ndev = ag->ndev; struct net_device *ndev = ag->ndev;
struct reset_control *mdio_reset;
static struct mii_bus *mii_bus; static struct mii_bus *mii_bus;
struct device_node *np, *mnp; struct device_node *np, *mnp;
int err; int err;
...@@ -705,10 +705,10 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) ...@@ -705,10 +705,10 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
if (!mii_bus) if (!mii_bus)
return -ENOMEM; return -ENOMEM;
ag->mdio_reset = of_reset_control_get_exclusive(np, "mdio"); mdio_reset = devm_reset_control_get_exclusive(dev, "mdio");
if (IS_ERR(ag->mdio_reset)) { if (IS_ERR(mdio_reset)) {
netif_err(ag, probe, ndev, "Failed to get reset mdio.\n"); netif_err(ag, probe, ndev, "Failed to get reset mdio.\n");
return PTR_ERR(ag->mdio_reset); return PTR_ERR(mdio_reset);
} }
mii_bus->name = "ag71xx_mdio"; mii_bus->name = "ag71xx_mdio";
...@@ -719,10 +719,10 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) ...@@ -719,10 +719,10 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
mii_bus->parent = dev; mii_bus->parent = dev;
snprintf(mii_bus->id, MII_BUS_ID_SIZE, "%s.%d", np->name, ag->mac_idx); snprintf(mii_bus->id, MII_BUS_ID_SIZE, "%s.%d", np->name, ag->mac_idx);
if (!IS_ERR(ag->mdio_reset)) { if (!IS_ERR(mdio_reset)) {
reset_control_assert(ag->mdio_reset); reset_control_assert(mdio_reset);
msleep(100); msleep(100);
reset_control_deassert(ag->mdio_reset); reset_control_deassert(mdio_reset);
msleep(200); msleep(200);
} }
......
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