ibm/emac: fix improper cleanup when device is removed to allow re-bind
authorWolfgang Grandegger <wg@grandegger.com>
Thu, 17 Nov 2011 03:06:44 +0000 (03:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Nov 2011 22:04:57 +0000 (17:04 -0500)
The re-binding (unbind..bind) of an EMAC device fails because the
static variable "busy_phy_map" is not updated when the device is
removed.

Signed-off-by: Wolfgang Grandegger <wg@denx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/emac/core.c

index ed79b2d3ad3ebaee10cf400606481dc3a3ea5a4e..2abce965c7bdf81105238bdc890581141b3ecb85 100644 (file)
@@ -2924,6 +2924,9 @@ static int __devexit emac_remove(struct platform_device *ofdev)
        if (emac_has_feature(dev, EMAC_FTR_HAS_ZMII))
                zmii_detach(dev->zmii_dev, dev->zmii_port);
 
+       busy_phy_map &= ~(1 << dev->phy.address);
+       DBG(dev, "busy_phy_map now %#x" NL, busy_phy_map);
+
        mal_unregister_commac(dev->mal, &dev->commac);
        emac_put_deps(dev);