aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-21 01:35:41 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-21 01:35:41 -0500
commit57b47a53ec4a67691ba32cff5768e8d78fa6c67f (patch)
treed735ae4734f7b386eefa508a0629715f45808d1d /net/atm
parent6613f82dd293b23f582a649b287fadbf8d23e6cf (diff)
[NET]: sem2mutex part 2
Semaphore to mutex 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 'net/atm')
-rw-r--r--net/atm/common.c4
-rw-r--r--net/atm/resources.c32
-rw-r--r--net/atm/resources.h3
3 files changed, 21 insertions, 18 deletions
diff --git a/net/atm/common.c b/net/atm/common.c
index 6656b111cc05..ae002220fa99 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -451,12 +451,12 @@ int vcc_connect(struct socket *sock, int itf, short vpi, int vci)
451 dev = try_then_request_module(atm_dev_lookup(itf), "atm-device-%d", itf); 451 dev = try_then_request_module(atm_dev_lookup(itf), "atm-device-%d", itf);
452 } else { 452 } else {
453 dev = NULL; 453 dev = NULL;
454 down(&atm_dev_mutex); 454 mutex_lock(&atm_dev_mutex);
455 if (!list_empty(&atm_devs)) { 455 if (!list_empty(&atm_devs)) {
456 dev = list_entry(atm_devs.next, struct atm_dev, dev_list); 456 dev = list_entry(atm_devs.next, struct atm_dev, dev_list);
457 atm_dev_hold(dev); 457 atm_dev_hold(dev);
458 } 458 }
459 up(&atm_dev_mutex); 459 mutex_unlock(&atm_dev_mutex);
460 } 460 }
461 if (!dev) 461 if (!dev)
462 return -ENODEV; 462 return -ENODEV;
diff --git a/net/atm/resources.c b/net/atm/resources.c
index 224190537c90..18ac80698f83 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -18,6 +18,8 @@
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19#include <linux/capability.h> 19#include <linux/capability.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/mutex.h>
22
21#include <net/sock.h> /* for struct sock */ 23#include <net/sock.h> /* for struct sock */
22 24
23#include "common.h" 25#include "common.h"
@@ -26,7 +28,7 @@
26 28
27 29
28LIST_HEAD(atm_devs); 30LIST_HEAD(atm_devs);
29DECLARE_MUTEX(atm_dev_mutex); 31DEFINE_MUTEX(atm_dev_mutex);
30 32
31static struct atm_dev *__alloc_atm_dev(const char *type) 33static struct atm_dev *__alloc_atm_dev(const char *type)
32{ 34{
@@ -65,9 +67,9 @@ struct atm_dev *atm_dev_lookup(int number)
65{ 67{
66 struct atm_dev *dev; 68 struct atm_dev *dev;
67 69
68 down(&atm_dev_mutex); 70 mutex_lock(&atm_dev_mutex);
69 dev = __atm_dev_lookup(number); 71 dev = __atm_dev_lookup(number);
70 up(&atm_dev_mutex); 72 mutex_unlock(&atm_dev_mutex);
71 return dev; 73 return dev;
72} 74}
73 75
@@ -83,11 +85,11 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
83 type); 85 type);
84 return NULL; 86 return NULL;
85 } 87 }
86 down(&atm_dev_mutex); 88 mutex_lock(&atm_dev_mutex);
87 if (number != -1) { 89 if (number != -1) {
88 if ((inuse = __atm_dev_lookup(number))) { 90 if ((inuse = __atm_dev_lookup(number))) {
89 atm_dev_put(inuse); 91 atm_dev_put(inuse);
90 up(&atm_dev_mutex); 92 mutex_unlock(&atm_dev_mutex);
91 kfree(dev); 93 kfree(dev);
92 return NULL; 94 return NULL;
93 } 95 }
@@ -112,12 +114,12 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
112 printk(KERN_ERR "atm_dev_register: " 114 printk(KERN_ERR "atm_dev_register: "
113 "atm_proc_dev_register failed for dev %s\n", 115 "atm_proc_dev_register failed for dev %s\n",
114 type); 116 type);
115 up(&atm_dev_mutex); 117 mutex_unlock(&atm_dev_mutex);
116 kfree(dev); 118 kfree(dev);
117 return NULL; 119 return NULL;
118 } 120 }
119 list_add_tail(&dev->dev_list, &atm_devs); 121 list_add_tail(&dev->dev_list, &atm_devs);
120 up(&atm_dev_mutex); 122 mutex_unlock(&atm_dev_mutex);
121 123
122 return dev; 124 return dev;
123} 125}
@@ -133,9 +135,9 @@ void atm_dev_deregister(struct atm_dev *dev)
133 * with same number can appear, such we need deregister proc, 135 * with same number can appear, such we need deregister proc,
134 * release async all vccs and remove them from vccs list too 136 * release async all vccs and remove them from vccs list too
135 */ 137 */
136 down(&atm_dev_mutex); 138 mutex_lock(&atm_dev_mutex);
137 list_del(&dev->dev_list); 139 list_del(&dev->dev_list);
138 up(&atm_dev_mutex); 140 mutex_unlock(&atm_dev_mutex);
139 141
140 atm_dev_release_vccs(dev); 142 atm_dev_release_vccs(dev);
141 atm_proc_dev_deregister(dev); 143 atm_proc_dev_deregister(dev);
@@ -196,16 +198,16 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
196 return -EFAULT; 198 return -EFAULT;
197 if (get_user(len, &iobuf->length)) 199 if (get_user(len, &iobuf->length))
198 return -EFAULT; 200 return -EFAULT;
199 down(&atm_dev_mutex); 201 mutex_lock(&atm_dev_mutex);
200 list_for_each(p, &atm_devs) 202 list_for_each(p, &atm_devs)
201 size += sizeof(int); 203 size += sizeof(int);
202 if (size > len) { 204 if (size > len) {
203 up(&atm_dev_mutex); 205 mutex_unlock(&atm_dev_mutex);
204 return -E2BIG; 206 return -E2BIG;
205 } 207 }
206 tmp_buf = kmalloc(size, GFP_ATOMIC); 208 tmp_buf = kmalloc(size, GFP_ATOMIC);
207 if (!tmp_buf) { 209 if (!tmp_buf) {
208 up(&atm_dev_mutex); 210 mutex_unlock(&atm_dev_mutex);
209 return -ENOMEM; 211 return -ENOMEM;
210 } 212 }
211 tmp_p = tmp_buf; 213 tmp_p = tmp_buf;
@@ -213,7 +215,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
213 dev = list_entry(p, struct atm_dev, dev_list); 215 dev = list_entry(p, struct atm_dev, dev_list);
214 *tmp_p++ = dev->number; 216 *tmp_p++ = dev->number;
215 } 217 }
216 up(&atm_dev_mutex); 218 mutex_unlock(&atm_dev_mutex);
217 error = ((copy_to_user(buf, tmp_buf, size)) || 219 error = ((copy_to_user(buf, tmp_buf, size)) ||
218 put_user(size, &iobuf->length)) 220 put_user(size, &iobuf->length))
219 ? -EFAULT : 0; 221 ? -EFAULT : 0;
@@ -400,13 +402,13 @@ static __inline__ void *dev_get_idx(loff_t left)
400 402
401void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) 403void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos)
402{ 404{
403 down(&atm_dev_mutex); 405 mutex_lock(&atm_dev_mutex);
404 return *pos ? dev_get_idx(*pos) : (void *) 1; 406 return *pos ? dev_get_idx(*pos) : (void *) 1;
405} 407}
406 408
407void atm_dev_seq_stop(struct seq_file *seq, void *v) 409void atm_dev_seq_stop(struct seq_file *seq, void *v)
408{ 410{
409 up(&atm_dev_mutex); 411 mutex_unlock(&atm_dev_mutex);
410} 412}
411 413
412void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) 414void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
diff --git a/net/atm/resources.h b/net/atm/resources.h
index b7fb82a93b42..ac7222fee7a8 100644
--- a/net/atm/resources.h
+++ b/net/atm/resources.h
@@ -8,10 +8,11 @@
8 8
9#include <linux/config.h> 9#include <linux/config.h>
10#include <linux/atmdev.h> 10#include <linux/atmdev.h>
11#include <linux/mutex.h>
11 12
12 13
13extern struct list_head atm_devs; 14extern struct list_head atm_devs;
14extern struct semaphore atm_dev_mutex; 15extern struct mutex atm_dev_mutex;
15 16
16int atm_dev_ioctl(unsigned int cmd, void __user *arg); 17int atm_dev_ioctl(unsigned int cmd, void __user *arg);
17 18