diff options
Diffstat (limited to 'drivers/isdn/capi')
-rw-r--r-- | drivers/isdn/capi/capi.c | 34 | ||||
-rw-r--r-- | drivers/isdn/capi/capiutil.c | 8 |
2 files changed, 18 insertions, 24 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index db1260f73f1..81661b8bd3a 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -18,8 +18,8 @@ #include <linux/fcntl.h> #include <linux/fs.h> #include <linux/signal.h> +#include <linux/mutex.h> #include <linux/mm.h> -#include <linux/smp_lock.h> #include <linux/timer.h> #include <linux/wait.h> #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE @@ -147,7 +147,7 @@ struct capidev { struct capincci *nccis; - struct semaphore ncci_list_sem; + struct mutex ncci_list_mtx; }; /* -------- global variables ---------------------------------------- */ @@ -395,7 +395,7 @@ static struct capidev *capidev_alloc(void) if (!cdev) return NULL; - init_MUTEX(&cdev->ncci_list_sem); + mutex_init(&cdev->ncci_list_mtx); skb_queue_head_init(&cdev->recvqueue); init_waitqueue_head(&cdev->recvwait); write_lock_irqsave(&capidev_list_lock, flags); @@ -414,9 +414,9 @@ static void capidev_free(struct capidev *cdev) } skb_queue_purge(&cdev->recvqueue); - down(&cdev->ncci_list_sem); + mutex_lock(&cdev->ncci_list_mtx); capincci_free(cdev, 0xffffffff); - up(&cdev->ncci_list_sem); + mutex_unlock(&cdev->ncci_list_mtx); write_lock_irqsave(&capidev_list_lock, flags); list_del(&cdev->list); @@ -603,15 +603,15 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) if (CAPIMSG_CMD(skb->data) == CAPI_CONNECT_B3_CONF) { u16 info = CAPIMSG_U16(skb->data, 12); // Info field if (info == 0) { - down(&cdev->ncci_list_sem); + mutex_lock(&cdev->ncci_list_mtx); capincci_alloc(cdev, CAPIMSG_NCCI(skb->data)); - up(&cdev->ncci_list_sem); + mutex_unlock(&cdev->ncci_list_mtx); } } if (CAPIMSG_CMD(skb->data) == CAPI_CONNECT_B3_IND) { - down(&cdev->ncci_list_sem); + mutex_lock(&cdev->ncci_list_mtx); capincci_alloc(cdev, CAPIMSG_NCCI(skb->data)); - up(&cdev->ncci_list_sem); + mutex_unlock(&cdev->ncci_list_mtx); } spin_lock_irqsave(&workaround_lock, flags); if (CAPIMSG_COMMAND(skb->data) != CAPI_DATA_B3) { @@ -752,9 +752,9 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos CAPIMSG_SETAPPID(skb->data, cdev->ap.applid); if (CAPIMSG_CMD(skb->data) == CAPI_DISCONNECT_B3_RESP) { - down(&cdev->ncci_list_sem); + mutex_lock(&cdev->ncci_list_mtx); capincci_free(cdev, CAPIMSG_NCCI(skb->data)); - up(&cdev->ncci_list_sem); + mutex_unlock(&cdev->ncci_list_mtx); } cdev->errcode = capi20_put_message(&cdev->ap, skb); @@ -939,9 +939,9 @@ capi_ioctl(struct inode *inode, struct file *file, if (copy_from_user(&ncci, argp, sizeof(ncci))) return -EFAULT; - down(&cdev->ncci_list_sem); + mutex_lock(&cdev->ncci_list_mtx); if ((nccip = capincci_find(cdev, (u32) ncci)) == 0) { - up(&cdev->ncci_list_sem); + mutex_unlock(&cdev->ncci_list_mtx); return 0; } #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE @@ -949,7 +949,7 @@ capi_ioctl(struct inode *inode, struct file *file, count += atomic_read(&mp->ttyopencount); } #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ - up(&cdev->ncci_list_sem); + mutex_unlock(&cdev->ncci_list_mtx); return count; } return 0; @@ -964,14 +964,14 @@ capi_ioctl(struct inode *inode, struct file *file, if (copy_from_user(&ncci, argp, sizeof(ncci))) return -EFAULT; - down(&cdev->ncci_list_sem); + mutex_lock(&cdev->ncci_list_mtx); nccip = capincci_find(cdev, (u32) ncci); if (!nccip || (mp = nccip->minorp) == 0) { - up(&cdev->ncci_list_sem); + mutex_unlock(&cdev->ncci_list_mtx); return -ESRCH; } unit = mp->minor; - up(&cdev->ncci_list_sem); + mutex_unlock(&cdev->ncci_list_mtx); return unit; } return 0; diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c index ad1e2702c2d..22379b94e88 100644 --- a/drivers/isdn/capi/capiutil.c +++ b/drivers/isdn/capi/capiutil.c @@ -855,7 +855,7 @@ static _cdebbuf *g_debbuf; static u_long g_debbuf_lock; static _cmsg *g_cmsg; -_cdebbuf *cdebbuf_alloc(void) +static _cdebbuf *cdebbuf_alloc(void) { _cdebbuf *cdb; @@ -989,11 +989,6 @@ _cdebbuf *capi_cmsg2str(_cmsg * cmsg) return &g_debbuf; } -_cdebbuf *cdebbuf_alloc(void) -{ - return &g_debbuf; -} - void cdebbuf_free(_cdebbuf *cdb) { } @@ -1009,7 +1004,6 @@ void __exit cdebug_exit(void) #endif -EXPORT_SYMBOL(cdebbuf_alloc); EXPORT_SYMBOL(cdebbuf_free); EXPORT_SYMBOL(capi_cmsg2message); EXPORT_SYMBOL(capi_message2cmsg); |