Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54754
b: refs/heads/master
c: 9ea6e5d
h: refs/heads/master
v: v3
  • Loading branch information
Matthias Kaehlcke authored and Linus Torvalds committed May 8, 2007
1 parent c84648e commit 9bb86bc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a7e27d5dd396419dc6d6288db6a6d86cf3a94ba5
refs/heads/master: 9ea6e5d8088096aeba29b6778c3d3d82fb495e9f
33 changes: 17 additions & 16 deletions trunk/drivers/isdn/capi/capi.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/fcntl.h>
#include <linux/fs.h>
#include <linux/signal.h>
#include <linux/mutex.h>
#include <linux/mm.h>
#include <linux/timer.h>
#include <linux/wait.h>
Expand Down Expand Up @@ -146,7 +147,7 @@ struct capidev {

struct capincci *nccis;

struct semaphore ncci_list_sem;
struct mutex ncci_list_mtx;
};

/* -------- global variables ---------------------------------------- */
Expand Down Expand Up @@ -394,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);
Expand All @@ -413,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);
Expand Down Expand Up @@ -602,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) {
Expand Down Expand Up @@ -751,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);
Expand Down Expand Up @@ -938,17 +939,17 @@ 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
if ((mp = nccip->minorp) != 0) {
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;
Expand All @@ -963,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;
Expand Down

0 comments on commit 9bb86bc

Please sign in to comment.