aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-02-14 14:01:24 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-02-14 14:01:24 +0000
commite4468b8202b343b193fcb249e96dcff14583d944 (patch)
tree49e57eaef9c45fceb039edbc74aa7d0d8a77b876 /target
parentfb8cba59c5c7ab2dcce0f1c35335e81915347a00 (diff)
downloadupstream-e4468b8202b343b193fcb249e96dcff14583d944.tar.gz
upstream-e4468b8202b343b193fcb249e96dcff14583d944.tar.bz2
upstream-e4468b8202b343b193fcb249e96dcff14583d944.zip
generic: ar8216: register the switch from the probe routine
Currently the switch gets registered when an ethernet driver connects to a PHY of the switch. This method does not work with the ethernet drivers which are connecting to the PHY from their ndo_open callback. With those ethernet drivers, the driver tries to register the switch each time when the etherned device is opened and this causes a deadlock. Move the switch registration into the probe routine to fix this problem. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35602 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8216.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c
index 811e406f3a..97a2cca6c0 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -1851,7 +1851,6 @@ ar8216_config_init(struct phy_device *phydev)
{
struct ar8216_priv *priv = phydev->priv;
struct net_device *dev = phydev->attached_dev;
- struct switch_dev *swdev;
int ret;
if (WARN_ON(!priv))
@@ -1872,24 +1871,15 @@ ar8216_config_init(struct phy_device *phydev)
return 0;
}
- swdev = &priv->dev;
- swdev->alias = dev_name(&priv->mii_bus->dev);
- ret = register_switch(swdev, NULL);
- if (ret)
- goto err;
-
- pr_info("%s: %s switch registered on %s\n",
- swdev->devname, swdev->name, dev_name(&priv->mii_bus->dev));
-
priv->init = true;
ret = priv->chip->hw_init(priv);
if (ret)
- goto err_unregister_switch;
+ return ret;
ret = ar8216_sw_reset_switch(&priv->dev);
if (ret)
- goto err_unregister_switch;
+ return ret;
/* VID fixup only needed on ar8216 */
if (chip_is_ar8216(priv)) {
@@ -1904,11 +1894,6 @@ ar8216_config_init(struct phy_device *phydev)
ar8xxx_mib_start(priv);
return 0;
-
-err_unregister_switch:
- unregister_switch(&priv->dev);
-err:
- return ret;
}
static int
@@ -2004,6 +1989,7 @@ static int
ar8216_probe(struct phy_device *phydev)
{
struct ar8216_priv *priv;
+ struct switch_dev *swdev;
int ret;
/* skip PHYs at unused adresses */
@@ -2028,6 +2014,15 @@ ar8216_probe(struct phy_device *phydev)
if (ret)
goto free_priv;
+ swdev = &priv->dev;
+ swdev->alias = dev_name(&priv->mii_bus->dev);
+ ret = register_switch(swdev, NULL);
+ if (ret)
+ goto free_priv;
+
+ pr_info("%s: %s switch registered on %s\n",
+ swdev->devname, swdev->name, dev_name(&priv->mii_bus->dev));
+
found:
if (phydev->addr == 0) {
if (ar8xxx_has_gige(priv)) {