Commit aeddb6d5 authored by David S. Miller's avatar David S. Miller

Merge branch 'emaclite-fixes'

Radhey Shyam Pandey says:

====================
emaclite bug fixes and code cleanup

This patch series fixes bug in emaclite remove and mdio_setup routines.
It does minor code cleanup.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4fd44a98 560c5bdd
...@@ -123,7 +123,6 @@ ...@@ -123,7 +123,6 @@
* @phy_node: pointer to the PHY device node * @phy_node: pointer to the PHY device node
* @mii_bus: pointer to the MII bus * @mii_bus: pointer to the MII bus
* @last_link: last link status * @last_link: last link status
* @has_mdio: indicates whether MDIO is included in the HW
*/ */
struct net_local { struct net_local {
...@@ -144,7 +143,6 @@ struct net_local { ...@@ -144,7 +143,6 @@ struct net_local {
struct mii_bus *mii_bus; struct mii_bus *mii_bus;
int last_link; int last_link;
bool has_mdio;
}; };
...@@ -863,14 +861,14 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) ...@@ -863,14 +861,14 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
bus->write = xemaclite_mdio_write; bus->write = xemaclite_mdio_write;
bus->parent = dev; bus->parent = dev;
lp->mii_bus = bus;
rc = of_mdiobus_register(bus, np); rc = of_mdiobus_register(bus, np);
if (rc) { if (rc) {
dev_err(dev, "Failed to register mdio bus.\n"); dev_err(dev, "Failed to register mdio bus.\n");
goto err_register; goto err_register;
} }
lp->mii_bus = bus;
return 0; return 0;
err_register: err_register:
...@@ -1145,9 +1143,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev) ...@@ -1145,9 +1143,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
xemaclite_update_address(lp, ndev->dev_addr); xemaclite_update_address(lp, ndev->dev_addr);
lp->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0); lp->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0);
rc = xemaclite_mdio_setup(lp, &ofdev->dev); xemaclite_mdio_setup(lp, &ofdev->dev);
if (rc)
dev_warn(&ofdev->dev, "error registering MDIO bus\n");
dev_info(dev, "MAC address is now %pM\n", ndev->dev_addr); dev_info(dev, "MAC address is now %pM\n", ndev->dev_addr);
...@@ -1191,7 +1187,7 @@ static int xemaclite_of_remove(struct platform_device *of_dev) ...@@ -1191,7 +1187,7 @@ static int xemaclite_of_remove(struct platform_device *of_dev)
struct net_local *lp = netdev_priv(ndev); struct net_local *lp = netdev_priv(ndev);
/* Un-register the mii_bus, if configured */ /* Un-register the mii_bus, if configured */
if (lp->has_mdio) { if (lp->mii_bus) {
mdiobus_unregister(lp->mii_bus); mdiobus_unregister(lp->mii_bus);
mdiobus_free(lp->mii_bus); mdiobus_free(lp->mii_bus);
lp->mii_bus = NULL; lp->mii_bus = NULL;
......
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