diff options
Diffstat (limited to 'drivers/net/smc911x.c')
-rw-r--r-- | drivers/net/smc911x.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 797ab9125e72..880d9fdd7c67 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c | |||
@@ -148,6 +148,8 @@ struct smc911x_local { | |||
148 | int tx_throttle; | 148 | int tx_throttle; |
149 | spinlock_t lock; | 149 | spinlock_t lock; |
150 | 150 | ||
151 | struct net_device *netdev; | ||
152 | |||
151 | #ifdef SMC_USE_DMA | 153 | #ifdef SMC_USE_DMA |
152 | /* DMA needs the physical address of the chip */ | 154 | /* DMA needs the physical address of the chip */ |
153 | u_long physaddr; | 155 | u_long physaddr; |
@@ -948,10 +950,11 @@ static void smc911x_phy_check_media(struct net_device *dev, int init) | |||
948 | * of autonegotiation.) If the RPC ANEG bit is cleared, the selection | 950 | * of autonegotiation.) If the RPC ANEG bit is cleared, the selection |
949 | * is controlled by the RPC SPEED and RPC DPLX bits. | 951 | * is controlled by the RPC SPEED and RPC DPLX bits. |
950 | */ | 952 | */ |
951 | static void smc911x_phy_configure(void *data) | 953 | static void smc911x_phy_configure(struct work_struct *work) |
952 | { | 954 | { |
953 | struct net_device *dev = data; | 955 | struct smc911x_local *lp = container_of(work, struct smc911x_local, |
954 | struct smc911x_local *lp = netdev_priv(dev); | 956 | phy_configure); |
957 | struct net_device *dev = lp->netdev; | ||
955 | unsigned long ioaddr = dev->base_addr; | 958 | unsigned long ioaddr = dev->base_addr; |
956 | int phyaddr = lp->mii.phy_id; | 959 | int phyaddr = lp->mii.phy_id; |
957 | int my_phy_caps; /* My PHY capabilities */ | 960 | int my_phy_caps; /* My PHY capabilities */ |
@@ -1495,6 +1498,8 @@ static void smc911x_set_multicast_list(struct net_device *dev) | |||
1495 | static int | 1498 | static int |
1496 | smc911x_open(struct net_device *dev) | 1499 | smc911x_open(struct net_device *dev) |
1497 | { | 1500 | { |
1501 | struct smc911x_local *lp = netdev_priv(dev); | ||
1502 | |||
1498 | DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__); | 1503 | DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__); |
1499 | 1504 | ||
1500 | /* | 1505 | /* |
@@ -1511,7 +1516,7 @@ smc911x_open(struct net_device *dev) | |||
1511 | smc911x_reset(dev); | 1516 | smc911x_reset(dev); |
1512 | 1517 | ||
1513 | /* Configure the PHY, initialize the link state */ | 1518 | /* Configure the PHY, initialize the link state */ |
1514 | smc911x_phy_configure(dev); | 1519 | smc911x_phy_configure(&lp->phy_configure); |
1515 | 1520 | ||
1516 | /* Turn on Tx + Rx */ | 1521 | /* Turn on Tx + Rx */ |
1517 | smc911x_enable(dev); | 1522 | smc911x_enable(dev); |
@@ -2060,7 +2065,7 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr) | |||
2060 | dev->poll_controller = smc911x_poll_controller; | 2065 | dev->poll_controller = smc911x_poll_controller; |
2061 | #endif | 2066 | #endif |
2062 | 2067 | ||
2063 | INIT_WORK(&lp->phy_configure, smc911x_phy_configure, dev); | 2068 | INIT_WORK(&lp->phy_configure, smc911x_phy_configure); |
2064 | lp->mii.phy_id_mask = 0x1f; | 2069 | lp->mii.phy_id_mask = 0x1f; |
2065 | lp->mii.reg_num_mask = 0x1f; | 2070 | lp->mii.reg_num_mask = 0x1f; |
2066 | lp->mii.force_media = 0; | 2071 | lp->mii.force_media = 0; |
@@ -2154,6 +2159,7 @@ static int smc911x_drv_probe(struct platform_device *pdev) | |||
2154 | { | 2159 | { |
2155 | struct net_device *ndev; | 2160 | struct net_device *ndev; |
2156 | struct resource *res; | 2161 | struct resource *res; |
2162 | struct smc911x_local *lp; | ||
2157 | unsigned int *addr; | 2163 | unsigned int *addr; |
2158 | int ret; | 2164 | int ret; |
2159 | 2165 | ||
@@ -2183,6 +2189,8 @@ static int smc911x_drv_probe(struct platform_device *pdev) | |||
2183 | 2189 | ||
2184 | ndev->dma = (unsigned char)-1; | 2190 | ndev->dma = (unsigned char)-1; |
2185 | ndev->irq = platform_get_irq(pdev, 0); | 2191 | ndev->irq = platform_get_irq(pdev, 0); |
2192 | lp = netdev_priv(ndev); | ||
2193 | lp->netdev = ndev; | ||
2186 | 2194 | ||
2187 | addr = ioremap(res->start, SMC911X_IO_EXTENT); | 2195 | addr = ioremap(res->start, SMC911X_IO_EXTENT); |
2188 | if (!addr) { | 2196 | if (!addr) { |
@@ -2204,7 +2212,6 @@ out: | |||
2204 | } | 2212 | } |
2205 | #ifdef SMC_USE_DMA | 2213 | #ifdef SMC_USE_DMA |
2206 | else { | 2214 | else { |
2207 | struct smc911x_local *lp = netdev_priv(ndev); | ||
2208 | lp->physaddr = res->start; | 2215 | lp->physaddr = res->start; |
2209 | lp->dev = &pdev->dev; | 2216 | lp->dev = &pdev->dev; |
2210 | } | 2217 | } |
@@ -2275,7 +2282,7 @@ static int smc911x_drv_resume(struct platform_device *dev) | |||
2275 | smc911x_reset(ndev); | 2282 | smc911x_reset(ndev); |
2276 | smc911x_enable(ndev); | 2283 | smc911x_enable(ndev); |
2277 | if (lp->phy_type != 0) | 2284 | if (lp->phy_type != 0) |
2278 | smc911x_phy_configure(ndev); | 2285 | smc911x_phy_configure(&lp->phy_configure); |
2279 | netif_device_attach(ndev); | 2286 | netif_device_attach(ndev); |
2280 | } | 2287 | } |
2281 | } | 2288 | } |