From: Ingo Molnar <[EMAIL PROTECTED]>

Semaphore to mutexes conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
Cc: Ronald Bultje <[EMAIL PROTECTED]>
Cc: "David S. Miller" <[EMAIL PROTECTED]>
Cc: Jeff Garzik <[EMAIL PROTECTED]>
Cc: Yi Zhu <[EMAIL PROTECTED]>
Cc: James Ketrenos <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 drivers/net/sungem.c |   37 +++++++++++++++++++------------------
 drivers/net/sungem.h |    6 +++---
 2 files changed, 22 insertions(+), 21 deletions(-)

diff -puN drivers/net/sungem.c~sem2mutex-sungem drivers/net/sungem.c
--- devel/drivers/net/sungem.c~sem2mutex-sungem 2006-03-08 00:08:48.000000000 
-0800
+++ devel-akpm/drivers/net/sungem.c     2006-03-08 00:08:48.000000000 -0800
@@ -55,6 +55,7 @@
 #include <linux/workqueue.h>
 #include <linux/if_vlan.h>
 #include <linux/bitops.h>
+#include <linux/mutex.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -2284,7 +2285,7 @@ static void gem_reset_task(void *data)
 {
        struct gem *gp = (struct gem *) data;
 
-       down(&gp->pm_sem);
+       mutex_lock(&gp->pm_mutex);
 
        netif_poll_disable(gp->dev);
 
@@ -2311,7 +2312,7 @@ static void gem_reset_task(void *data)
 
        netif_poll_enable(gp->dev);
 
-       up(&gp->pm_sem);
+       mutex_unlock(&gp->pm_mutex);
 }
 
 
@@ -2320,14 +2321,14 @@ static int gem_open(struct net_device *d
        struct gem *gp = dev->priv;
        int rc = 0;
 
-       down(&gp->pm_sem);
+       mutex_lock(&gp->pm_mutex);
 
        /* We need the cell enabled */
        if (!gp->asleep)
                rc = gem_do_start(dev);
        gp->opened = (rc == 0);
 
-       up(&gp->pm_sem);
+       mutex_unlock(&gp->pm_mutex);
 
        return rc;
 }
@@ -2340,13 +2341,13 @@ static int gem_close(struct net_device *
         * our caller (dev_close) already did it for us
         */
 
-       down(&gp->pm_sem);
+       mutex_lock(&gp->pm_mutex);
 
        gp->opened = 0; 
        if (!gp->asleep)
                gem_do_stop(dev, 0);
 
-       up(&gp->pm_sem);
+       mutex_unlock(&gp->pm_mutex);
        
        return 0;
 }
@@ -2358,7 +2359,7 @@ static int gem_suspend(struct pci_dev *p
        struct gem *gp = dev->priv;
        unsigned long flags;
 
-       down(&gp->pm_sem);
+       mutex_lock(&gp->pm_mutex);
 
        netif_poll_disable(dev);
 
@@ -2391,11 +2392,11 @@ static int gem_suspend(struct pci_dev *p
        /* Stop the link timer */
        del_timer_sync(&gp->link_timer);
 
-       /* Now we release the semaphore to not block the reset task who
+       /* Now we release the mutex to not block the reset task who
         * can take it too. We are marked asleep, so there will be no
         * conflict here
         */
-       up(&gp->pm_sem);
+       mutex_unlock(&gp->pm_mutex);
 
        /* Wait for a pending reset task to complete */
        while (gp->reset_task_pending)
@@ -2424,7 +2425,7 @@ static int gem_resume(struct pci_dev *pd
 
        printk(KERN_INFO "%s: resuming\n", dev->name);
 
-       down(&gp->pm_sem);
+       mutex_lock(&gp->pm_mutex);
 
        /* Keep the cell enabled during the entire operation, no need to
         * take a lock here tho since nothing else can happen while we are
@@ -2440,7 +2441,7 @@ static int gem_resume(struct pci_dev *pd
                 * still asleep, a new sleep cycle may bring it back
                 */
                gem_put_cell(gp);
-               up(&gp->pm_sem);
+               mutex_unlock(&gp->pm_mutex);
                return 0;
        }
        pci_set_master(gp->pdev);
@@ -2486,7 +2487,7 @@ static int gem_resume(struct pci_dev *pd
 
        netif_poll_enable(dev);
        
-       up(&gp->pm_sem);
+       mutex_unlock(&gp->pm_mutex);
 
        return 0;
 }
@@ -2591,7 +2592,7 @@ static int gem_change_mtu(struct net_dev
                return 0;
        }
 
-       down(&gp->pm_sem);
+       mutex_lock(&gp->pm_mutex);
        spin_lock_irq(&gp->lock);
        spin_lock(&gp->tx_lock);
        dev->mtu = new_mtu;
@@ -2602,7 +2603,7 @@ static int gem_change_mtu(struct net_dev
        }
        spin_unlock(&gp->tx_lock);
        spin_unlock_irq(&gp->lock);
-       up(&gp->pm_sem);
+       mutex_unlock(&gp->pm_mutex);
 
        return 0;
 }
@@ -2771,10 +2772,10 @@ static int gem_ioctl(struct net_device *
        int rc = -EOPNOTSUPP;
        unsigned long flags;
 
-       /* Hold the PM semaphore while doing ioctl's or we may collide
+       /* Hold the PM mutex while doing ioctl's or we may collide
         * with power management.
         */
-       down(&gp->pm_sem);
+       mutex_lock(&gp->pm_mutex);
                
        spin_lock_irqsave(&gp->lock, flags);
        gem_get_cell(gp);
@@ -2812,7 +2813,7 @@ static int gem_ioctl(struct net_device *
        gem_put_cell(gp);
        spin_unlock_irqrestore(&gp->lock, flags);
 
-       up(&gp->pm_sem);
+       mutex_unlock(&gp->pm_mutex);
        
        return rc;
 }
@@ -3033,7 +3034,7 @@ static int __devinit gem_init_one(struct
 
        spin_lock_init(&gp->lock);
        spin_lock_init(&gp->tx_lock);
-       init_MUTEX(&gp->pm_sem);
+       mutex_init(&gp->pm_mutex);
 
        init_timer(&gp->link_timer);
        gp->link_timer.function = gem_link_timer;
diff -puN drivers/net/sungem.h~sem2mutex-sungem drivers/net/sungem.h
--- devel/drivers/net/sungem.h~sem2mutex-sungem 2006-03-08 00:08:48.000000000 
-0800
+++ devel-akpm/drivers/net/sungem.h     2006-03-08 00:08:48.000000000 -0800
@@ -980,15 +980,15 @@ struct gem {
        int                     tx_new, tx_old;
 
        unsigned int has_wol : 1;       /* chip supports wake-on-lan */
-       unsigned int asleep : 1;        /* chip asleep, protected by pm_sem */
+       unsigned int asleep : 1;        /* chip asleep, protected by pm_mutex */
        unsigned int asleep_wol : 1;    /* was asleep with WOL enabled */
-       unsigned int opened : 1;        /* driver opened, protected by pm_sem */
+       unsigned int opened : 1;        /* driver opened, protected by pm_mutex 
*/
        unsigned int running : 1;       /* chip running, protected by lock */
        
        /* cell enable count, protected by lock */
        int                     cell_enabled;  
        
-       struct semaphore        pm_sem;
+       struct mutex            pm_mutex;
 
        u32                     msg_enable;
        u32                     status;
_
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to