aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-10-16 04:27:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:10 -0400
commit4e3dfacaa0b8e469f412ae776f222102042d7e24 (patch)
tree0dbb44298dd5b16d172030234a155f26074008ef
parent4d1ff582246de67b15e3cd2427a39875943ae895 (diff)
use mutex instead of semaphore in isdn subsystem common functions
The ISDN subsystem common functions use a semaphore as mutex. Use the mutex API instead of the (binary) semaphore. Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Acked-by: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/isdn/i4l/isdn_common.c26
-rw-r--r--include/linux/isdn.h3
2 files changed, 15 insertions, 14 deletions
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 4910bca52640..c6df2925ebd0 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -1365,7 +1365,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1365 } else { 1365 } else {
1366 s = NULL; 1366 s = NULL;
1367 } 1367 }
1368 ret = down_interruptible(&dev->sem); 1368 ret = mutex_lock_interruptible(&dev->mtx);
1369 if( ret ) return ret; 1369 if( ret ) return ret;
1370 if ((s = isdn_net_new(s, NULL))) { 1370 if ((s = isdn_net_new(s, NULL))) {
1371 if (copy_to_user(argp, s, strlen(s) + 1)){ 1371 if (copy_to_user(argp, s, strlen(s) + 1)){
@@ -1375,7 +1375,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1375 } 1375 }
1376 } else 1376 } else
1377 ret = -ENODEV; 1377 ret = -ENODEV;
1378 up(&dev->sem); 1378 mutex_unlock(&dev->mtx);
1379 return ret; 1379 return ret;
1380 case IIOCNETASL: 1380 case IIOCNETASL:
1381 /* Add a slave to a network-interface */ 1381 /* Add a slave to a network-interface */
@@ -1384,7 +1384,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1384 return -EFAULT; 1384 return -EFAULT;
1385 } else 1385 } else
1386 return -EINVAL; 1386 return -EINVAL;
1387 ret = down_interruptible(&dev->sem); 1387 ret = mutex_lock_interruptible(&dev->mtx);
1388 if( ret ) return ret; 1388 if( ret ) return ret;
1389 if ((s = isdn_net_newslave(bname))) { 1389 if ((s = isdn_net_newslave(bname))) {
1390 if (copy_to_user(argp, s, strlen(s) + 1)){ 1390 if (copy_to_user(argp, s, strlen(s) + 1)){
@@ -1394,17 +1394,17 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1394 } 1394 }
1395 } else 1395 } else
1396 ret = -ENODEV; 1396 ret = -ENODEV;
1397 up(&dev->sem); 1397 mutex_unlock(&dev->mtx);
1398 return ret; 1398 return ret;
1399 case IIOCNETDIF: 1399 case IIOCNETDIF:
1400 /* Delete a network-interface */ 1400 /* Delete a network-interface */
1401 if (arg) { 1401 if (arg) {
1402 if (copy_from_user(name, argp, sizeof(name))) 1402 if (copy_from_user(name, argp, sizeof(name)))
1403 return -EFAULT; 1403 return -EFAULT;
1404 ret = down_interruptible(&dev->sem); 1404 ret = mutex_lock_interruptible(&dev->mtx);
1405 if( ret ) return ret; 1405 if( ret ) return ret;
1406 ret = isdn_net_rm(name); 1406 ret = isdn_net_rm(name);
1407 up(&dev->sem); 1407 mutex_unlock(&dev->mtx);
1408 return ret; 1408 return ret;
1409 } else 1409 } else
1410 return -EINVAL; 1410 return -EINVAL;
@@ -1433,10 +1433,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1433 if (arg) { 1433 if (arg) {
1434 if (copy_from_user(&phone, argp, sizeof(phone))) 1434 if (copy_from_user(&phone, argp, sizeof(phone)))
1435 return -EFAULT; 1435 return -EFAULT;
1436 ret = down_interruptible(&dev->sem); 1436 ret = mutex_lock_interruptible(&dev->mtx);
1437 if( ret ) return ret; 1437 if( ret ) return ret;
1438 ret = isdn_net_addphone(&phone); 1438 ret = isdn_net_addphone(&phone);
1439 up(&dev->sem); 1439 mutex_unlock(&dev->mtx);
1440 return ret; 1440 return ret;
1441 } else 1441 } else
1442 return -EINVAL; 1442 return -EINVAL;
@@ -1445,10 +1445,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1445 if (arg) { 1445 if (arg) {
1446 if (copy_from_user(&phone, argp, sizeof(phone))) 1446 if (copy_from_user(&phone, argp, sizeof(phone)))
1447 return -EFAULT; 1447 return -EFAULT;
1448 ret = down_interruptible(&dev->sem); 1448 ret = mutex_lock_interruptible(&dev->mtx);
1449 if( ret ) return ret; 1449 if( ret ) return ret;
1450 ret = isdn_net_getphones(&phone, argp); 1450 ret = isdn_net_getphones(&phone, argp);
1451 up(&dev->sem); 1451 mutex_unlock(&dev->mtx);
1452 return ret; 1452 return ret;
1453 } else 1453 } else
1454 return -EINVAL; 1454 return -EINVAL;
@@ -1457,10 +1457,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
1457 if (arg) { 1457 if (arg) {
1458 if (copy_from_user(&phone, argp, sizeof(phone))) 1458 if (copy_from_user(&phone, argp, sizeof(phone)))
1459 return -EFAULT; 1459 return -EFAULT;
1460 ret = down_interruptible(&dev->sem); 1460 ret = mutex_lock_interruptible(&dev->mtx);
1461 if( ret ) return ret; 1461 if( ret ) return ret;
1462 ret = isdn_net_delphone(&phone); 1462 ret = isdn_net_delphone(&phone);
1463 up(&dev->sem); 1463 mutex_unlock(&dev->mtx);
1464 return ret; 1464 return ret;
1465 } else 1465 } else
1466 return -EINVAL; 1466 return -EINVAL;
@@ -2304,7 +2304,7 @@ static int __init isdn_init(void)
2304#ifdef MODULE 2304#ifdef MODULE
2305 dev->owner = THIS_MODULE; 2305 dev->owner = THIS_MODULE;
2306#endif 2306#endif
2307 init_MUTEX(&dev->sem); 2307 mutex_init(&dev->mtx);
2308 init_waitqueue_head(&dev->info_waitq); 2308 init_waitqueue_head(&dev->info_waitq);
2309 for (i = 0; i < ISDN_MAX_CHANNELS; i++) { 2309 for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
2310 dev->drvmap[i] = -1; 2310 dev->drvmap[i] = -1;
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index d5dda4b643ac..d0ecc8eebfbf 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -167,6 +167,7 @@ typedef struct {
167#include <linux/etherdevice.h> 167#include <linux/etherdevice.h>
168#include <linux/skbuff.h> 168#include <linux/skbuff.h>
169#include <linux/tcp.h> 169#include <linux/tcp.h>
170#include <linux/mutex.h>
170 171
171#define ISDN_TTY_MAJOR 43 172#define ISDN_TTY_MAJOR 43
172#define ISDN_TTYAUX_MAJOR 44 173#define ISDN_TTYAUX_MAJOR 44
@@ -616,7 +617,7 @@ typedef struct isdn_devt {
616 int v110emu[ISDN_MAX_CHANNELS]; /* V.110 emulator-mode 0=none */ 617 int v110emu[ISDN_MAX_CHANNELS]; /* V.110 emulator-mode 0=none */
617 atomic_t v110use[ISDN_MAX_CHANNELS]; /* Usage-Semaphore for stream */ 618 atomic_t v110use[ISDN_MAX_CHANNELS]; /* Usage-Semaphore for stream */
618 isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */ 619 isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */
619 struct semaphore sem; /* serialize list access*/ 620 struct mutex mtx; /* serialize list access*/
620 unsigned long global_features; 621 unsigned long global_features;
621} isdn_dev; 622} isdn_dev;
622 623