ethernet:gmac: fix the following warnning
authorroger <cz@rock-chips.com>
Thu, 14 Aug 2014 08:09:40 +0000 (16:09 +0800)
committerroger <cz@rock-chips.com>
Thu, 14 Aug 2014 08:09:40 +0000 (16:09 +0800)
[  169.855161] WARNING: at fs/sysfs/dir.c:530 sysfs_adl@one28x7/ 0x9c()
[  169.855236] sysfs: cannot create duplicate filename '/devices/ff290000.eth/stmmac-0:00/phy_reg'

drivers/net/ethernet/rockchip/gmac/stmmac_main.c

index 98a14b3c924e7abe7ffa69d4c0d4a14041052207..70d25661dad22d483450c74bce39ebc9447af60d 100755 (executable)
@@ -876,6 +876,16 @@ int gmac_create_sysfs(struct phy_device * phy_dev) {
        return 0;
 }
 
+int gmac_remove_sysfs(struct phy_device * phy_dev) {
+       int t;
+
+       for (t = 0; t < ARRAY_SIZE(phy_reg_attrs); t++) {
+               device_remove_file(&phy_dev->dev,&phy_reg_attrs[t]);
+       }
+
+       return 0;
+}
+
 /**
  * stmmac_init_phy - PHY initialization
  * @dev: net device structure
@@ -1824,6 +1834,9 @@ static int stmmac_release(struct net_device *dev)
 
        /* Stop and disconnect the PHY */
        if (priv->phydev) {
+
+               gmac_remove_sysfs(priv->phydev);
+
                phy_stop(priv->phydev);
                phy_disconnect(priv->phydev);
                priv->phydev = NULL;