diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-21 01:34:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:34:25 -0500 |
commit | e3968fc0f3db58e4c448ec20f66ce6da49d9bc5f (patch) | |
tree | ffb5d63fffa0b235ed202fb55674b1da2e7cffa4 /drivers | |
parent | 758df69ee01f7be99c2df5562ef278bab05623dd (diff) |
[SUNGEM]: sem2mutex
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 <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/sungem.c | 37 | ||||
-rw-r--r-- | drivers/net/sungem.h | 6 |
2 files changed, 22 insertions, 21 deletions
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 28ce47a02408..38cd30cb7c75 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/workqueue.h> | 55 | #include <linux/workqueue.h> |
56 | #include <linux/if_vlan.h> | 56 | #include <linux/if_vlan.h> |
57 | #include <linux/bitops.h> | 57 | #include <linux/bitops.h> |
58 | #include <linux/mutex.h> | ||
58 | 59 | ||
59 | #include <asm/system.h> | 60 | #include <asm/system.h> |
60 | #include <asm/io.h> | 61 | #include <asm/io.h> |
@@ -2284,7 +2285,7 @@ static void gem_reset_task(void *data) | |||
2284 | { | 2285 | { |
2285 | struct gem *gp = (struct gem *) data; | 2286 | struct gem *gp = (struct gem *) data; |
2286 | 2287 | ||
2287 | down(&gp->pm_sem); | 2288 | mutex_lock(&gp->pm_mutex); |
2288 | 2289 | ||
2289 | netif_poll_disable(gp->dev); | 2290 | netif_poll_disable(gp->dev); |
2290 | 2291 | ||
@@ -2311,7 +2312,7 @@ static void gem_reset_task(void *data) | |||
2311 | 2312 | ||
2312 | netif_poll_enable(gp->dev); | 2313 | netif_poll_enable(gp->dev); |
2313 | 2314 | ||
2314 | up(&gp->pm_sem); | 2315 | mutex_unlock(&gp->pm_mutex); |
2315 | } | 2316 | } |
2316 | 2317 | ||
2317 | 2318 | ||
@@ -2320,14 +2321,14 @@ static int gem_open(struct net_device *dev) | |||
2320 | struct gem *gp = dev->priv; | 2321 | struct gem *gp = dev->priv; |
2321 | int rc = 0; | 2322 | int rc = 0; |
2322 | 2323 | ||
2323 | down(&gp->pm_sem); | 2324 | mutex_lock(&gp->pm_mutex); |
2324 | 2325 | ||
2325 | /* We need the cell enabled */ | 2326 | /* We need the cell enabled */ |
2326 | if (!gp->asleep) | 2327 | if (!gp->asleep) |
2327 | rc = gem_do_start(dev); | 2328 | rc = gem_do_start(dev); |
2328 | gp->opened = (rc == 0); | 2329 | gp->opened = (rc == 0); |
2329 | 2330 | ||
2330 | up(&gp->pm_sem); | 2331 | mutex_unlock(&gp->pm_mutex); |
2331 | 2332 | ||
2332 | return rc; | 2333 | return rc; |
2333 | } | 2334 | } |
@@ -2340,13 +2341,13 @@ static int gem_close(struct net_device *dev) | |||
2340 | * our caller (dev_close) already did it for us | 2341 | * our caller (dev_close) already did it for us |
2341 | */ | 2342 | */ |
2342 | 2343 | ||
2343 | down(&gp->pm_sem); | 2344 | mutex_lock(&gp->pm_mutex); |
2344 | 2345 | ||
2345 | gp->opened = 0; | 2346 | gp->opened = 0; |
2346 | if (!gp->asleep) | 2347 | if (!gp->asleep) |
2347 | gem_do_stop(dev, 0); | 2348 | gem_do_stop(dev, 0); |
2348 | 2349 | ||
2349 | up(&gp->pm_sem); | 2350 | mutex_unlock(&gp->pm_mutex); |
2350 | 2351 | ||
2351 | return 0; | 2352 | return 0; |
2352 | } | 2353 | } |
@@ -2358,7 +2359,7 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2358 | struct gem *gp = dev->priv; | 2359 | struct gem *gp = dev->priv; |
2359 | unsigned long flags; | 2360 | unsigned long flags; |
2360 | 2361 | ||
2361 | down(&gp->pm_sem); | 2362 | mutex_lock(&gp->pm_mutex); |
2362 | 2363 | ||
2363 | netif_poll_disable(dev); | 2364 | netif_poll_disable(dev); |
2364 | 2365 | ||
@@ -2391,11 +2392,11 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2391 | /* Stop the link timer */ | 2392 | /* Stop the link timer */ |
2392 | del_timer_sync(&gp->link_timer); | 2393 | del_timer_sync(&gp->link_timer); |
2393 | 2394 | ||
2394 | /* Now we release the semaphore to not block the reset task who | 2395 | /* Now we release the mutex to not block the reset task who |
2395 | * can take it too. We are marked asleep, so there will be no | 2396 | * can take it too. We are marked asleep, so there will be no |
2396 | * conflict here | 2397 | * conflict here |
2397 | */ | 2398 | */ |
2398 | up(&gp->pm_sem); | 2399 | mutex_unlock(&gp->pm_mutex); |
2399 | 2400 | ||
2400 | /* Wait for a pending reset task to complete */ | 2401 | /* Wait for a pending reset task to complete */ |
2401 | while (gp->reset_task_pending) | 2402 | while (gp->reset_task_pending) |
@@ -2424,7 +2425,7 @@ static int gem_resume(struct pci_dev *pdev) | |||
2424 | 2425 | ||
2425 | printk(KERN_INFO "%s: resuming\n", dev->name); | 2426 | printk(KERN_INFO "%s: resuming\n", dev->name); |
2426 | 2427 | ||
2427 | down(&gp->pm_sem); | 2428 | mutex_lock(&gp->pm_mutex); |
2428 | 2429 | ||
2429 | /* Keep the cell enabled during the entire operation, no need to | 2430 | /* Keep the cell enabled during the entire operation, no need to |
2430 | * take a lock here tho since nothing else can happen while we are | 2431 | * take a lock here tho since nothing else can happen while we are |
@@ -2440,7 +2441,7 @@ static int gem_resume(struct pci_dev *pdev) | |||
2440 | * still asleep, a new sleep cycle may bring it back | 2441 | * still asleep, a new sleep cycle may bring it back |
2441 | */ | 2442 | */ |
2442 | gem_put_cell(gp); | 2443 | gem_put_cell(gp); |
2443 | up(&gp->pm_sem); | 2444 | mutex_unlock(&gp->pm_mutex); |
2444 | return 0; | 2445 | return 0; |
2445 | } | 2446 | } |
2446 | pci_set_master(gp->pdev); | 2447 | pci_set_master(gp->pdev); |
@@ -2486,7 +2487,7 @@ static int gem_resume(struct pci_dev *pdev) | |||
2486 | 2487 | ||
2487 | netif_poll_enable(dev); | 2488 | netif_poll_enable(dev); |
2488 | 2489 | ||
2489 | up(&gp->pm_sem); | 2490 | mutex_unlock(&gp->pm_mutex); |
2490 | 2491 | ||
2491 | return 0; | 2492 | return 0; |
2492 | } | 2493 | } |
@@ -2591,7 +2592,7 @@ static int gem_change_mtu(struct net_device *dev, int new_mtu) | |||
2591 | return 0; | 2592 | return 0; |
2592 | } | 2593 | } |
2593 | 2594 | ||
2594 | down(&gp->pm_sem); | 2595 | mutex_lock(&gp->pm_mutex); |
2595 | spin_lock_irq(&gp->lock); | 2596 | spin_lock_irq(&gp->lock); |
2596 | spin_lock(&gp->tx_lock); | 2597 | spin_lock(&gp->tx_lock); |
2597 | dev->mtu = new_mtu; | 2598 | dev->mtu = new_mtu; |
@@ -2602,7 +2603,7 @@ static int gem_change_mtu(struct net_device *dev, int new_mtu) | |||
2602 | } | 2603 | } |
2603 | spin_unlock(&gp->tx_lock); | 2604 | spin_unlock(&gp->tx_lock); |
2604 | spin_unlock_irq(&gp->lock); | 2605 | spin_unlock_irq(&gp->lock); |
2605 | up(&gp->pm_sem); | 2606 | mutex_unlock(&gp->pm_mutex); |
2606 | 2607 | ||
2607 | return 0; | 2608 | return 0; |
2608 | } | 2609 | } |
@@ -2771,10 +2772,10 @@ static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2771 | int rc = -EOPNOTSUPP; | 2772 | int rc = -EOPNOTSUPP; |
2772 | unsigned long flags; | 2773 | unsigned long flags; |
2773 | 2774 | ||
2774 | /* Hold the PM semaphore while doing ioctl's or we may collide | 2775 | /* Hold the PM mutex while doing ioctl's or we may collide |
2775 | * with power management. | 2776 | * with power management. |
2776 | */ | 2777 | */ |
2777 | down(&gp->pm_sem); | 2778 | mutex_lock(&gp->pm_mutex); |
2778 | 2779 | ||
2779 | spin_lock_irqsave(&gp->lock, flags); | 2780 | spin_lock_irqsave(&gp->lock, flags); |
2780 | gem_get_cell(gp); | 2781 | gem_get_cell(gp); |
@@ -2812,7 +2813,7 @@ static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2812 | gem_put_cell(gp); | 2813 | gem_put_cell(gp); |
2813 | spin_unlock_irqrestore(&gp->lock, flags); | 2814 | spin_unlock_irqrestore(&gp->lock, flags); |
2814 | 2815 | ||
2815 | up(&gp->pm_sem); | 2816 | mutex_unlock(&gp->pm_mutex); |
2816 | 2817 | ||
2817 | return rc; | 2818 | return rc; |
2818 | } | 2819 | } |
@@ -3033,7 +3034,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev, | |||
3033 | 3034 | ||
3034 | spin_lock_init(&gp->lock); | 3035 | spin_lock_init(&gp->lock); |
3035 | spin_lock_init(&gp->tx_lock); | 3036 | spin_lock_init(&gp->tx_lock); |
3036 | init_MUTEX(&gp->pm_sem); | 3037 | mutex_init(&gp->pm_mutex); |
3037 | 3038 | ||
3038 | init_timer(&gp->link_timer); | 3039 | init_timer(&gp->link_timer); |
3039 | gp->link_timer.function = gem_link_timer; | 3040 | gp->link_timer.function = gem_link_timer; |
diff --git a/drivers/net/sungem.h b/drivers/net/sungem.h index 13006d759ad8..89847215d006 100644 --- a/drivers/net/sungem.h +++ b/drivers/net/sungem.h | |||
@@ -980,15 +980,15 @@ struct gem { | |||
980 | int tx_new, tx_old; | 980 | int tx_new, tx_old; |
981 | 981 | ||
982 | unsigned int has_wol : 1; /* chip supports wake-on-lan */ | 982 | unsigned int has_wol : 1; /* chip supports wake-on-lan */ |
983 | unsigned int asleep : 1; /* chip asleep, protected by pm_sem */ | 983 | unsigned int asleep : 1; /* chip asleep, protected by pm_mutex */ |
984 | unsigned int asleep_wol : 1; /* was asleep with WOL enabled */ | 984 | unsigned int asleep_wol : 1; /* was asleep with WOL enabled */ |
985 | unsigned int opened : 1; /* driver opened, protected by pm_sem */ | 985 | unsigned int opened : 1; /* driver opened, protected by pm_mutex */ |
986 | unsigned int running : 1; /* chip running, protected by lock */ | 986 | unsigned int running : 1; /* chip running, protected by lock */ |
987 | 987 | ||
988 | /* cell enable count, protected by lock */ | 988 | /* cell enable count, protected by lock */ |
989 | int cell_enabled; | 989 | int cell_enabled; |
990 | 990 | ||
991 | struct semaphore pm_sem; | 991 | struct mutex pm_mutex; |
992 | 992 | ||
993 | u32 msg_enable; | 993 | u32 msg_enable; |
994 | u32 status; | 994 | u32 status; |