From 63ef7d89cbecc249339a59c7a1ec58d2e8e88ea5 Mon Sep 17 00:00:00 2001 From: Alexander Beregalov Date: Wed, 15 Apr 2009 12:52:36 +0000 Subject: cpmac: convert to net_device_ops Signed-off-by: Alexander Beregalov Signed-off-by: David S. Miller --- drivers/net/cpmac.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'drivers/net/cpmac.c') diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index 3f476c7c073..af305c0b34d 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c @@ -1093,6 +1093,19 @@ static int cpmac_stop(struct net_device *dev) return 0; } +static const struct net_device_ops cpmac_netdev_ops = { + .ndo_open = cpmac_open, + .ndo_stop = cpmac_stop, + .ndo_start_xmit = cpmac_start_xmit, + .ndo_tx_timeout = cpmac_tx_timeout, + .ndo_set_multicast_list = cpmac_set_multicast_list, + .ndo_so_ioctl = cpmac_ioctl, + .ndo_set_config = cpmac_config, + .ndo_change_mtu = eth_change_mtu, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_mac_address = eth_mac_addr, +}; + static int external_switch; static int __devinit cpmac_probe(struct platform_device *pdev) @@ -1143,14 +1156,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev) dev->irq = platform_get_irq_byname(pdev, "irq"); - dev->open = cpmac_open; - dev->stop = cpmac_stop; - dev->set_config = cpmac_config; - dev->hard_start_xmit = cpmac_start_xmit; - dev->do_ioctl = cpmac_ioctl; - dev->set_multicast_list = cpmac_set_multicast_list; - dev->tx_timeout = cpmac_tx_timeout; - dev->ethtool_ops = &cpmac_ethtool_ops; + dev->netdev_ops = &cpmac_netdev_ops; + dev->ethtool_ops = &cpmac_ethtool_ops; netif_napi_add(dev, &priv->napi, cpmac_poll, 64); -- cgit v1.2.3-70-g09d2 From 21a8cfe120c581091722fb146540a2033af16a57 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 26 May 2009 21:10:22 -0700 Subject: cpmac: Remove references to BUS_ID_SIZE, use MII_BUS_ID_SIZE. Signed-off-by: David S. Miller --- drivers/net/cpmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/cpmac.c') diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index af305c0b34d..cfb4198b677 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c @@ -202,7 +202,7 @@ struct cpmac_priv { void __iomem *regs; struct mii_bus *mii_bus; struct phy_device *phy; - char phy_name[BUS_ID_SIZE]; + char phy_name[MII_BUS_ID_SIZE + 3]; int oldlink, oldspeed, oldduplex; u32 msg_enable; struct net_device *dev; -- cgit v1.2.3-70-g09d2 From 69bd4ae5dc1ddb3c01e7668c7fd088904082a70c Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Sun, 31 May 2009 10:57:07 +0000 Subject: cpmac: remove unused variable. This patch removes the unused variables in cpmac_hw_error, cpmac_tx_timeout and cpmac_probe. Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller --- drivers/net/cpmac.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/net/cpmac.c') diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index cfb4198b677..08e2f67adfb 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c @@ -731,7 +731,6 @@ static void cpmac_clear_tx(struct net_device *dev) static void cpmac_hw_error(struct work_struct *work) { - int i; struct cpmac_priv *priv = container_of(work, struct cpmac_priv, reset_work); @@ -818,7 +817,6 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id) static void cpmac_tx_timeout(struct net_device *dev) { - int i; struct cpmac_priv *priv = netdev_priv(dev); spin_lock(&priv->lock); @@ -1110,7 +1108,7 @@ static int external_switch; static int __devinit cpmac_probe(struct platform_device *pdev) { - int rc, phy_id, i; + int rc, phy_id; char *mdio_bus_id = "0"; struct resource *mem; struct cpmac_priv *priv; -- cgit v1.2.3-70-g09d2 From 0220ff7fc35913dcd8cdf8fb3a0966caf4aed2f3 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 31 May 2009 10:59:15 +0000 Subject: cpmac: prevent fatal exception in cpmac_end_xmit We should not be stopping the subqueues in cpmac_end_xmit but rather test the status of them. Replace the calls to netif_subqueue_stop by __netif_subqueue_stopped. This fixes an unrecoverable exception from happening when running the driver. Signed-off-by: Stefan Weil Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller --- drivers/net/cpmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/cpmac.c') diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index 08e2f67adfb..58afafbd3b9 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c @@ -615,13 +615,13 @@ static void cpmac_end_xmit(struct net_device *dev, int queue) dev_kfree_skb_irq(desc->skb); desc->skb = NULL; - if (netif_subqueue_stopped(dev, queue)) + if (__netif_subqueue_stopped(dev, queue)) netif_wake_subqueue(dev, queue); } else { if (netif_msg_tx_err(priv) && net_ratelimit()) printk(KERN_WARNING "%s: end_xmit: spurious interrupt\n", dev->name); - if (netif_subqueue_stopped(dev, queue)) + if (__netif_subqueue_stopped(dev, queue)) netif_wake_subqueue(dev, queue); } } -- cgit v1.2.3-70-g09d2