Ticket #3885: cpmac.patch

File cpmac.patch, 2.4 KB (added by sw, 8 years ago)

Patch for AR7 driver (cpmac.c)

  • drivers/net/cpmac.c

    This patch fixes the network driver cpmac.c for compilation with
    configuration option CONFIG_NETDEVICES_MULTIQUEUE.
    
    These compiler warnings are fixed by the patch:
    drivers/net/cpmac.c: In function 'cpmac_end_xmit':
    drivers/net/cpmac.c:630: warning: passing argument 2 of 'netif_subqueue_stopped' makes pointer from integer without a cast
    drivers/net/cpmac.c:641: warning: passing argument 2 of 'netif_subqueue_stopped' makes pointer from integer without a cast
    drivers/net/cpmac.c: In function 'cpmac_probe':
    drivers/net/cpmac.c:1128: warning: unused variable 'i'
    
    During runtime, the unpatched driver raises a fatal runtime exception.
    This is fixed by calling __netif_subqueue_stopped instead
    of netif_subqueue_stopped, too.
    
    Two additional code parts were modified for CONFIG_NETDEVICES_MULTIQUEUE
    because other drivers do it in the same way.
    
            Signed-off-by: Stefan Weil <weil@mail.berlios.de>
    
    old new  
    627627                dev_kfree_skb_irq(desc->skb); 
    628628                desc->skb = NULL; 
    629629#ifdef CONFIG_NETDEVICES_MULTIQUEUE 
    630                 if (netif_subqueue_stopped(dev, queue)) 
     630                if (__netif_subqueue_stopped(dev, queue)) 
    631631                        netif_wake_subqueue(dev, queue); 
    632632#else 
    633633                if (netif_queue_stopped(dev)) 
     
    638638                        printk(KERN_WARNING 
    639639                               "%s: end_xmit: spurious interrupt\n", dev->name); 
    640640#ifdef CONFIG_NETDEVICES_MULTIQUEUE 
    641                 if (netif_subqueue_stopped(dev, queue)) 
     641                if (__netif_subqueue_stopped(dev, queue)) 
    642642                        netif_wake_subqueue(dev, queue); 
    643643#else 
    644644                if (netif_queue_stopped(dev)) 
     
    11241124 
    11251125static int __devinit cpmac_probe(struct platform_device *pdev) 
    11261126{ 
    1127         int rc, phy_id, i; 
     1127        int rc, phy_id; 
    11281128        char *mdio_bus_id = "0"; 
    11291129        struct resource *mem; 
    11301130        struct cpmac_priv *priv; 
     
    11521152                } 
    11531153        } 
    11541154 
     1155#ifdef CONFIG_NETDEVICES_MULTIQUEUE 
    11551156        dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES); 
     1157#else 
     1158        dev = alloc_etherdev(sizeof(*priv)); 
     1159#endif 
    11561160 
    11571161        if (!dev) { 
    11581162                printk(KERN_ERR "cpmac: Unable to allocate net_device\n"); 
     
    11791183        dev->set_multicast_list = cpmac_set_multicast_list; 
    11801184        dev->tx_timeout         = cpmac_tx_timeout; 
    11811185        dev->ethtool_ops        = &cpmac_ethtool_ops; 
     1186#ifdef CONFIG_NETDEVICES_MULTIQUEUE 
    11821187        dev->features |= NETIF_F_MULTI_QUEUE; 
     1188#endif 
    11831189 
    11841190        netif_napi_add(dev, &priv->napi, cpmac_poll, 64); 
    11851191