bonding: fix potential deadlock in bond_uninit()
[safe/jmp/linux-2.6] / drivers / net / smc91x.c
index 05c91ee..fc1b5a1 100644 (file)
@@ -534,9 +534,9 @@ static inline void  smc_rcv(struct net_device *dev)
 #define smc_special_lock(lock, flags)          spin_lock_irqsave(lock, flags)
 #define smc_special_unlock(lock, flags)        spin_unlock_irqrestore(lock, flags)
 #else
-#define smc_special_trylock(lock, flags)       (1)
-#define smc_special_lock(lock, flags)          do { } while (0)
-#define smc_special_unlock(lock, flags)        do { } while (0)
+#define smc_special_trylock(lock, flags)       (flags == flags)
+#define smc_special_lock(lock, flags)          do { flags = 0; } while (0)
+#define smc_special_unlock(lock, flags)        do { flags = 0; } while (0)
 #endif
 
 /*
@@ -1395,7 +1395,7 @@ static void smc_set_multicast_list(struct net_device *dev)
         * I don't need to zero the multicast table, because the flag is
         * checked before the table is
         */
-       else if (dev->flags & IFF_ALLMULTI || dev->mc_count > 16) {
+       else if (dev->flags & IFF_ALLMULTI || netdev_mc_count(dev) > 16) {
                DBG(2, "%s: RCR_ALMUL\n", dev->name);
                lp->rcr_cur_mode |= RCR_ALMUL;
        }
@@ -1412,8 +1412,7 @@ static void smc_set_multicast_list(struct net_device *dev)
         * the number of the 8 bit register, while the low 3 bits are the bit
         * within that register.
         */
-       else if (dev->mc_count)  {
-               int i;
+       else if (!netdev_mc_empty(dev)) {
                struct dev_mc_list *cur_addr;
 
                /* table for flipping the order of 3 bits */
@@ -1422,13 +1421,9 @@ static void smc_set_multicast_list(struct net_device *dev)
                /* start with a table of all zeros: reject all */
                memset(multicast_table, 0, sizeof(multicast_table));
 
-               cur_addr = dev->mc_list;
-               for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) {
+               netdev_for_each_mc_addr(cur_addr, dev) {
                        int position;
 
-                       /* do we have a pointer here? */
-                       if (!cur_addr)
-                               break;
                        /* make sure this is a multicast address -
                           shouldn't this be a given if we have it here ? */
                        if (!(*cur_addr->dmi_addr & 1))
@@ -2031,7 +2026,7 @@ static int __devinit smc_probe(struct net_device *dev, void __iomem *ioaddr,
        }
 
        /* Grab the IRQ */
-       retval = request_irq(dev->irq, &smc_interrupt, irq_flags, dev->name, dev);
+       retval = request_irq(dev->irq, smc_interrupt, irq_flags, dev->name, dev);
        if (retval)
                goto err_out;
 
@@ -2283,7 +2278,7 @@ static int __devinit smc_drv_probe(struct platform_device *pdev)
 
        ndev->irq = ires->start;
 
-       if (ires->flags & IRQF_TRIGGER_MASK)
+       if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK)
                irq_flags = ires->flags & IRQF_TRIGGER_MASK;
 
        ret = smc_request_attrib(pdev, ndev);
@@ -2365,9 +2360,10 @@ static int __devexit smc_drv_remove(struct platform_device *pdev)
        return 0;
 }
 
-static int smc_drv_suspend(struct platform_device *dev, pm_message_t state)
+static int smc_drv_suspend(struct device *dev)
 {
-       struct net_device *ndev = platform_get_drvdata(dev);
+       struct platform_device *pdev = to_platform_device(dev);
+       struct net_device *ndev = platform_get_drvdata(pdev);
 
        if (ndev) {
                if (netif_running(ndev)) {
@@ -2379,13 +2375,14 @@ static int smc_drv_suspend(struct platform_device *dev, pm_message_t state)
        return 0;
 }
 
-static int smc_drv_resume(struct platform_device *dev)
+static int smc_drv_resume(struct device *dev)
 {
-       struct net_device *ndev = platform_get_drvdata(dev);
+       struct platform_device *pdev = to_platform_device(dev);
+       struct net_device *ndev = platform_get_drvdata(pdev);
 
        if (ndev) {
                struct smc_local *lp = netdev_priv(ndev);
-               smc_enable_device(dev);
+               smc_enable_device(pdev);
                if (netif_running(ndev)) {
                        smc_reset(ndev);
                        smc_enable(ndev);
@@ -2397,14 +2394,18 @@ static int smc_drv_resume(struct platform_device *dev)
        return 0;
 }
 
+static struct dev_pm_ops smc_drv_pm_ops = {
+       .suspend        = smc_drv_suspend,
+       .resume         = smc_drv_resume,
+};
+
 static struct platform_driver smc_driver = {
        .probe          = smc_drv_probe,
        .remove         = __devexit_p(smc_drv_remove),
-       .suspend        = smc_drv_suspend,
-       .resume         = smc_drv_resume,
        .driver         = {
                .name   = CARDNAME,
                .owner  = THIS_MODULE,
+               .pm     = &smc_drv_pm_ops,
        },
 };