Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 184225
b: refs/heads/master
c: 884f5c4
h: refs/heads/master
i:
  184223: 39e5e77
v: v3
  • Loading branch information
Jan Kiszka authored and David S. Miller committed Feb 17, 2010
1 parent 3fbb882 commit d76948d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 33 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: 28a1dbb6f7feade304f43798feb15f6978516624
refs/heads/master: 884f5c447901ca9da75432fe8a7a2c2a00327d22
52 changes: 20 additions & 32 deletions trunk/drivers/isdn/capi/capi.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ struct capiminor {
static DEFINE_SPINLOCK(workaround_lock);

struct capincci {
struct capincci *next;
struct list_head list;
u32 ncci;
struct capidev *cdev;
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
Expand All @@ -139,7 +139,7 @@ struct capidev {
struct sk_buff_head recvqueue;
wait_queue_head_t recvwait;

struct capincci *nccis;
struct list_head nccis;

struct mutex lock;
};
Expand Down Expand Up @@ -356,7 +356,7 @@ static inline unsigned int capincci_minor_opencount(struct capincci *np)

static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)
{
struct capincci *np, **pp;
struct capincci *np;

np = kzalloc(sizeof(*np), GFP_KERNEL);
if (!np)
Expand All @@ -366,39 +366,31 @@ static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)

capincci_alloc_minor(cdev, np);

for (pp=&cdev->nccis; *pp; pp = &(*pp)->next)
;
*pp = np;
return np;
list_add_tail(&np->list, &cdev->nccis);

return np;
}

static void capincci_free(struct capidev *cdev, u32 ncci)
{
struct capincci *np, **pp;
struct capincci *np, *tmp;

pp=&cdev->nccis;
while (*pp) {
np = *pp;
list_for_each_entry_safe(np, tmp, &cdev->nccis, list)
if (ncci == 0xffffffff || np->ncci == ncci) {
*pp = (*pp)->next;
capincci_free_minor(np);
list_del(&np->list);
kfree(np);
if (*pp == NULL) return;
} else {
pp = &(*pp)->next;
}
}
}

static struct capincci *capincci_find(struct capidev *cdev, u32 ncci)
{
struct capincci *p;
struct capincci *np;

for (p=cdev->nccis; p ; p = p->next) {
if (p->ncci == ncci)
break;
}
return p;
list_for_each_entry(np, &cdev->nccis, list)
if (np->ncci == ncci)
return np;
return NULL;
}

#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
Expand Down Expand Up @@ -955,6 +947,7 @@ static int capi_open(struct inode *inode, struct file *file)
mutex_init(&cdev->lock);
skb_queue_head_init(&cdev->recvqueue);
init_waitqueue_head(&cdev->recvwait);
INIT_LIST_HEAD(&cdev->nccis);
file->private_data = cdev;

mutex_lock(&capidev_list_lock);
Expand Down Expand Up @@ -1427,19 +1420,14 @@ static const struct file_operations capi20_proc_fops = {
*/
static int capi20ncci_proc_show(struct seq_file *m, void *v)
{
struct capidev *cdev;
struct capincci *np;
struct list_head *l;
struct capidev *cdev;
struct capincci *np;

mutex_lock(&capidev_list_lock);
list_for_each(l, &capidev_list) {
cdev = list_entry(l, struct capidev, list);
list_for_each_entry(cdev, &capidev_list, list) {
mutex_lock(&cdev->lock);
for (np=cdev->nccis; np; np = np->next) {
seq_printf(m, "%d 0x%x\n",
cdev->ap.applid,
np->ncci);
}
list_for_each_entry(np, &cdev->nccis, list)
seq_printf(m, "%d 0x%x\n", cdev->ap.applid, np->ncci);
mutex_unlock(&cdev->lock);
}
mutex_unlock(&capidev_list_lock);
Expand Down

0 comments on commit d76948d

Please sign in to comment.