Commit e3968fc0f3db58e4c448ec20f66ce6da49d9bc5f
Committed by
David S. Miller
1 parent
758df69ee0
Exists in
master
and in
7 other branches
[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>
Showing 2 changed files with 22 additions and 21 deletions Side-by-side Diff
drivers/net/sungem.c
... | ... | @@ -55,6 +55,7 @@ |
55 | 55 | #include <linux/workqueue.h> |
56 | 56 | #include <linux/if_vlan.h> |
57 | 57 | #include <linux/bitops.h> |
58 | +#include <linux/mutex.h> | |
58 | 59 | |
59 | 60 | #include <asm/system.h> |
60 | 61 | #include <asm/io.h> |
... | ... | @@ -2284,7 +2285,7 @@ |
2284 | 2285 | { |
2285 | 2286 | struct gem *gp = (struct gem *) data; |
2286 | 2287 | |
2287 | - down(&gp->pm_sem); | |
2288 | + mutex_lock(&gp->pm_mutex); | |
2288 | 2289 | |
2289 | 2290 | netif_poll_disable(gp->dev); |
2290 | 2291 | |
... | ... | @@ -2311,7 +2312,7 @@ |
2311 | 2312 | |
2312 | 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 | |
2318 | 2319 | |
... | ... | @@ -2320,14 +2321,14 @@ |
2320 | 2321 | struct gem *gp = dev->priv; |
2321 | 2322 | int rc = 0; |
2322 | 2323 | |
2323 | - down(&gp->pm_sem); | |
2324 | + mutex_lock(&gp->pm_mutex); | |
2324 | 2325 | |
2325 | 2326 | /* We need the cell enabled */ |
2326 | 2327 | if (!gp->asleep) |
2327 | 2328 | rc = gem_do_start(dev); |
2328 | 2329 | gp->opened = (rc == 0); |
2329 | 2330 | |
2330 | - up(&gp->pm_sem); | |
2331 | + mutex_unlock(&gp->pm_mutex); | |
2331 | 2332 | |
2332 | 2333 | return rc; |
2333 | 2334 | } |
2334 | 2335 | |
... | ... | @@ -2340,13 +2341,13 @@ |
2340 | 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 | 2346 | gp->opened = 0; |
2346 | 2347 | if (!gp->asleep) |
2347 | 2348 | gem_do_stop(dev, 0); |
2348 | 2349 | |
2349 | - up(&gp->pm_sem); | |
2350 | + mutex_unlock(&gp->pm_mutex); | |
2350 | 2351 | |
2351 | 2352 | return 0; |
2352 | 2353 | } |
... | ... | @@ -2358,7 +2359,7 @@ |
2358 | 2359 | struct gem *gp = dev->priv; |
2359 | 2360 | unsigned long flags; |
2360 | 2361 | |
2361 | - down(&gp->pm_sem); | |
2362 | + mutex_lock(&gp->pm_mutex); | |
2362 | 2363 | |
2363 | 2364 | netif_poll_disable(dev); |
2364 | 2365 | |
2365 | 2366 | |
... | ... | @@ -2391,11 +2392,11 @@ |
2391 | 2392 | /* Stop the link timer */ |
2392 | 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 | 2396 | * can take it too. We are marked asleep, so there will be no |
2396 | 2397 | * conflict here |
2397 | 2398 | */ |
2398 | - up(&gp->pm_sem); | |
2399 | + mutex_unlock(&gp->pm_mutex); | |
2399 | 2400 | |
2400 | 2401 | /* Wait for a pending reset task to complete */ |
2401 | 2402 | while (gp->reset_task_pending) |
... | ... | @@ -2424,7 +2425,7 @@ |
2424 | 2425 | |
2425 | 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 | 2430 | /* Keep the cell enabled during the entire operation, no need to |
2430 | 2431 | * take a lock here tho since nothing else can happen while we are |
... | ... | @@ -2440,7 +2441,7 @@ |
2440 | 2441 | * still asleep, a new sleep cycle may bring it back |
2441 | 2442 | */ |
2442 | 2443 | gem_put_cell(gp); |
2443 | - up(&gp->pm_sem); | |
2444 | + mutex_unlock(&gp->pm_mutex); | |
2444 | 2445 | return 0; |
2445 | 2446 | } |
2446 | 2447 | pci_set_master(gp->pdev); |
... | ... | @@ -2486,7 +2487,7 @@ |
2486 | 2487 | |
2487 | 2488 | netif_poll_enable(dev); |
2488 | 2489 | |
2489 | - up(&gp->pm_sem); | |
2490 | + mutex_unlock(&gp->pm_mutex); | |
2490 | 2491 | |
2491 | 2492 | return 0; |
2492 | 2493 | } |
... | ... | @@ -2591,7 +2592,7 @@ |
2591 | 2592 | return 0; |
2592 | 2593 | } |
2593 | 2594 | |
2594 | - down(&gp->pm_sem); | |
2595 | + mutex_lock(&gp->pm_mutex); | |
2595 | 2596 | spin_lock_irq(&gp->lock); |
2596 | 2597 | spin_lock(&gp->tx_lock); |
2597 | 2598 | dev->mtu = new_mtu; |
... | ... | @@ -2602,7 +2603,7 @@ |
2602 | 2603 | } |
2603 | 2604 | spin_unlock(&gp->tx_lock); |
2604 | 2605 | spin_unlock_irq(&gp->lock); |
2605 | - up(&gp->pm_sem); | |
2606 | + mutex_unlock(&gp->pm_mutex); | |
2606 | 2607 | |
2607 | 2608 | return 0; |
2608 | 2609 | } |
2609 | 2610 | |
... | ... | @@ -2771,10 +2772,10 @@ |
2771 | 2772 | int rc = -EOPNOTSUPP; |
2772 | 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 | 2776 | * with power management. |
2776 | 2777 | */ |
2777 | - down(&gp->pm_sem); | |
2778 | + mutex_lock(&gp->pm_mutex); | |
2778 | 2779 | |
2779 | 2780 | spin_lock_irqsave(&gp->lock, flags); |
2780 | 2781 | gem_get_cell(gp); |
... | ... | @@ -2812,7 +2813,7 @@ |
2812 | 2813 | gem_put_cell(gp); |
2813 | 2814 | spin_unlock_irqrestore(&gp->lock, flags); |
2814 | 2815 | |
2815 | - up(&gp->pm_sem); | |
2816 | + mutex_unlock(&gp->pm_mutex); | |
2816 | 2817 | |
2817 | 2818 | return rc; |
2818 | 2819 | } |
... | ... | @@ -3033,7 +3034,7 @@ |
3033 | 3034 | |
3034 | 3035 | spin_lock_init(&gp->lock); |
3035 | 3036 | spin_lock_init(&gp->tx_lock); |
3036 | - init_MUTEX(&gp->pm_sem); | |
3037 | + mutex_init(&gp->pm_mutex); | |
3037 | 3038 | |
3038 | 3039 | init_timer(&gp->link_timer); |
3039 | 3040 | gp->link_timer.function = gem_link_timer; |
drivers/net/sungem.h
... | ... | @@ -980,15 +980,15 @@ |
980 | 980 | int tx_new, tx_old; |
981 | 981 | |
982 | 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 | 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 | 986 | unsigned int running : 1; /* chip running, protected by lock */ |
987 | 987 | |
988 | 988 | /* cell enable count, protected by lock */ |
989 | 989 | int cell_enabled; |
990 | 990 | |
991 | - struct semaphore pm_sem; | |
991 | + struct mutex pm_mutex; | |
992 | 992 | |
993 | 993 | u32 msg_enable; |
994 | 994 | u32 status; |