Commit 3e12a6dc authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-isdn.bkbits.net/linux-2.5.isdn

into home.transmeta.com:/home/torvalds/v2.5/linux
parents a06ae2d9 dd7728a8
...@@ -84,7 +84,7 @@ struct capiminor { ...@@ -84,7 +84,7 @@ struct capiminor {
struct capincci *nccip; struct capincci *nccip;
unsigned int minor; unsigned int minor;
u16 applid; struct capi20_appl *ap;
u32 ncci; u32 ncci;
u16 datahandle; u16 datahandle;
u16 msgid; u16 msgid;
...@@ -121,26 +121,18 @@ struct capincci { ...@@ -121,26 +121,18 @@ struct capincci {
struct capidev { struct capidev {
struct list_head list; struct list_head list;
u16 applid; struct capi20_appl ap;
u16 errcode; u16 errcode;
unsigned userflags; unsigned userflags;
struct sk_buff_head recvqueue; struct sk_buff_head recvqueue;
wait_queue_head_t recvwait; wait_queue_head_t recvwait;
/* Statistic */
unsigned long nrecvctlpkt;
unsigned long nrecvdatapkt;
unsigned long nsentctlpkt;
unsigned long nsentdatapkt;
struct capincci *nccis; struct capincci *nccis;
}; };
/* -------- global variables ---------------------------------------- */ /* -------- global variables ---------------------------------------- */
static struct capi_interface *capifuncs;
static rwlock_t capidev_list_lock = RW_LOCK_UNLOCKED; static rwlock_t capidev_list_lock = RW_LOCK_UNLOCKED;
static LIST_HEAD(capidev_list); static LIST_HEAD(capidev_list);
...@@ -209,7 +201,7 @@ static void capiminor_del_all_ack(struct capiminor *mp) ...@@ -209,7 +201,7 @@ static void capiminor_del_all_ack(struct capiminor *mp)
/* -------- struct capiminor ---------------------------------------- */ /* -------- struct capiminor ---------------------------------------- */
static struct capiminor *capiminor_alloc(u16 applid, u32 ncci) static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
{ {
struct capiminor *mp, *p; struct capiminor *mp, *p;
struct list_head *l; struct list_head *l;
...@@ -227,7 +219,7 @@ static struct capiminor *capiminor_alloc(u16 applid, u32 ncci) ...@@ -227,7 +219,7 @@ static struct capiminor *capiminor_alloc(u16 applid, u32 ncci)
printk(KERN_DEBUG "capiminor_alloc %d\n", GET_USE_COUNT(THIS_MODULE)); printk(KERN_DEBUG "capiminor_alloc %d\n", GET_USE_COUNT(THIS_MODULE));
#endif #endif
memset(mp, 0, sizeof(struct capiminor)); memset(mp, 0, sizeof(struct capiminor));
mp->applid = applid; mp->ap = ap;
mp->ncci = ncci; mp->ncci = ncci;
mp->msgid = 0; mp->msgid = 0;
atomic_set(&mp->ttyopencount,0); atomic_set(&mp->ttyopencount,0);
...@@ -311,7 +303,7 @@ static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci) ...@@ -311,7 +303,7 @@ static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
mp = 0; mp = 0;
if (cdev->userflags & CAPIFLAG_HIGHJACKING) if (cdev->userflags & CAPIFLAG_HIGHJACKING)
mp = np->minorp = capiminor_alloc(cdev->applid, ncci); mp = np->minorp = capiminor_alloc(&cdev->ap, ncci);
if (mp) { if (mp) {
mp->nccip = np; mp->nccip = np;
#ifdef _DEBUG_REFCOUNT #ifdef _DEBUG_REFCOUNT
...@@ -401,10 +393,10 @@ static void capidev_free(struct capidev *cdev) ...@@ -401,10 +393,10 @@ static void capidev_free(struct capidev *cdev)
{ {
unsigned long flags; unsigned long flags;
if (cdev->applid) if (cdev->ap.applid) {
(*capifuncs->capi_release) (cdev->applid); capi20_release(&cdev->ap);
cdev->applid = 0; cdev->ap.applid = 0;
}
skb_queue_purge(&cdev->recvqueue); skb_queue_purge(&cdev->recvqueue);
write_lock_irqsave(&capidev_list_lock, flags); write_lock_irqsave(&capidev_list_lock, flags);
...@@ -425,7 +417,7 @@ gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb) ...@@ -425,7 +417,7 @@ gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb)
u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2); u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2);
unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN); unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN);
capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN); capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN);
capimsg_setu16(s, 2, mp->applid); capimsg_setu16(s, 2, mp->ap->applid);
capimsg_setu8 (s, 4, CAPI_DATA_B3); capimsg_setu8 (s, 4, CAPI_DATA_B3);
capimsg_setu8 (s, 5, CAPI_RESP); capimsg_setu8 (s, 5, CAPI_RESP);
capimsg_setu16(s, 6, mp->msgid++); capimsg_setu16(s, 6, mp->msgid++);
...@@ -465,7 +457,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb) ...@@ -465,7 +457,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
return -1; return -1;
} }
datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4); datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4);
errcode = (*capifuncs->capi_put_message)(mp->applid, nskb); errcode = capi20_put_message(mp->ap, nskb);
if (errcode != CAPI_NOERROR) { if (errcode != CAPI_NOERROR) {
printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n", printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n",
errcode); errcode);
...@@ -523,7 +515,7 @@ static int handle_minor_send(struct capiminor *mp) ...@@ -523,7 +515,7 @@ static int handle_minor_send(struct capiminor *mp)
skb_push(skb, CAPI_DATA_B3_REQ_LEN); skb_push(skb, CAPI_DATA_B3_REQ_LEN);
memset(skb->data, 0, CAPI_DATA_B3_REQ_LEN); memset(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
capimsg_setu16(skb->data, 0, CAPI_DATA_B3_REQ_LEN); capimsg_setu16(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
capimsg_setu16(skb->data, 2, mp->applid); capimsg_setu16(skb->data, 2, mp->ap->applid);
capimsg_setu8 (skb->data, 4, CAPI_DATA_B3); capimsg_setu8 (skb->data, 4, CAPI_DATA_B3);
capimsg_setu8 (skb->data, 5, CAPI_REQ); capimsg_setu8 (skb->data, 5, CAPI_REQ);
capimsg_setu16(skb->data, 6, mp->msgid++); capimsg_setu16(skb->data, 6, mp->msgid++);
...@@ -538,7 +530,7 @@ static int handle_minor_send(struct capiminor *mp) ...@@ -538,7 +530,7 @@ static int handle_minor_send(struct capiminor *mp)
skb_queue_head(&mp->outqueue, skb); skb_queue_head(&mp->outqueue, skb);
return count; return count;
} }
errcode = (*capifuncs->capi_put_message) (mp->applid, skb); errcode = capi20_put_message(mp->ap, skb);
if (errcode == CAPI_NOERROR) { if (errcode == CAPI_NOERROR) {
mp->datahandle++; mp->datahandle++;
count++; count++;
...@@ -568,25 +560,16 @@ static int handle_minor_send(struct capiminor *mp) ...@@ -568,25 +560,16 @@ static int handle_minor_send(struct capiminor *mp)
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
/* -------- function called by lower level -------------------------- */ /* -------- function called by lower level -------------------------- */
static void capi_signal(u16 applid, void *param) static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
{ {
struct capidev *cdev = (struct capidev *)param; struct capidev *cdev = ap->private;
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
struct capiminor *mp; struct capiminor *mp;
u16 datahandle; u16 datahandle;
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
struct capincci *np; struct capincci *np;
struct sk_buff *skb = 0;
u32 ncci; u32 ncci;
(void) (*capifuncs->capi_get_message) (applid, &skb);
if (!skb) {
printk(KERN_ERR "BUG: capi_signal: no skb\n");
return;
}
BUG_ON(cdev->applid != applid);
if (CAPIMSG_COMMAND(skb->data) == CAPI_CONNECT_B3_CONF) { if (CAPIMSG_COMMAND(skb->data) == CAPI_CONNECT_B3_CONF) {
u16 info = CAPIMSG_U16(skb->data, 12); // Info field u16 info = CAPIMSG_U16(skb->data, 12); // Info field
if (info == 0) if (info == 0)
...@@ -668,7 +651,7 @@ capi_read(struct file *file, char *buf, size_t count, loff_t *ppos) ...@@ -668,7 +651,7 @@ capi_read(struct file *file, char *buf, size_t count, loff_t *ppos)
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
return -ESPIPE; return -ESPIPE;
if (!cdev->applid) if (!cdev->ap.applid)
return -ENODEV; return -ENODEV;
if ((skb = skb_dequeue(&cdev->recvqueue)) == 0) { if ((skb = skb_dequeue(&cdev->recvqueue)) == 0) {
...@@ -697,12 +680,6 @@ capi_read(struct file *file, char *buf, size_t count, loff_t *ppos) ...@@ -697,12 +680,6 @@ capi_read(struct file *file, char *buf, size_t count, loff_t *ppos)
} }
copied = skb->len; copied = skb->len;
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_IND) {
cdev->nrecvdatapkt++;
} else {
cdev->nrecvctlpkt++;
}
kfree_skb(skb); kfree_skb(skb);
return copied; return copied;
...@@ -719,7 +696,7 @@ capi_write(struct file *file, const char *buf, size_t count, loff_t *ppos) ...@@ -719,7 +696,7 @@ capi_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
return -ESPIPE; return -ESPIPE;
if (!cdev->applid) if (!cdev->ap.applid)
return -ENODEV; return -ENODEV;
skb = alloc_skb(count, GFP_USER); skb = alloc_skb(count, GFP_USER);
...@@ -742,24 +719,19 @@ capi_write(struct file *file, const char *buf, size_t count, loff_t *ppos) ...@@ -742,24 +719,19 @@ capi_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
return -EINVAL; return -EINVAL;
} }
} }
CAPIMSG_SETAPPID(skb->data, cdev->applid); CAPIMSG_SETAPPID(skb->data, cdev->ap.applid);
if (CAPIMSG_COMMAND(skb->data) == CAPI_DISCONNECT_B3_RESP) { if (CAPIMSG_COMMAND(skb->data) == CAPI_DISCONNECT_B3_RESP) {
capincci_free(cdev, CAPIMSG_NCCI(skb->data)); capincci_free(cdev, CAPIMSG_NCCI(skb->data));
} }
cdev->errcode = (*capifuncs->capi_put_message) (cdev->applid, skb); cdev->errcode = capi20_put_message(&cdev->ap, skb);
if (cdev->errcode) { if (cdev->errcode) {
kfree_skb(skb); kfree_skb(skb);
return -EIO; return -EIO;
} }
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
cdev->nsentdatapkt++;
} else {
cdev->nsentctlpkt++;
}
return count; return count;
} }
...@@ -769,7 +741,7 @@ capi_poll(struct file *file, poll_table * wait) ...@@ -769,7 +741,7 @@ capi_poll(struct file *file, poll_table * wait)
struct capidev *cdev = (struct capidev *)file->private_data; struct capidev *cdev = (struct capidev *)file->private_data;
unsigned int mask = 0; unsigned int mask = 0;
if (!cdev->applid) if (!cdev->ap.applid)
return POLLERR; return POLLERR;
poll_wait(file, &(cdev->recvwait), wait); poll_wait(file, &(cdev->recvwait), wait);
...@@ -783,28 +755,30 @@ static int ...@@ -783,28 +755,30 @@ static int
capi_ioctl(struct inode *inode, struct file *file, capi_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct capidev *cdev = (struct capidev *)file->private_data; struct capidev *cdev = file->private_data;
struct capi20_appl *ap = &cdev->ap;
capi_ioctl_struct data; capi_ioctl_struct data;
int retval = -EINVAL; int retval = -EINVAL;
switch (cmd) { switch (cmd) {
case CAPI_REGISTER: case CAPI_REGISTER:
{ {
retval = copy_from_user((void *) &data.rparams, if (ap->applid)
(void *) arg, sizeof(struct capi_register_params));
if (retval)
return -EFAULT;
if (cdev->applid)
return -EEXIST; return -EEXIST;
cdev->errcode = (*capifuncs->capi_register) (&data.rparams,
&cdev->applid); if (copy_from_user(&cdev->ap.rparam, (void *) arg,
sizeof(struct capi_register_params)))
return -EFAULT;
cdev->ap.private = cdev;
cdev->ap.recv_message = capi_recv_message;
cdev->errcode = capi20_register(ap);
if (cdev->errcode) { if (cdev->errcode) {
cdev->applid = 0; ap->applid = 0;
return -EIO; return -EIO;
} }
(void) (*capifuncs->capi_set_signal) (cdev->applid, capi_signal, cdev);
} }
return (int)cdev->applid; return (int)ap->applid;
case CAPI_GET_VERSION: case CAPI_GET_VERSION:
{ {
...@@ -813,7 +787,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -813,7 +787,7 @@ capi_ioctl(struct inode *inode, struct file *file,
sizeof(data.contr)); sizeof(data.contr));
if (retval) if (retval)
return -EFAULT; return -EFAULT;
cdev->errcode = (*capifuncs->capi_get_version) (data.contr, &data.version); cdev->errcode = capi20_get_version(data.contr, &data.version);
if (cdev->errcode) if (cdev->errcode)
return -EIO; return -EIO;
retval = copy_to_user((void *) arg, retval = copy_to_user((void *) arg,
...@@ -831,7 +805,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -831,7 +805,7 @@ capi_ioctl(struct inode *inode, struct file *file,
sizeof(data.contr)); sizeof(data.contr));
if (retval) if (retval)
return -EFAULT; return -EFAULT;
cdev->errcode = (*capifuncs->capi_get_serial) (data.contr, data.serial); cdev->errcode = capi20_get_serial (data.contr, data.serial);
if (cdev->errcode) if (cdev->errcode)
return -EIO; return -EIO;
retval = copy_to_user((void *) arg, retval = copy_to_user((void *) arg,
...@@ -850,7 +824,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -850,7 +824,7 @@ capi_ioctl(struct inode *inode, struct file *file,
return -EFAULT; return -EFAULT;
if (data.contr == 0) { if (data.contr == 0) {
cdev->errcode = (*capifuncs->capi_get_profile) (data.contr, &data.profile); cdev->errcode = capi20_get_profile(data.contr, &data.profile);
if (cdev->errcode) if (cdev->errcode)
return -EIO; return -EIO;
...@@ -859,7 +833,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -859,7 +833,7 @@ capi_ioctl(struct inode *inode, struct file *file,
sizeof(data.profile.ncontroller)); sizeof(data.profile.ncontroller));
} else { } else {
cdev->errcode = (*capifuncs->capi_get_profile) (data.contr, &data.profile); cdev->errcode = capi20_get_profile(data.contr, &data.profile);
if (cdev->errcode) if (cdev->errcode)
return -EIO; return -EIO;
...@@ -879,7 +853,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -879,7 +853,7 @@ capi_ioctl(struct inode *inode, struct file *file,
sizeof(data.contr)); sizeof(data.contr));
if (retval) if (retval)
return -EFAULT; return -EFAULT;
cdev->errcode = (*capifuncs->capi_get_manufacturer) (data.contr, data.manufacturer); cdev->errcode = capi20_get_manufacturer(data.contr, data.manufacturer);
if (cdev->errcode) if (cdev->errcode)
return -EIO; return -EIO;
...@@ -903,7 +877,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -903,7 +877,7 @@ capi_ioctl(struct inode *inode, struct file *file,
return data.errcode; return data.errcode;
case CAPI_INSTALLED: case CAPI_INSTALLED:
if ((*capifuncs->capi_isinstalled)() == CAPI_NOERROR) if (capi20_isinstalled() == CAPI_NOERROR)
return 0; return 0;
return -ENXIO; return -ENXIO;
...@@ -916,7 +890,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -916,7 +890,7 @@ capi_ioctl(struct inode *inode, struct file *file,
sizeof(mcmd)); sizeof(mcmd));
if (retval) if (retval)
return -EFAULT; return -EFAULT;
return (*capifuncs->capi_manufacturer) (mcmd.cmd, mcmd.data); return capi20_manufacturer(mcmd.cmd, mcmd.data);
} }
return 0; return 0;
...@@ -1428,11 +1402,11 @@ static int proc_capidev_read_proc(char *page, char **start, off_t off, ...@@ -1428,11 +1402,11 @@ static int proc_capidev_read_proc(char *page, char **start, off_t off,
list_for_each(l, &capidev_list) { list_for_each(l, &capidev_list) {
cdev = list_entry(l, struct capidev, list); cdev = list_entry(l, struct capidev, list);
len += sprintf(page+len, "0 %d %lu %lu %lu %lu\n", len += sprintf(page+len, "0 %d %lu %lu %lu %lu\n",
cdev->applid, cdev->ap.applid,
cdev->nrecvctlpkt, cdev->ap.nrecvctlpkt,
cdev->nrecvdatapkt, cdev->ap.nrecvdatapkt,
cdev->nsentctlpkt, cdev->ap.nsentctlpkt,
cdev->nsentdatapkt); cdev->ap.nsentdatapkt);
if (len <= off) { if (len <= off) {
off -= len; off -= len;
len = 0; len = 0;
...@@ -1468,7 +1442,7 @@ static int proc_capincci_read_proc(char *page, char **start, off_t off, ...@@ -1468,7 +1442,7 @@ static int proc_capincci_read_proc(char *page, char **start, off_t off,
cdev = list_entry(l, struct capidev, list); cdev = list_entry(l, struct capidev, list);
for (np=cdev->nccis; np; np = np->next) { for (np=cdev->nccis; np; np = np->next) {
len += sprintf(page+len, "%d 0x%x\n", len += sprintf(page+len, "%d 0x%x\n",
cdev->applid, cdev->ap.applid,
np->ncci); np->ncci);
if (len <= off) { if (len <= off) {
off -= len; off -= len;
...@@ -1596,10 +1570,6 @@ static int __init alloc_init(void) ...@@ -1596,10 +1570,6 @@ static int __init alloc_init(void)
return 0; return 0;
} }
static struct capi_interface_user cuser = {
name: "capi20",
};
static char rev[32]; static char rev[32];
static int __init capi_init(void) static int __init capi_init(void)
...@@ -1628,19 +1598,8 @@ static int __init capi_init(void) ...@@ -1628,19 +1598,8 @@ static int __init capi_init(void)
&capi_fops, NULL); &capi_fops, NULL);
printk(KERN_NOTICE "capi20: started up with major %d\n", capi_major); printk(KERN_NOTICE "capi20: started up with major %d\n", capi_major);
if ((capifuncs = attach_capi_interface(&cuser)) == 0) {
MOD_DEC_USE_COUNT;
devfs_unregister_chrdev(capi_major, "capi20");
devfs_unregister(devfs_find_handle(NULL, "capi20",
capi_major, 0,
DEVFS_SPECIAL_CHR, 0));
return -EIO;
}
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
if (capinc_tty_init() < 0) { if (capinc_tty_init() < 0) {
(void) detach_capi_interface(&cuser);
devfs_unregister_chrdev(capi_major, "capi20"); devfs_unregister_chrdev(capi_major, "capi20");
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return -ENOMEM; return -ENOMEM;
...@@ -1651,7 +1610,6 @@ static int __init capi_init(void) ...@@ -1651,7 +1610,6 @@ static int __init capi_init(void)
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
capinc_tty_exit(); capinc_tty_exit();
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
(void) detach_capi_interface(&cuser);
devfs_unregister_chrdev(capi_major, "capi20"); devfs_unregister_chrdev(capi_major, "capi20");
devfs_unregister(devfs_find_handle(NULL, "capi20", devfs_unregister(devfs_find_handle(NULL, "capi20",
capi_major, 0, capi_major, 0,
...@@ -1689,7 +1647,6 @@ static void __exit capi_exit(void) ...@@ -1689,7 +1647,6 @@ static void __exit capi_exit(void)
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
capinc_tty_exit(); capinc_tty_exit();
#endif #endif
(void) detach_capi_interface(&cuser);
printk(KERN_NOTICE "capi: Rev %s: unloaded\n", rev); printk(KERN_NOTICE "capi: Rev %s: unloaded\n", rev);
} }
......
...@@ -125,15 +125,9 @@ struct capidrv_contr { ...@@ -125,15 +125,9 @@ struct capidrv_contr {
struct capidrv_data { struct capidrv_data {
u16 appid; struct capi20_appl ap;
int ncontr; int ncontr;
struct capidrv_contr *contr_list; struct capidrv_contr *contr_list;
/* statistic */
unsigned long nrecvctlpkt;
unsigned long nrecvdatapkt;
unsigned long nsentctlpkt;
unsigned long nsentdatapkt;
}; };
typedef struct capidrv_plci capidrv_plci; typedef struct capidrv_plci capidrv_plci;
...@@ -146,7 +140,6 @@ typedef struct capidrv_bchan capidrv_bchan; ...@@ -146,7 +140,6 @@ typedef struct capidrv_bchan capidrv_bchan;
static capidrv_data global; static capidrv_data global;
static spinlock_t global_lock = SPIN_LOCK_UNLOCKED; static spinlock_t global_lock = SPIN_LOCK_UNLOCKED;
static struct capi_interface *capifuncs;
static void handle_dtrace_data(capidrv_contr *card, static void handle_dtrace_data(capidrv_contr *card,
int send, int level2, u8 *data, u16 len); int send, int level2, u8 *data, u16 len);
...@@ -519,8 +512,7 @@ static void send_message(capidrv_contr * card, _cmsg * cmsg) ...@@ -519,8 +512,7 @@ static void send_message(capidrv_contr * card, _cmsg * cmsg)
len = CAPIMSG_LEN(cmsg->buf); len = CAPIMSG_LEN(cmsg->buf);
skb = alloc_skb(len, GFP_ATOMIC); skb = alloc_skb(len, GFP_ATOMIC);
memcpy(skb_put(skb, len), cmsg->buf, len); memcpy(skb_put(skb, len), cmsg->buf, len);
(*capifuncs->capi_put_message) (global.appid, skb); capi20_put_message(&global.ap, skb);
global.nsentctlpkt++;
} }
/* -------- state machine -------------------------------------------- */ /* -------- state machine -------------------------------------------- */
...@@ -667,7 +659,7 @@ static void n0(capidrv_contr * card, capidrv_ncci * ncci) ...@@ -667,7 +659,7 @@ static void n0(capidrv_contr * card, capidrv_ncci * ncci)
isdn_ctrl cmd; isdn_ctrl cmd;
capi_fill_DISCONNECT_REQ(&cmsg, capi_fill_DISCONNECT_REQ(&cmsg,
global.appid, global.ap.applid,
card->msgid++, card->msgid++,
ncci->plcip->plci, ncci->plcip->plci,
0, /* BChannelinformation */ 0, /* BChannelinformation */
...@@ -955,7 +947,7 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg) ...@@ -955,7 +947,7 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg)
cmd.parm.setup.si2, cmd.parm.setup.si2,
cmd.parm.setup.eazmsn); cmd.parm.setup.eazmsn);
capi_fill_ALERT_REQ(cmsg, capi_fill_ALERT_REQ(cmsg,
global.appid, global.ap.applid,
card->msgid++, card->msgid++,
plcip->plci, /* adr */ plcip->plci, /* adr */
0, /* BChannelinformation */ 0, /* BChannelinformation */
...@@ -1095,7 +1087,7 @@ static void handle_plci(_cmsg * cmsg) ...@@ -1095,7 +1087,7 @@ static void handle_plci(_cmsg * cmsg)
break; /* $$$$ */ break; /* $$$$ */
} }
capi_fill_CONNECT_B3_REQ(cmsg, capi_fill_CONNECT_B3_REQ(cmsg,
global.appid, global.ap.applid,
card->msgid++, card->msgid++,
plcip->plci, /* adr */ plcip->plci, /* adr */
0 /* NCPI */ 0 /* NCPI */
...@@ -1212,7 +1204,7 @@ static void handle_ncci(_cmsg * cmsg) ...@@ -1212,7 +1204,7 @@ static void handle_ncci(_cmsg * cmsg)
if (nccip) { if (nccip) {
ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_IND); ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_IND);
capi_fill_CONNECT_B3_RESP(cmsg, capi_fill_CONNECT_B3_RESP(cmsg,
global.appid, global.ap.applid,
card->msgid++, card->msgid++,
nccip->ncci, /* adr */ nccip->ncci, /* adr */
0, /* Reject */ 0, /* Reject */
...@@ -1230,7 +1222,7 @@ static void handle_ncci(_cmsg * cmsg) ...@@ -1230,7 +1222,7 @@ static void handle_ncci(_cmsg * cmsg)
cmsg->adr.adrNCCI); cmsg->adr.adrNCCI);
} }
capi_fill_CONNECT_B3_RESP(cmsg, capi_fill_CONNECT_B3_RESP(cmsg,
global.appid, global.ap.applid,
card->msgid++, card->msgid++,
cmsg->adr.adrNCCI, cmsg->adr.adrNCCI,
2, /* Reject */ 2, /* Reject */
...@@ -1373,21 +1365,17 @@ static void handle_data(_cmsg * cmsg, struct sk_buff *skb) ...@@ -1373,21 +1365,17 @@ static void handle_data(_cmsg * cmsg, struct sk_buff *skb)
static _cmsg s_cmsg; static _cmsg s_cmsg;
static void capidrv_signal(u16 applid, void *dummy) static void capidrv_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
{ {
struct sk_buff *skb = 0;
while ((*capifuncs->capi_get_message) (global.appid, &skb) == CAPI_NOERROR) {
capi_message2cmsg(&s_cmsg, skb->data); capi_message2cmsg(&s_cmsg, skb->data);
if (debugmode > 2) if (debugmode > 2)
printk(KERN_DEBUG "capidrv_signal: applid=%d %s\n", printk(KERN_DEBUG "capidrv_signal: applid=%d %s\n",
applid, capi_cmsg2str(&s_cmsg)); ap->applid, capi_cmsg2str(&s_cmsg));
if (s_cmsg.Command == CAPI_DATA_B3 if (s_cmsg.Command == CAPI_DATA_B3
&& s_cmsg.Subcommand == CAPI_IND) { && s_cmsg.Subcommand == CAPI_IND) {
handle_data(&s_cmsg, skb); handle_data(&s_cmsg, skb);
global.nrecvdatapkt++; return;
continue;
} }
if ((s_cmsg.adr.adrController & 0xffffff00) == 0) if ((s_cmsg.adr.adrController & 0xffffff00) == 0)
handle_controller(&s_cmsg); handle_controller(&s_cmsg);
...@@ -1401,8 +1389,6 @@ static void capidrv_signal(u16 applid, void *dummy) ...@@ -1401,8 +1389,6 @@ static void capidrv_signal(u16 applid, void *dummy)
* thanks to Lars Heete <hel@admin.de> * thanks to Lars Heete <hel@admin.de>
*/ */
kfree_skb(skb); kfree_skb(skb);
global.nrecvctlpkt++;
}
} }
/* ------------------------------------------------------------------- */ /* ------------------------------------------------------------------- */
...@@ -1628,7 +1614,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) ...@@ -1628,7 +1614,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
} }
capi_fill_CONNECT_REQ(&cmdcmsg, capi_fill_CONNECT_REQ(&cmdcmsg,
global.appid, global.ap.applid,
card->msgid++, card->msgid++,
card->contrnr, /* adr */ card->contrnr, /* adr */
si2cip(bchan->si1, bchan->si2), /* cipvalue */ si2cip(bchan->si1, bchan->si2), /* cipvalue */
...@@ -1674,7 +1660,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) ...@@ -1674,7 +1660,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
c->arg, bchan->l2, bchan->l3); c->arg, bchan->l2, bchan->l3);
capi_fill_CONNECT_RESP(&cmdcmsg, capi_fill_CONNECT_RESP(&cmdcmsg,
global.appid, global.ap.applid,
card->msgid++, card->msgid++,
bchan->plcip->plci, /* adr */ bchan->plcip->plci, /* adr */
0, /* Reject */ 0, /* Reject */
...@@ -1721,7 +1707,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) ...@@ -1721,7 +1707,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
if (bchan->nccip) { if (bchan->nccip) {
bchan->disconnecting = 1; bchan->disconnecting = 1;
capi_fill_DISCONNECT_B3_REQ(&cmdcmsg, capi_fill_DISCONNECT_B3_REQ(&cmdcmsg,
global.appid, global.ap.applid,
card->msgid++, card->msgid++,
bchan->nccip->ncci, bchan->nccip->ncci,
0 /* NCPI */ 0 /* NCPI */
...@@ -1742,7 +1728,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card) ...@@ -1742,7 +1728,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
} else if (bchan->plcip->plci) { } else if (bchan->plcip->plci) {
bchan->disconnecting = 1; bchan->disconnecting = 1;
capi_fill_DISCONNECT_REQ(&cmdcmsg, capi_fill_DISCONNECT_REQ(&cmdcmsg,
global.appid, global.ap.applid,
card->msgid++, card->msgid++,
bchan->plcip->plci, bchan->plcip->plci,
0, /* BChannelinformation */ 0, /* BChannelinformation */
...@@ -1889,7 +1875,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) ...@@ -1889,7 +1875,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
return 0; return 0;
} }
datahandle = nccip->datahandle; datahandle = nccip->datahandle;
capi_fill_DATA_B3_REQ(&sendcmsg, global.appid, card->msgid++, capi_fill_DATA_B3_REQ(&sendcmsg, global.ap.applid, card->msgid++,
nccip->ncci, /* adr */ nccip->ncci, /* adr */
(u32) skb->data, /* Data */ (u32) skb->data, /* Data */
skb->len, /* DataLength */ skb->len, /* DataLength */
...@@ -1913,11 +1899,10 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) ...@@ -1913,11 +1899,10 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
printk(KERN_DEBUG "capidrv-%d: only %d bytes headroom, need %d\n", printk(KERN_DEBUG "capidrv-%d: only %d bytes headroom, need %d\n",
card->contrnr, skb_headroom(skb), msglen); card->contrnr, skb_headroom(skb), msglen);
memcpy(skb_push(nskb, msglen), sendcmsg.buf, msglen); memcpy(skb_push(nskb, msglen), sendcmsg.buf, msglen);
errcode = (*capifuncs->capi_put_message) (global.appid, nskb); errcode = capi20_put_message(&global.ap, nskb);
if (errcode == CAPI_NOERROR) { if (errcode == CAPI_NOERROR) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
nccip->datahandle++; nccip->datahandle++;
global.nsentdatapkt++;
return len; return len;
} }
(void)capidrv_del_ack(nccip, datahandle); (void)capidrv_del_ack(nccip, datahandle);
...@@ -1925,10 +1910,9 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) ...@@ -1925,10 +1910,9 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
return errcode == CAPI_SENDQUEUEFULL ? 0 : -1; return errcode == CAPI_SENDQUEUEFULL ? 0 : -1;
} else { } else {
memcpy(skb_push(skb, msglen), sendcmsg.buf, msglen); memcpy(skb_push(skb, msglen), sendcmsg.buf, msglen);
errcode = (*capifuncs->capi_put_message) (global.appid, skb); errcode = capi20_put_message(&global.ap, skb);
if (errcode == CAPI_NOERROR) { if (errcode == CAPI_NOERROR) {
nccip->datahandle++; nccip->datahandle++;
global.nsentdatapkt++;
return len; return len;
} }
skb_pull(skb, msglen); skb_pull(skb, msglen);
...@@ -1969,7 +1953,7 @@ static void enable_dchannel_trace(capidrv_contr *card) ...@@ -1969,7 +1953,7 @@ static void enable_dchannel_trace(capidrv_contr *card)
u16 errcode; u16 errcode;
u16 avmversion[3]; u16 avmversion[3];
errcode = (*capifuncs->capi_get_manufacturer)(contr, manufacturer); errcode = capi20_get_manufacturer(contr, manufacturer);
if (errcode != CAPI_NOERROR) { if (errcode != CAPI_NOERROR) {
printk(KERN_ERR "%s: can't get manufacturer (0x%x)\n", printk(KERN_ERR "%s: can't get manufacturer (0x%x)\n",
card->name, errcode); card->name, errcode);
...@@ -1980,7 +1964,7 @@ static void enable_dchannel_trace(capidrv_contr *card) ...@@ -1980,7 +1964,7 @@ static void enable_dchannel_trace(capidrv_contr *card)
card->name, manufacturer); card->name, manufacturer);
return; return;
} }
errcode = (*capifuncs->capi_get_version)(contr, &version); errcode = capi20_get_version(contr, &version);
if (errcode != CAPI_NOERROR) { if (errcode != CAPI_NOERROR) {
printk(KERN_ERR "%s: can't get version (0x%x)\n", printk(KERN_ERR "%s: can't get version (0x%x)\n",
card->name, errcode); card->name, errcode);
...@@ -1993,7 +1977,7 @@ static void enable_dchannel_trace(capidrv_contr *card) ...@@ -1993,7 +1977,7 @@ static void enable_dchannel_trace(capidrv_contr *card)
if (avmversion[0] > 3 || (avmversion[0] == 3 && avmversion[1] > 5)) { if (avmversion[0] > 3 || (avmversion[0] == 3 && avmversion[1] > 5)) {
printk(KERN_INFO "%s: D2 trace enabled\n", card->name); printk(KERN_INFO "%s: D2 trace enabled\n", card->name);
capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.appid, capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.ap.applid,
card->msgid++, card->msgid++,
contr, contr,
0x214D5641, /* ManuID */ 0x214D5641, /* ManuID */
...@@ -2002,7 +1986,7 @@ static void enable_dchannel_trace(capidrv_contr *card) ...@@ -2002,7 +1986,7 @@ static void enable_dchannel_trace(capidrv_contr *card)
(_cstruct)"\004\200\014\000\000"); (_cstruct)"\004\200\014\000\000");
} else { } else {
printk(KERN_INFO "%s: D3 trace enabled\n", card->name); printk(KERN_INFO "%s: D3 trace enabled\n", card->name);
capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.appid, capi_fill_MANUFACTURER_REQ(&cmdcmsg, global.ap.applid,
card->msgid++, card->msgid++,
contr, contr,
0x214D5641, /* ManuID */ 0x214D5641, /* ManuID */
...@@ -2016,7 +2000,7 @@ static void enable_dchannel_trace(capidrv_contr *card) ...@@ -2016,7 +2000,7 @@ static void enable_dchannel_trace(capidrv_contr *card)
static void send_listen(capidrv_contr *card) static void send_listen(capidrv_contr *card)
{ {
capi_fill_LISTEN_REQ(&cmdcmsg, global.appid, capi_fill_LISTEN_REQ(&cmdcmsg, global.ap.applid,
card->msgid++, card->msgid++,
card->contrnr, /* controller */ card->contrnr, /* controller */
1 << 6, /* Infomask */ 1 << 6, /* Infomask */
...@@ -2243,10 +2227,10 @@ static int proc_capidrv_read_proc(char *page, char **start, off_t off, ...@@ -2243,10 +2227,10 @@ static int proc_capidrv_read_proc(char *page, char **start, off_t off,
int len = 0; int len = 0;
len += sprintf(page+len, "%lu %lu %lu %lu\n", len += sprintf(page+len, "%lu %lu %lu %lu\n",
global.nrecvctlpkt, global.ap.nrecvctlpkt,
global.nrecvdatapkt, global.ap.nrecvdatapkt,
global.nsentctlpkt, global.ap.nsentctlpkt,
global.nsentdatapkt); global.ap.nsentdatapkt);
if (off+count >= len) if (off+count >= len)
*eof = 1; *eof = 1;
if (len < off) if (len < off)
...@@ -2292,14 +2276,8 @@ static void __exit proc_exit(void) ...@@ -2292,14 +2276,8 @@ static void __exit proc_exit(void)
} }
} }
static struct capi_interface_user cuser = {
name: "capidrv",
callback: lower_callback
};
static int __init capidrv_init(void) static int __init capidrv_init(void)
{ {
struct capi_register_params rparam;
capi_profile profile; capi_profile profile;
char rev[32]; char rev[32];
char *p; char *p;
...@@ -2308,13 +2286,6 @@ static int __init capidrv_init(void) ...@@ -2308,13 +2286,6 @@ static int __init capidrv_init(void)
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
capifuncs = attach_capi_interface(&cuser);
if (!capifuncs) {
MOD_DEC_USE_COUNT;
return -EIO;
}
if ((p = strchr(revision, ':')) != 0 && p[1]) { if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(rev, p + 2, sizeof(rev)); strncpy(rev, p + 2, sizeof(rev));
rev[sizeof(rev)-1] = 0; rev[sizeof(rev)-1] = 0;
...@@ -2323,29 +2294,29 @@ static int __init capidrv_init(void) ...@@ -2323,29 +2294,29 @@ static int __init capidrv_init(void)
} else } else
strcpy(rev, "1.0"); strcpy(rev, "1.0");
rparam.level3cnt = -2; /* number of bchannels twice */ global.ap.rparam.level3cnt = -2; /* number of bchannels twice */
rparam.datablkcnt = 16; global.ap.rparam.datablkcnt = 16;
rparam.datablklen = 2048; global.ap.rparam.datablklen = 2048;
errcode = (*capifuncs->capi_register) (&rparam, &global.appid);
global.ap.recv_message = capidrv_recv_message;
errcode = capi20_register(&global.ap);
if (errcode) { if (errcode) {
detach_capi_interface(&cuser);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return -EIO; return -EIO;
} }
errcode = (*capifuncs->capi_get_profile) (0, &profile); capi20_set_callback(&global.ap, lower_callback);
errcode = capi20_get_profile(0, &profile);
if (errcode != CAPI_NOERROR) { if (errcode != CAPI_NOERROR) {
(void) (*capifuncs->capi_release) (global.appid); capi20_release(&global.ap);
detach_capi_interface(&cuser);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return -EIO; return -EIO;
} }
(void) (*capifuncs->capi_set_signal) (global.appid, capidrv_signal, 0);
ncontr = profile.ncontroller; ncontr = profile.ncontroller;
for (contr = 1; contr <= ncontr; contr++) { for (contr = 1; contr <= ncontr; contr++) {
errcode = (*capifuncs->capi_get_profile) (contr, &profile); errcode = capi20_get_profile(contr, &profile);
if (errcode != CAPI_NOERROR) if (errcode != CAPI_NOERROR)
continue; continue;
(void) capidrv_addcontr(contr, &profile); (void) capidrv_addcontr(contr, &profile);
...@@ -2371,9 +2342,7 @@ static void __exit capidrv_exit(void) ...@@ -2371,9 +2342,7 @@ static void __exit capidrv_exit(void)
strcpy(rev, " ??? "); strcpy(rev, " ??? ");
} }
(void) (*capifuncs->capi_release) (global.appid); capi20_release(&global.ap);
detach_capi_interface(&cuser);
proc_exit(); proc_exit();
......
...@@ -55,21 +55,6 @@ MODULE_PARM(showcapimsgs, "i"); ...@@ -55,21 +55,6 @@ MODULE_PARM(showcapimsgs, "i");
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
struct capi_appl {
u16 applid;
capi_register_params rparam;
void *param;
void (*signal) (u16 applid, void *param);
struct sk_buff_head recv_queue;
int nncci;
struct capi_ncci *nccilist;
unsigned long nrecvctlpkt;
unsigned long nrecvdatapkt;
unsigned long nsentctlpkt;
unsigned long nsentdatapkt;
};
struct capi_notifier { struct capi_notifier {
struct capi_notifier *next; struct capi_notifier *next;
unsigned int cmd; unsigned int cmd;
...@@ -86,14 +71,11 @@ static char capi_manufakturer[64] = "AVM Berlin"; ...@@ -86,14 +71,11 @@ static char capi_manufakturer[64] = "AVM Berlin";
#define NCCI2CTRL(ncci) (((ncci) >> 24) & 0x7f) #define NCCI2CTRL(ncci) (((ncci) >> 24) & 0x7f)
static struct capi_appl *applications[CAPI_MAXAPPL]; static struct capi20_appl *applications[CAPI_MAXAPPL];
static struct capi_ctr *cards[CAPI_MAXCONTR]; static struct capi_ctr *cards[CAPI_MAXCONTR];
static int ncards; static int ncards;
static struct sk_buff_head recv_queue; static struct sk_buff_head recv_queue;
static LIST_HEAD(users);
static spinlock_t users_lock = SPIN_LOCK_UNLOCKED;
static LIST_HEAD(drivers); static LIST_HEAD(drivers);
static spinlock_t drivers_lock = SPIN_LOCK_UNLOCKED; static spinlock_t drivers_lock = SPIN_LOCK_UNLOCKED;
...@@ -134,7 +116,7 @@ static inline struct capi_ctr *get_capi_ctr_by_nr(u16 contr) ...@@ -134,7 +116,7 @@ static inline struct capi_ctr *get_capi_ctr_by_nr(u16 contr)
return cards[contr - 1]; return cards[contr - 1];
} }
static inline struct capi_appl *get_capi_appl_by_nr(u16 applid) static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid)
{ {
if (applid - 1 >= CAPI_MAXAPPL) if (applid - 1 >= CAPI_MAXAPPL)
return NULL; return NULL;
...@@ -197,20 +179,18 @@ static inline int capi_subcmd_valid(u8 subcmd) ...@@ -197,20 +179,18 @@ static inline int capi_subcmd_valid(u8 subcmd)
static int proc_applications_read_proc(char *page, char **start, off_t off, static int proc_applications_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data) int count, int *eof, void *data)
{ {
struct capi_appl *ap; struct capi20_appl *ap;
int i; int i;
int len = 0; int len = 0;
for (i=1; i <= CAPI_MAXAPPL; i++) { for (i=1; i <= CAPI_MAXAPPL; i++) {
ap = get_capi_appl_by_nr(i); ap = get_capi_appl_by_nr(i);
if (!ap) continue; if (!ap) continue;
len += sprintf(page+len, "%u %d %d %d %d %d\n", len += sprintf(page+len, "%u %d %d %d\n",
ap->applid, ap->applid,
ap->rparam.level3cnt, ap->rparam.level3cnt,
ap->rparam.datablkcnt, ap->rparam.datablkcnt,
ap->rparam.datablklen, ap->rparam.datablklen);
ap->nncci,
skb_queue_len(&ap->recv_queue));
if (len <= off) { if (len <= off) {
off -= len; off -= len;
len = 0; len = 0;
...@@ -265,39 +245,6 @@ static int proc_driver_read_proc(char *page, char **start, off_t off, ...@@ -265,39 +245,6 @@ static int proc_driver_read_proc(char *page, char **start, off_t off,
return len; return len;
} }
/*
* /proc/capi/users:
* name
*/
static int proc_users_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct list_head *l;
struct capi_interface_user *cp;
int len = 0;
spin_lock(&users_lock);
list_for_each(l, &users) {
cp = list_entry(l, struct capi_interface_user, user_list);
len += sprintf(page+len, "%s\n", cp->name);
if (len <= off) {
off -= len;
len = 0;
} else {
if (len-off > count)
goto endloop;
}
}
endloop:
spin_unlock(&users_lock);
*start = page+off;
if (len < count)
*eof = 1;
if (len>count) len = count;
if (len<0) len = 0;
return len;
}
/* /*
* /proc/capi/controller: * /proc/capi/controller:
* cnr driver cardstate name driverinfo * cnr driver cardstate name driverinfo
...@@ -344,7 +291,7 @@ static int proc_controller_read_proc(char *page, char **start, off_t off, ...@@ -344,7 +291,7 @@ static int proc_controller_read_proc(char *page, char **start, off_t off,
static int proc_applstats_read_proc(char *page, char **start, off_t off, static int proc_applstats_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data) int count, int *eof, void *data)
{ {
struct capi_appl *ap; struct capi20_appl *ap;
int i; int i;
int len = 0; int len = 0;
...@@ -422,7 +369,6 @@ static struct procfsentries { ...@@ -422,7 +369,6 @@ static struct procfsentries {
{ "capi", S_IFDIR, 0 }, { "capi", S_IFDIR, 0 },
{ "capi/applications", 0 , proc_applications_read_proc }, { "capi/applications", 0 , proc_applications_read_proc },
{ "capi/driver", 0 , proc_driver_read_proc }, { "capi/driver", 0 , proc_driver_read_proc },
{ "capi/users", 0 , proc_users_read_proc },
{ "capi/controller", 0 , proc_controller_read_proc }, { "capi/controller", 0 , proc_controller_read_proc },
{ "capi/applstats", 0 , proc_applstats_read_proc }, { "capi/applstats", 0 , proc_applstats_read_proc },
{ "capi/contrstats", 0 , proc_contrstats_read_proc }, { "capi/contrstats", 0 , proc_contrstats_read_proc },
...@@ -548,35 +494,33 @@ static int notify_push(unsigned int cmd, u32 controller, ...@@ -548,35 +494,33 @@ static int notify_push(unsigned int cmd, u32 controller,
static void notify_up(u32 contr) static void notify_up(u32 contr)
{ {
struct list_head *l;
struct capi_interface_user *p;
struct capi_ctr *card = get_capi_ctr_by_nr(contr); struct capi_ctr *card = get_capi_ctr_by_nr(contr);
struct capi20_appl *ap;
u16 applid;
printk(KERN_DEBUG "kcapi: notify up contr %d\n", contr);
printk(KERN_NOTICE "kcapi: notify up contr %d\n", contr); for (applid = 1; applid <= CAPI_MAXAPPL; applid++) {
spin_lock(&users_lock); ap = get_capi_appl_by_nr(applid);
list_for_each(l, &users) { if (ap && ap->callback)
p = list_entry(l, struct capi_interface_user, user_list); ap->callback(KCI_CONTRUP, contr, &card->profile);
if (!p->callback) continue;
(*p->callback) (KCI_CONTRUP, contr, &card->profile);
} }
spin_unlock(&users_lock);
} }
/* -------- KCI_CONTRDOWN ------------------------------------- */ /* -------- KCI_CONTRDOWN ------------------------------------- */
static void notify_down(u32 contr) static void notify_down(u32 contr)
{ {
struct list_head *l; struct capi20_appl *ap;
struct capi_interface_user *p; u16 applid;
printk(KERN_DEBUG "kcapi: notify down contr %d\n", contr);
printk(KERN_NOTICE "kcapi: notify down contr %d\n", contr); for (applid = 1; applid <= CAPI_MAXAPPL; applid++) {
spin_lock(&users_lock); ap = get_capi_appl_by_nr(applid);
list_for_each(l, &users) { if (ap && ap->callback)
p = list_entry(l, struct capi_interface_user, user_list); ap->callback(KCI_CONTRDOWN, contr, 0);
if (!p->callback) continue;
(*p->callback) (KCI_CONTRDOWN, contr, 0);
} }
spin_unlock(&users_lock);
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
...@@ -610,7 +554,7 @@ static void notify_handler(void *dummy) ...@@ -610,7 +554,7 @@ static void notify_handler(void *dummy)
static void recv_handler(void *dummy) static void recv_handler(void *dummy)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct capi_appl *ap; struct capi20_appl *ap;
while ((skb = skb_dequeue(&recv_queue)) != 0) { while ((skb = skb_dequeue(&recv_queue)) != 0) {
ap = get_capi_appl_by_nr(CAPIMSG_APPID(skb->data)); ap = get_capi_appl_by_nr(CAPIMSG_APPID(skb->data));
...@@ -620,20 +564,14 @@ static void recv_handler(void *dummy) ...@@ -620,20 +564,14 @@ static void recv_handler(void *dummy)
kfree_skb(skb); kfree_skb(skb);
continue; continue;
} }
if (ap->signal == 0) {
printk(KERN_ERR "kcapi: recv_handler: applid %d has no signal function\n",
ap->applid);
kfree_skb(skb);
continue;
}
if ( CAPIMSG_COMMAND(skb->data) == CAPI_DATA_B3 if ( CAPIMSG_COMMAND(skb->data) == CAPI_DATA_B3
&& CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) { && CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) {
ap->nrecvdatapkt++; ap->nrecvdatapkt++;
} else { } else {
ap->nrecvctlpkt++; ap->nrecvctlpkt++;
} }
skb_queue_tail(&ap->recv_queue, skb); ap->recv_message(ap, skb);
(ap->signal) (ap->applid, ap->param);
} }
} }
...@@ -684,7 +622,7 @@ static void controllercb_handle_capimsg(struct capi_ctr * card, ...@@ -684,7 +622,7 @@ static void controllercb_handle_capimsg(struct capi_ctr * card,
static void controllercb_ready(struct capi_ctr * card) static void controllercb_ready(struct capi_ctr * card)
{ {
u16 appl; u16 appl;
struct capi_appl *ap; struct capi20_appl *ap;
card->cardstate = CARD_RUNNING; card->cardstate = CARD_RUNNING;
...@@ -717,7 +655,7 @@ static void controllercb_reseted(struct capi_ctr * card) ...@@ -717,7 +655,7 @@ static void controllercb_reseted(struct capi_ctr * card)
memset(card->serial, 0, sizeof(card->serial)); memset(card->serial, 0, sizeof(card->serial));
for (appl = 1; appl <= CAPI_MAXAPPL; appl++) { for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
struct capi_appl *ap = get_capi_appl_by_nr(appl); struct capi20_appl *ap = get_capi_appl_by_nr(appl);
if (!ap) if (!ap)
continue; continue;
...@@ -892,7 +830,7 @@ EXPORT_SYMBOL(detach_capi_driver); ...@@ -892,7 +830,7 @@ EXPORT_SYMBOL(detach_capi_driver);
/* -------- CAPI2.0 Interface ---------------------------------- */ /* -------- CAPI2.0 Interface ---------------------------------- */
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static u16 capi_isinstalled(void) u16 capi20_isinstalled(void)
{ {
int i; int i;
for (i = 0; i < CAPI_MAXCONTR; i++) { for (i = 0; i < CAPI_MAXCONTR; i++) {
...@@ -902,84 +840,76 @@ static u16 capi_isinstalled(void) ...@@ -902,84 +840,76 @@ static u16 capi_isinstalled(void)
return CAPI_REGNOTINSTALLED; return CAPI_REGNOTINSTALLED;
} }
static u16 capi_register(capi_register_params * rparam, u16 * applidp) EXPORT_SYMBOL(capi20_isinstalled);
u16 capi20_register(struct capi20_appl *ap)
{ {
struct capi_appl *ap;
int appl;
int i; int i;
u16 applid;
DBG(""); DBG("");
if (rparam->datablklen < 128) if (ap->rparam.datablklen < 128)
return CAPI_LOGBLKSIZETOSMALL; return CAPI_LOGBLKSIZETOSMALL;
for (appl = 1; appl <= CAPI_MAXAPPL; appl++) { for (applid = 1; applid <= CAPI_MAXAPPL; applid++) {
if (applications[appl - 1] == NULL) if (applications[applid - 1] == NULL)
break; break;
} }
if (appl > CAPI_MAXAPPL) if (applid > CAPI_MAXAPPL)
return CAPI_TOOMANYAPPLS; return CAPI_TOOMANYAPPLS;
ap = kmalloc(sizeof(*ap), GFP_KERNEL); ap->applid = applid;
if (!ap) applications[applid - 1] = ap;
return CAPI_REGOSRESOURCEERR;
memset(ap, 0, sizeof(*ap));
ap->applid = appl;
applications[appl - 1] = ap;
skb_queue_head_init(&ap->recv_queue);
ap->nncci = 0;
memcpy(&ap->rparam, rparam, sizeof(capi_register_params)); ap->nrecvctlpkt = 0;
ap->nrecvdatapkt = 0;
ap->nsentctlpkt = 0;
ap->nsentdatapkt = 0;
ap->callback = 0;
for (i = 0; i < CAPI_MAXCONTR; i++) { for (i = 0; i < CAPI_MAXCONTR; i++) {
if (!cards[i] || cards[i]->cardstate != CARD_RUNNING) if (!cards[i] || cards[i]->cardstate != CARD_RUNNING)
continue; continue;
register_appl(cards[i], appl, &ap->rparam); register_appl(cards[i], applid, &ap->rparam);
} }
*applidp = appl; printk(KERN_DEBUG "kcapi: appl %d up\n", applid);
printk(KERN_INFO "kcapi: appl %d up\n", appl);
return CAPI_NOERROR; return CAPI_NOERROR;
} }
static u16 capi_release(u16 applid) EXPORT_SYMBOL(capi20_register);
u16 capi20_release(struct capi20_appl *ap)
{ {
struct capi_appl *ap = get_capi_appl_by_nr(applid);
int i; int i;
DBG("applid %#x", applid); DBG("applid %#x", ap->applid);
if (!ap)
return CAPI_ILLAPPNR;
skb_queue_purge(&ap->recv_queue);
for (i = 0; i < CAPI_MAXCONTR; i++) { for (i = 0; i < CAPI_MAXCONTR; i++) {
if (!cards[i] || cards[i]->cardstate != CARD_RUNNING) if (!cards[i] || cards[i]->cardstate != CARD_RUNNING)
continue; continue;
release_appl(cards[i], applid); release_appl(cards[i], ap->applid);
} }
applications[applid - 1] = NULL; applications[ap->applid - 1] = NULL;
kfree(ap); printk(KERN_DEBUG "kcapi: appl %d down\n", ap->applid);
printk(KERN_INFO "kcapi: appl %d down\n", applid);
return CAPI_NOERROR; return CAPI_NOERROR;
} }
static u16 capi_put_message(u16 applid, struct sk_buff *skb) EXPORT_SYMBOL(capi20_release);
u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
{ {
struct capi_ctr *card; struct capi_ctr *card;
struct capi_appl *ap;
int showctl = 0; int showctl = 0;
u8 cmd, subcmd; u8 cmd, subcmd;
DBG("applid %#x", applid); DBG("applid %#x", ap->applid);
if (ncards == 0) if (ncards == 0)
return CAPI_REGNOTINSTALLED; return CAPI_REGNOTINSTALLED;
ap = get_capi_appl_by_nr(applid); if (ap->applid == 0)
if (!ap)
return CAPI_ILLAPPNR; return CAPI_ILLAPPNR;
if (skb->len < 12 if (skb->len < 12
|| !capi_cmd_valid(CAPIMSG_COMMAND(skb->data)) || !capi_cmd_valid(CAPIMSG_COMMAND(skb->data))
...@@ -1024,33 +954,9 @@ static u16 capi_put_message(u16 applid, struct sk_buff *skb) ...@@ -1024,33 +954,9 @@ static u16 capi_put_message(u16 applid, struct sk_buff *skb)
return card->driver->send_message(card, skb); return card->driver->send_message(card, skb);
} }
static u16 capi_get_message(u16 applid, struct sk_buff **msgp) EXPORT_SYMBOL(capi20_put_message);
{
struct capi_appl *ap = get_capi_appl_by_nr(applid);
struct sk_buff *skb;
if (!ap)
return CAPI_ILLAPPNR;
if ((skb = skb_dequeue(&ap->recv_queue)) == 0)
return CAPI_RECEIVEQUEUEEMPTY;
*msgp = skb;
return CAPI_NOERROR;
}
static u16 capi_set_signal(u16 applid,
void (*signal) (u16 applid, void *param),
void *param)
{
struct capi_appl *ap = get_capi_appl_by_nr(applid);
if (!ap)
return CAPI_ILLAPPNR;
ap->signal = signal;
ap->param = param;
return CAPI_NOERROR;
}
static u16 capi_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]) u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN])
{ {
struct capi_ctr *card; struct capi_ctr *card;
...@@ -1066,7 +972,9 @@ static u16 capi_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]) ...@@ -1066,7 +972,9 @@ static u16 capi_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN])
return CAPI_NOERROR; return CAPI_NOERROR;
} }
static u16 capi_get_version(u32 contr, struct capi_version *verp) EXPORT_SYMBOL(capi20_get_manufacturer);
u16 capi20_get_version(u32 contr, struct capi_version *verp)
{ {
struct capi_ctr *card; struct capi_ctr *card;
...@@ -1082,7 +990,9 @@ static u16 capi_get_version(u32 contr, struct capi_version *verp) ...@@ -1082,7 +990,9 @@ static u16 capi_get_version(u32 contr, struct capi_version *verp)
return CAPI_NOERROR; return CAPI_NOERROR;
} }
static u16 capi_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]) EXPORT_SYMBOL(capi20_get_version);
u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN])
{ {
struct capi_ctr *card; struct capi_ctr *card;
...@@ -1098,7 +1008,9 @@ static u16 capi_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]) ...@@ -1098,7 +1008,9 @@ static u16 capi_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN])
return CAPI_NOERROR; return CAPI_NOERROR;
} }
static u16 capi_get_profile(u32 contr, struct capi_profile *profp) EXPORT_SYMBOL(capi20_get_serial);
u16 capi20_get_profile(u32 contr, struct capi_profile *profp)
{ {
struct capi_ctr *card; struct capi_ctr *card;
...@@ -1115,6 +1027,8 @@ static u16 capi_get_profile(u32 contr, struct capi_profile *profp) ...@@ -1115,6 +1027,8 @@ static u16 capi_get_profile(u32 contr, struct capi_profile *profp)
return CAPI_NOERROR; return CAPI_NOERROR;
} }
EXPORT_SYMBOL(capi20_get_profile);
static struct capi_driver *find_driver(char *name) static struct capi_driver *find_driver(char *name)
{ {
struct list_head *l; struct list_head *l;
...@@ -1255,7 +1169,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data) ...@@ -1255,7 +1169,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
} }
#endif #endif
static int capi_manufacturer(unsigned int cmd, void *data) int capi20_manufacturer(unsigned int cmd, void *data)
{ {
struct capi_ctr *card; struct capi_ctr *card;
int retval; int retval;
...@@ -1296,47 +1210,16 @@ static int capi_manufacturer(unsigned int cmd, void *data) ...@@ -1296,47 +1210,16 @@ static int capi_manufacturer(unsigned int cmd, void *data)
return -EINVAL; return -EINVAL;
} }
struct capi_interface avmb1_interface = EXPORT_SYMBOL(capi20_manufacturer);
{
capi_isinstalled,
capi_register,
capi_release,
capi_put_message,
capi_get_message,
capi_set_signal,
capi_get_manufacturer,
capi_get_version,
capi_get_serial,
capi_get_profile,
capi_manufacturer
};
/* ------------------------------------------------------------- */ /* temporary hack */
/* -------- Exported Functions --------------------------------- */ void capi20_set_callback(struct capi20_appl *ap,
/* ------------------------------------------------------------- */ void (*callback) (unsigned int cmd, __u32 contr, void *data))
struct capi_interface *attach_capi_interface(struct capi_interface_user *userp)
{
spin_lock(&users_lock);
list_add_tail(&userp->user_list, &users);
spin_unlock(&users_lock);
printk(KERN_NOTICE "kcapi: %s attached\n", userp->name);
return &avmb1_interface;
}
EXPORT_SYMBOL(attach_capi_interface);
int detach_capi_interface(struct capi_interface_user *userp)
{ {
spin_lock(&users_lock); ap->callback = callback;
list_del(&userp->user_list);
printk(KERN_NOTICE "kcapi: %s detached\n", userp->name);
return 0;
} }
EXPORT_SYMBOL(detach_capi_interface); EXPORT_SYMBOL(capi20_set_callback);
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* -------- Init & Cleanup ------------------------------------- */ /* -------- Init & Cleanup ------------------------------------- */
......
...@@ -178,8 +178,6 @@ static int __init b1isa_init(void) ...@@ -178,8 +178,6 @@ static int __init b1isa_init(void)
int i, retval; int i, retval;
int found = 0; int found = 0;
MOD_INC_USE_COUNT;
b1_set_revision(&b1isa_driver, revision); b1_set_revision(&b1isa_driver, revision);
attach_capi_driver(&b1isa_driver); attach_capi_driver(&b1isa_driver);
...@@ -203,7 +201,6 @@ static int __init b1isa_init(void) ...@@ -203,7 +201,6 @@ static int __init b1isa_init(void)
err: err:
detach_capi_driver(&b1isa_driver); detach_capi_driver(&b1isa_driver);
out: out:
MOD_DEC_USE_COUNT;
return retval; return retval;
} }
......
...@@ -397,8 +397,6 @@ static int __init b1pci_init(void) ...@@ -397,8 +397,6 @@ static int __init b1pci_init(void)
{ {
int retval; int retval;
MOD_INC_USE_COUNT;
b1_set_revision(&b1pci_driver, revision); b1_set_revision(&b1pci_driver, revision);
attach_capi_driver(&b1pci_driver); attach_capi_driver(&b1pci_driver);
...@@ -422,7 +420,6 @@ static int __init b1pci_init(void) ...@@ -422,7 +420,6 @@ static int __init b1pci_init(void)
detach_capi_driver(&b1pciv4_driver); detach_capi_driver(&b1pciv4_driver);
#endif #endif
out: out:
MOD_DEC_USE_COUNT;
return retval; return retval;
} }
......
...@@ -200,12 +200,9 @@ EXPORT_SYMBOL(b1pcmcia_delcard); ...@@ -200,12 +200,9 @@ EXPORT_SYMBOL(b1pcmcia_delcard);
static int __init b1pcmcia_init(void) static int __init b1pcmcia_init(void)
{ {
MOD_INC_USE_COUNT;
b1_set_revision(&b1pcmcia_driver, revision); b1_set_revision(&b1pcmcia_driver, revision);
attach_capi_driver(&b1pcmcia_driver); attach_capi_driver(&b1pcmcia_driver);
MOD_DEC_USE_COUNT;
return 0; return 0;
} }
......
...@@ -1282,8 +1282,6 @@ static int __init c4_init(void) ...@@ -1282,8 +1282,6 @@ static int __init c4_init(void)
{ {
int retval; int retval;
MOD_INC_USE_COUNT;
b1_set_revision(&c2_driver, revision); b1_set_revision(&c2_driver, revision);
attach_capi_driver(&c2_driver); attach_capi_driver(&c2_driver);
...@@ -1304,7 +1302,6 @@ static int __init c4_init(void) ...@@ -1304,7 +1302,6 @@ static int __init c4_init(void)
detach_capi_driver(&c2_driver); detach_capi_driver(&c2_driver);
detach_capi_driver(&c4_driver); detach_capi_driver(&c4_driver);
out: out:
MOD_DEC_USE_COUNT;
return retval; return retval;
} }
......
...@@ -345,12 +345,11 @@ static void t1isa_remove(struct pci_dev *pdev) ...@@ -345,12 +345,11 @@ static void t1isa_remove(struct pci_dev *pdev)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static int __init t1isa_probe(struct pci_dev *pdev) static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
{ {
avmctrl_info *cinfo; avmctrl_info *cinfo;
avmcard *card; avmcard *card;
int retval; int retval;
static int cardnr = 1;
card = b1_alloc_card(1); card = b1_alloc_card(1);
if (!card) { if (!card) {
...@@ -363,7 +362,7 @@ static int __init t1isa_probe(struct pci_dev *pdev) ...@@ -363,7 +362,7 @@ static int __init t1isa_probe(struct pci_dev *pdev)
card->port = pci_resource_start(pdev, 0); card->port = pci_resource_start(pdev, 0);
card->irq = pdev->irq; card->irq = pdev->irq;
card->cardtype = avm_t1isa; card->cardtype = avm_t1isa;
card->cardnr = cardnr++; card->cardnr = cardnr;
sprintf(card->name, "t1isa-%x", card->port); sprintf(card->name, "t1isa-%x", card->port);
if (!(((card->port & 0x7) == 0) && ((card->port & 0x30) != 0x30))) { if (!(((card->port & 0x7) == 0) && ((card->port & 0x30) != 0x30))) {
...@@ -505,19 +504,20 @@ static struct capi_driver t1isa_driver = { ...@@ -505,19 +504,20 @@ static struct capi_driver t1isa_driver = {
static struct pci_dev isa_dev[MAX_CARDS]; static struct pci_dev isa_dev[MAX_CARDS];
static int io[MAX_CARDS]; static int io[MAX_CARDS];
static int irq[MAX_CARDS]; static int irq[MAX_CARDS];
static int cardnr[MAX_CARDS];
MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i"); MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM(cardnr, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM_DESC(io, "I/O base address(es)"); MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)");
static int __init t1isa_init(void) static int __init t1isa_init(void)
{ {
int i, retval; int i, retval;
int found = 0; int found = 0;
MOD_INC_USE_COUNT;
b1_set_revision(&t1isa_driver, revision); b1_set_revision(&t1isa_driver, revision);
attach_capi_driver(&t1isa_driver); attach_capi_driver(&t1isa_driver);
...@@ -528,7 +528,7 @@ static int __init t1isa_init(void) ...@@ -528,7 +528,7 @@ static int __init t1isa_init(void)
isa_dev[i].resource[0].start = io[i]; isa_dev[i].resource[0].start = io[i];
isa_dev[i].irq_resource[0].start = irq[i]; isa_dev[i].irq_resource[0].start = irq[i];
if (t1isa_probe(&isa_dev[i]) == 0) if (t1isa_probe(&isa_dev[i], cardnr[i]) == 0)
found++; found++;
} }
if (found == 0) { if (found == 0) {
...@@ -541,7 +541,6 @@ static int __init t1isa_init(void) ...@@ -541,7 +541,6 @@ static int __init t1isa_init(void)
err: err:
detach_capi_driver(&t1isa_driver); detach_capi_driver(&t1isa_driver);
out: out:
MOD_DEC_USE_COUNT;
return retval; return retval;
} }
......
...@@ -239,8 +239,6 @@ static int __init t1pci_init(void) ...@@ -239,8 +239,6 @@ static int __init t1pci_init(void)
{ {
int retval; int retval;
MOD_INC_USE_COUNT;
b1_set_revision(&t1pci_driver, revision); b1_set_revision(&t1pci_driver, revision);
attach_capi_driver(&t1pci_driver); attach_capi_driver(&t1pci_driver);
...@@ -256,7 +254,6 @@ static int __init t1pci_init(void) ...@@ -256,7 +254,6 @@ static int __init t1pci_init(void)
err: err:
detach_capi_driver(&t1pci_driver); detach_capi_driver(&t1pci_driver);
out: out:
MOD_DEC_USE_COUNT;
return retval; return retval;
} }
......
...@@ -49,40 +49,41 @@ typedef struct kcapi_carddef { ...@@ -49,40 +49,41 @@ typedef struct kcapi_carddef {
#include <linux/skbuff.h> #include <linux/skbuff.h>
struct capi_interface { #define KCI_CONTRUP 0 /* arg: struct capi_profile */
__u16 (*capi_isinstalled) (void); #define KCI_CONTRDOWN 1 /* arg: NULL */
__u16 (*capi_register) (capi_register_params * rparam, __u16 * applidp); struct capi20_appl {
__u16 (*capi_release) (__u16 applid); u16 applid;
__u16 (*capi_put_message) (__u16 applid, struct sk_buff * msg); capi_register_params rparam;
__u16 (*capi_get_message) (__u16 applid, struct sk_buff ** msgp); void (*recv_message)(struct capi20_appl *ap, struct sk_buff *skb);
__u16 (*capi_set_signal) (__u16 applid, void *private;
void (*signal) (__u16 applid, void *param),
void *param); /* internal to kernelcapi.o */
__u16 (*capi_get_manufacturer) (__u32 contr, __u8 buf[CAPI_MANUFACTURER_LEN]); unsigned long nrecvctlpkt;
__u16 (*capi_get_version) (__u32 contr, struct capi_version * verp); unsigned long nrecvdatapkt;
__u16(*capi_get_serial) (__u32 contr, __u8 serial[CAPI_SERIAL_LEN]); unsigned long nsentctlpkt;
__u16(*capi_get_profile) (__u32 contr, struct capi_profile * profp); unsigned long nsentdatapkt;
/* /* ugly hack to allow for notification of added/removed
* to init controllers, data is always in user memory * controllers. The Right Way (tm) is known. XXX
*/ */
int (*capi_manufacturer) (unsigned int cmd, void *data); void (*callback) (unsigned int cmd, __u32 contr, void *data);
}; };
#define KCI_CONTRUP 0 /* struct capi_profile */ u16 capi20_isinstalled(void);
#define KCI_CONTRDOWN 1 /* NULL */ u16 capi20_register(struct capi20_appl *ap);
u16 capi20_release(struct capi20_appl *ap);
u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb);
u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
u16 capi20_get_version(u32 contr, struct capi_version *verp);
u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
int capi20_manufacturer(unsigned int cmd, void *data);
struct capi_interface_user { /* temporary hack XXX */
char name[20]; void capi20_set_callback(struct capi20_appl *ap,
void (*callback) (unsigned int cmd, __u32 contr, void *data); void (*callback) (unsigned int cmd, __u32 contr, void *data));
/* internal */
struct list_head user_list;
};
struct capi_interface *attach_capi_interface(struct capi_interface_user *);
int detach_capi_interface(struct capi_interface_user *);
#define CAPI_NOERROR 0x0000 #define CAPI_NOERROR 0x0000
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment