diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-03-21 01:33:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:33:17 -0500 |
commit | 4a3e2f711a00a1feb72ae12fdc749da10179d185 (patch) | |
tree | 76ced9d3270dea4b864da71fa1d4415d2e3c8b11 /net/ipv4/ipcomp.c | |
parent | d4ccd08cdfa8d34f4d25b62041343c52fc79385f (diff) |
[NET] sem2mutex: net/
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
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 'net/ipv4/ipcomp.c')
-rw-r--r-- | net/ipv4/ipcomp.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index d64e2ec8da7b..c95020f7c81e 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/vmalloc.h> | 25 | #include <linux/vmalloc.h> |
26 | #include <linux/rtnetlink.h> | 26 | #include <linux/rtnetlink.h> |
27 | #include <linux/mutex.h> | ||
27 | #include <net/ip.h> | 28 | #include <net/ip.h> |
28 | #include <net/xfrm.h> | 29 | #include <net/xfrm.h> |
29 | #include <net/icmp.h> | 30 | #include <net/icmp.h> |
@@ -36,7 +37,7 @@ struct ipcomp_tfms { | |||
36 | int users; | 37 | int users; |
37 | }; | 38 | }; |
38 | 39 | ||
39 | static DECLARE_MUTEX(ipcomp_resource_sem); | 40 | static DEFINE_MUTEX(ipcomp_resource_mutex); |
40 | static void **ipcomp_scratches; | 41 | static void **ipcomp_scratches; |
41 | static int ipcomp_scratch_users; | 42 | static int ipcomp_scratch_users; |
42 | static LIST_HEAD(ipcomp_tfms_list); | 43 | static LIST_HEAD(ipcomp_tfms_list); |
@@ -253,7 +254,7 @@ error: | |||
253 | } | 254 | } |
254 | 255 | ||
255 | /* | 256 | /* |
256 | * Must be protected by xfrm_cfg_sem. State and tunnel user references are | 257 | * Must be protected by xfrm_cfg_mutex. State and tunnel user references are |
257 | * always incremented on success. | 258 | * always incremented on success. |
258 | */ | 259 | */ |
259 | static int ipcomp_tunnel_attach(struct xfrm_state *x) | 260 | static int ipcomp_tunnel_attach(struct xfrm_state *x) |
@@ -411,9 +412,9 @@ static void ipcomp_destroy(struct xfrm_state *x) | |||
411 | if (!ipcd) | 412 | if (!ipcd) |
412 | return; | 413 | return; |
413 | xfrm_state_delete_tunnel(x); | 414 | xfrm_state_delete_tunnel(x); |
414 | down(&ipcomp_resource_sem); | 415 | mutex_lock(&ipcomp_resource_mutex); |
415 | ipcomp_free_data(ipcd); | 416 | ipcomp_free_data(ipcd); |
416 | up(&ipcomp_resource_sem); | 417 | mutex_unlock(&ipcomp_resource_mutex); |
417 | kfree(ipcd); | 418 | kfree(ipcd); |
418 | } | 419 | } |
419 | 420 | ||
@@ -440,14 +441,14 @@ static int ipcomp_init_state(struct xfrm_state *x) | |||
440 | if (x->props.mode) | 441 | if (x->props.mode) |
441 | x->props.header_len += sizeof(struct iphdr); | 442 | x->props.header_len += sizeof(struct iphdr); |
442 | 443 | ||
443 | down(&ipcomp_resource_sem); | 444 | mutex_lock(&ipcomp_resource_mutex); |
444 | if (!ipcomp_alloc_scratches()) | 445 | if (!ipcomp_alloc_scratches()) |
445 | goto error; | 446 | goto error; |
446 | 447 | ||
447 | ipcd->tfms = ipcomp_alloc_tfms(x->calg->alg_name); | 448 | ipcd->tfms = ipcomp_alloc_tfms(x->calg->alg_name); |
448 | if (!ipcd->tfms) | 449 | if (!ipcd->tfms) |
449 | goto error; | 450 | goto error; |
450 | up(&ipcomp_resource_sem); | 451 | mutex_unlock(&ipcomp_resource_mutex); |
451 | 452 | ||
452 | if (x->props.mode) { | 453 | if (x->props.mode) { |
453 | err = ipcomp_tunnel_attach(x); | 454 | err = ipcomp_tunnel_attach(x); |
@@ -464,10 +465,10 @@ out: | |||
464 | return err; | 465 | return err; |
465 | 466 | ||
466 | error_tunnel: | 467 | error_tunnel: |
467 | down(&ipcomp_resource_sem); | 468 | mutex_lock(&ipcomp_resource_mutex); |
468 | error: | 469 | error: |
469 | ipcomp_free_data(ipcd); | 470 | ipcomp_free_data(ipcd); |
470 | up(&ipcomp_resource_sem); | 471 | mutex_unlock(&ipcomp_resource_mutex); |
471 | kfree(ipcd); | 472 | kfree(ipcd); |
472 | goto out; | 473 | goto out; |
473 | } | 474 | } |