X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fsmc911x.c;h=81f24847c9632e538645a23f345e0dbbc542f061;hb=52a9435183f961e1bb3c146a62bfbecf93d15d58;hp=a621b17456e576b9f2e05ef90d820dcf3f38676d;hpb=0cd43f83d381c4246a08cd775834833d6fd64805;p=powerpc.git diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index a621b17456..81f24847c9 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -148,6 +148,8 @@ struct smc911x_local { int tx_throttle; spinlock_t lock; + struct net_device *netdev; + #ifdef SMC_USE_DMA /* DMA needs the physical address of the chip */ u_long physaddr; @@ -497,10 +499,9 @@ static inline void smc911x_rcv(struct net_device *dev) SMC_SET_RX_CFG(RX_CFG_RX_END_ALGN4_ | ((2<<8) & RX_CFG_RXDOFF_)); SMC_PULL_DATA(data, pkt_len+2+3); - DBG(SMC_DEBUG_PKTS, "%s: Received packet\n", dev->name,); + DBG(SMC_DEBUG_PKTS, "%s: Received packet\n", dev->name); PRINT_PKT(data, ((pkt_len - 4) <= 64) ? pkt_len - 4 : 64); dev->last_rx = jiffies; - skb->dev = dev; skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); lp->stats.rx_packets++; @@ -948,10 +949,11 @@ static void smc911x_phy_check_media(struct net_device *dev, int init) * of autonegotiation.) If the RPC ANEG bit is cleared, the selection * is controlled by the RPC SPEED and RPC DPLX bits. */ -static void smc911x_phy_configure(void *data) +static void smc911x_phy_configure(struct work_struct *work) { - struct net_device *dev = data; - struct smc911x_local *lp = netdev_priv(dev); + struct smc911x_local *lp = container_of(work, struct smc911x_local, + phy_configure); + struct net_device *dev = lp->netdev; unsigned long ioaddr = dev->base_addr; int phyaddr = lp->mii.phy_id; int my_phy_caps; /* My PHY capabilities */ @@ -965,11 +967,11 @@ static void smc911x_phy_configure(void *data) * We should not be called if phy_type is zero. */ if (lp->phy_type == 0) - goto smc911x_phy_configure_exit; + goto smc911x_phy_configure_exit_nolock; if (smc911x_phy_reset(dev, phyaddr)) { printk("%s: PHY reset timed out\n", dev->name); - goto smc911x_phy_configure_exit; + goto smc911x_phy_configure_exit_nolock; } spin_lock_irqsave(&lp->lock, flags); @@ -1038,6 +1040,7 @@ static void smc911x_phy_configure(void *data) smc911x_phy_configure_exit: spin_unlock_irqrestore(&lp->lock, flags); +smc911x_phy_configure_exit_nolock: lp->work_pending = 0; } @@ -1074,7 +1077,7 @@ static void smc911x_phy_interrupt(struct net_device *dev) * This is the main routine of the driver, to handle the device when * it needs some attention. */ -static irqreturn_t smc911x_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t smc911x_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; unsigned long ioaddr = dev->base_addr; @@ -1251,7 +1254,7 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id, struct pt_regs *regs #ifdef SMC_USE_DMA static void -smc911x_tx_dma_irq(int dma, void *data, struct pt_regs *regs) +smc911x_tx_dma_irq(int dma, void *data) { struct net_device *dev = (struct net_device *)data; struct smc911x_local *lp = netdev_priv(dev); @@ -1285,7 +1288,7 @@ smc911x_tx_dma_irq(int dma, void *data, struct pt_regs *regs) "%s: TX DMA irq completed\n", dev->name); } static void -smc911x_rx_dma_irq(int dma, void *data, struct pt_regs *regs) +smc911x_rx_dma_irq(int dma, void *data) { struct net_device *dev = (struct net_device *)data; unsigned long ioaddr = dev->base_addr; @@ -1303,7 +1306,6 @@ smc911x_rx_dma_irq(int dma, void *data, struct pt_regs *regs) lp->current_rx_skb = NULL; PRINT_PKT(skb->data, skb->len); dev->last_rx = jiffies; - skb->dev = dev; skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); lp->stats.rx_packets++; @@ -1331,7 +1333,7 @@ smc911x_rx_dma_irq(int dma, void *data, struct pt_regs *regs) static void smc911x_poll_controller(struct net_device *dev) { disable_irq(dev->irq); - smc911x_interrupt(dev->irq, dev, NULL); + smc911x_interrupt(dev->irq, dev); enable_irq(dev->irq); } #endif @@ -1495,6 +1497,8 @@ static void smc911x_set_multicast_list(struct net_device *dev) static int smc911x_open(struct net_device *dev) { + struct smc911x_local *lp = netdev_priv(dev); + DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__); /* @@ -1511,7 +1515,7 @@ smc911x_open(struct net_device *dev) smc911x_reset(dev); /* Configure the PHY, initialize the link state */ - smc911x_phy_configure(dev); + smc911x_phy_configure(&lp->phy_configure); /* Turn on Tx + Rx */ smc911x_enable(dev); @@ -1653,7 +1657,7 @@ smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { strncpy(info->driver, CARDNAME, sizeof(info->driver)); strncpy(info->version, version, sizeof(info->version)); - strncpy(info->bus_info, dev->class_dev.dev->bus_id, sizeof(info->bus_info)); + strncpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info)); } static int smc911x_ethtool_nwayreset(struct net_device *dev) @@ -2060,7 +2064,7 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr) dev->poll_controller = smc911x_poll_controller; #endif - INIT_WORK(&lp->phy_configure, smc911x_phy_configure, dev); + INIT_WORK(&lp->phy_configure, smc911x_phy_configure); lp->mii.phy_id_mask = 0x1f; lp->mii.reg_num_mask = 0x1f; lp->mii.force_media = 0; @@ -2154,6 +2158,7 @@ static int smc911x_drv_probe(struct platform_device *pdev) { struct net_device *ndev; struct resource *res; + struct smc911x_local *lp; unsigned int *addr; int ret; @@ -2183,6 +2188,8 @@ static int smc911x_drv_probe(struct platform_device *pdev) ndev->dma = (unsigned char)-1; ndev->irq = platform_get_irq(pdev, 0); + lp = netdev_priv(ndev); + lp->netdev = ndev; addr = ioremap(res->start, SMC911X_IO_EXTENT); if (!addr) { @@ -2204,7 +2211,6 @@ out: } #ifdef SMC_USE_DMA else { - struct smc911x_local *lp = netdev_priv(ndev); lp->physaddr = res->start; lp->dev = &pdev->dev; } @@ -2275,7 +2281,7 @@ static int smc911x_drv_resume(struct platform_device *dev) smc911x_reset(ndev); smc911x_enable(ndev); if (lp->phy_type != 0) - smc911x_phy_configure(ndev); + smc911x_phy_configure(&lp->phy_configure); netif_device_attach(ndev); } }