From: roger Date: Thu, 14 Aug 2014 08:09:40 +0000 (+0800) Subject: ethernet:gmac: fix the following warnning X-Git-Tag: firefly_0821_release~4898 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1945bbd10fe560385ffa458c547977e7cc9d3d90;p=firefly-linux-kernel-4.4.55.git ethernet:gmac: fix the following warnning [ 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' --- diff --git a/drivers/net/ethernet/rockchip/gmac/stmmac_main.c b/drivers/net/ethernet/rockchip/gmac/stmmac_main.c index 98a14b3c924e..70d25661dad2 100755 --- a/drivers/net/ethernet/rockchip/gmac/stmmac_main.c +++ b/drivers/net/ethernet/rockchip/gmac/stmmac_main.c @@ -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;