From 4e3dfacaa0b8e469f412ae776f222102042d7e24 Mon Sep 17 00:00:00 2001 From: Matthias Kaehlcke Date: Tue, 16 Oct 2007 01:27:50 -0700 Subject: 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 Acked-by: Karsten Keil Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/isdn/i4l/isdn_common.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/isdn/i4l') diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index 4910bca5264..c6df2925ebd 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) } else { s = NULL; } - ret = down_interruptible(&dev->sem); + ret = mutex_lock_interruptible(&dev->mtx); if( ret ) return ret; if ((s = isdn_net_new(s, NULL))) { 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) } } else ret = -ENODEV; - up(&dev->sem); + mutex_unlock(&dev->mtx); return ret; case IIOCNETASL: /* Add a slave to a network-interface */ @@ -1384,7 +1384,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) return -EFAULT; } else return -EINVAL; - ret = down_interruptible(&dev->sem); + ret = mutex_lock_interruptible(&dev->mtx); if( ret ) return ret; if ((s = isdn_net_newslave(bname))) { 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) } } else ret = -ENODEV; - up(&dev->sem); + mutex_unlock(&dev->mtx); return ret; case IIOCNETDIF: /* Delete a network-interface */ if (arg) { if (copy_from_user(name, argp, sizeof(name))) return -EFAULT; - ret = down_interruptible(&dev->sem); + ret = mutex_lock_interruptible(&dev->mtx); if( ret ) return ret; ret = isdn_net_rm(name); - up(&dev->sem); + mutex_unlock(&dev->mtx); return ret; } else return -EINVAL; @@ -1433,10 +1433,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) if (arg) { if (copy_from_user(&phone, argp, sizeof(phone))) return -EFAULT; - ret = down_interruptible(&dev->sem); + ret = mutex_lock_interruptible(&dev->mtx); if( ret ) return ret; ret = isdn_net_addphone(&phone); - up(&dev->sem); + mutex_unlock(&dev->mtx); return ret; } else return -EINVAL; @@ -1445,10 +1445,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) if (arg) { if (copy_from_user(&phone, argp, sizeof(phone))) return -EFAULT; - ret = down_interruptible(&dev->sem); + ret = mutex_lock_interruptible(&dev->mtx); if( ret ) return ret; ret = isdn_net_getphones(&phone, argp); - up(&dev->sem); + mutex_unlock(&dev->mtx); return ret; } else return -EINVAL; @@ -1457,10 +1457,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) if (arg) { if (copy_from_user(&phone, argp, sizeof(phone))) return -EFAULT; - ret = down_interruptible(&dev->sem); + ret = mutex_lock_interruptible(&dev->mtx); if( ret ) return ret; ret = isdn_net_delphone(&phone); - up(&dev->sem); + mutex_unlock(&dev->mtx); return ret; } else return -EINVAL; @@ -2304,7 +2304,7 @@ static int __init isdn_init(void) #ifdef MODULE dev->owner = THIS_MODULE; #endif - init_MUTEX(&dev->sem); + mutex_init(&dev->mtx); init_waitqueue_head(&dev->info_waitq); for (i = 0; i < ISDN_MAX_CHANNELS; i++) { dev->drvmap[i] = -1; -- cgit v1.2.3