Changeset 35602


Ignore:
Timestamp:
2013-02-14T15:01:24+01:00 (5 years ago)
Author:
juhosg
Message:

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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/generic/files/drivers/net/phy/ar8216.c

    r35562 r35602  
    18521852        struct ar8216_priv *priv = phydev->priv; 
    18531853        struct net_device *dev = phydev->attached_dev; 
    1854         struct switch_dev *swdev; 
    18551854        int ret; 
    18561855 
     
    18731872        } 
    18741873 
    1875         swdev = &priv->dev; 
    1876         swdev->alias = dev_name(&priv->mii_bus->dev); 
    1877         ret = register_switch(swdev, NULL); 
    1878         if (ret) 
    1879                 goto err; 
    1880  
    1881         pr_info("%s: %s switch registered on %s\n", 
    1882                 swdev->devname, swdev->name, dev_name(&priv->mii_bus->dev)); 
    1883  
    18841874        priv->init = true; 
    18851875 
    18861876        ret = priv->chip->hw_init(priv); 
    18871877        if (ret) 
    1888                 goto err_unregister_switch; 
     1878                return ret; 
    18891879 
    18901880        ret = ar8216_sw_reset_switch(&priv->dev); 
    18911881        if (ret) 
    1892                 goto err_unregister_switch; 
     1882                return ret; 
    18931883 
    18941884        /* VID fixup only needed on ar8216 */ 
     
    19051895 
    19061896        return 0; 
    1907  
    1908 err_unregister_switch: 
    1909         unregister_switch(&priv->dev); 
    1910 err: 
    1911         return ret; 
    19121897} 
    19131898 
     
    20051990{ 
    20061991        struct ar8216_priv *priv; 
     1992        struct switch_dev *swdev; 
    20071993        int ret; 
    20081994 
     
    20282014        if (ret) 
    20292015                goto free_priv; 
     2016 
     2017        swdev = &priv->dev; 
     2018        swdev->alias = dev_name(&priv->mii_bus->dev); 
     2019        ret = register_switch(swdev, NULL); 
     2020        if (ret) 
     2021                goto free_priv; 
     2022 
     2023        pr_info("%s: %s switch registered on %s\n", 
     2024                swdev->devname, swdev->name, dev_name(&priv->mii_bus->dev)); 
    20302025 
    20312026found: 
Note: See TracChangeset for help on using the changeset viewer.