Commit c5933354 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Export CAPI user interface directly

Why pass the callbacks via a struct when we can just call them directly?
parent 8c8147cd
...@@ -139,8 +139,6 @@ struct capidev { ...@@ -139,8 +139,6 @@ struct capidev {
/* -------- 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);
...@@ -402,7 +400,7 @@ static void capidev_free(struct capidev *cdev) ...@@ -402,7 +400,7 @@ static void capidev_free(struct capidev *cdev)
unsigned long flags; unsigned long flags;
if (cdev->applid) if (cdev->applid)
(*capifuncs->capi_release) (cdev->applid); capi20_release(cdev->applid); // XXX
cdev->applid = 0; cdev->applid = 0;
skb_queue_purge(&cdev->recvqueue); skb_queue_purge(&cdev->recvqueue);
...@@ -465,7 +463,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb) ...@@ -465,7 +463,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->applid, 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);
...@@ -538,7 +536,7 @@ static int handle_minor_send(struct capiminor *mp) ...@@ -538,7 +536,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->applid, skb);
if (errcode == CAPI_NOERROR) { if (errcode == CAPI_NOERROR) {
mp->datahandle++; mp->datahandle++;
count++; count++;
...@@ -579,7 +577,7 @@ static void capi_signal(u16 applid, void *param) ...@@ -579,7 +577,7 @@ static void capi_signal(u16 applid, void *param)
struct sk_buff *skb = 0; struct sk_buff *skb = 0;
u32 ncci; u32 ncci;
(void) (*capifuncs->capi_get_message) (applid, &skb); capi20_get_message(applid, &skb);
if (!skb) { if (!skb) {
printk(KERN_ERR "BUG: capi_signal: no skb\n"); printk(KERN_ERR "BUG: capi_signal: no skb\n");
return; return;
...@@ -749,7 +747,7 @@ capi_write(struct file *file, const char *buf, size_t count, loff_t *ppos) ...@@ -749,7 +747,7 @@ capi_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
} }
cdev->errcode = (*capifuncs->capi_put_message) (cdev->applid, skb); cdev->errcode = capi20_put_message(cdev->applid, skb);
if (cdev->errcode) { if (cdev->errcode) {
kfree_skb(skb); kfree_skb(skb);
...@@ -796,13 +794,13 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -796,13 +794,13 @@ capi_ioctl(struct inode *inode, struct file *file,
return -EFAULT; return -EFAULT;
if (cdev->applid) if (cdev->applid)
return -EEXIST; return -EEXIST;
cdev->errcode = (*capifuncs->capi_register) (&data.rparams, cdev->errcode = capi20_register(&data.rparams,
&cdev->applid); &cdev->applid);
if (cdev->errcode) { if (cdev->errcode) {
cdev->applid = 0; cdev->applid = 0;
return -EIO; return -EIO;
} }
(void) (*capifuncs->capi_set_signal) (cdev->applid, capi_signal, cdev); capi20_set_signal(cdev->applid, capi_signal, cdev);
} }
return (int)cdev->applid; return (int)cdev->applid;
...@@ -813,7 +811,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -813,7 +811,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 +829,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -831,7 +829,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 +848,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -850,7 +848,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 +857,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -859,7 +857,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 +877,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -879,7 +877,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 +901,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -903,7 +901,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 +914,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -916,7 +914,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;
...@@ -1628,15 +1626,7 @@ static int __init capi_init(void) ...@@ -1628,15 +1626,7 @@ 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) { attach_capi_interface(&cuser);
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) {
......
...@@ -146,7 +146,6 @@ typedef struct capidrv_bchan capidrv_bchan; ...@@ -146,7 +146,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,7 +518,7 @@ static void send_message(capidrv_contr * card, _cmsg * cmsg) ...@@ -519,7 +518,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.appid, skb);
global.nsentctlpkt++; global.nsentctlpkt++;
} }
...@@ -1377,7 +1376,7 @@ static void capidrv_signal(u16 applid, void *dummy) ...@@ -1377,7 +1376,7 @@ static void capidrv_signal(u16 applid, void *dummy)
{ {
struct sk_buff *skb = 0; struct sk_buff *skb = 0;
while ((*capifuncs->capi_get_message) (global.appid, &skb) == CAPI_NOERROR) { while (capi20_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",
...@@ -1913,7 +1912,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) ...@@ -1913,7 +1912,7 @@ 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.appid, nskb);
if (errcode == CAPI_NOERROR) { if (errcode == CAPI_NOERROR) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
nccip->datahandle++; nccip->datahandle++;
...@@ -1925,7 +1924,7 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb) ...@@ -1925,7 +1924,7 @@ 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.appid, skb);
if (errcode == CAPI_NOERROR) { if (errcode == CAPI_NOERROR) {
nccip->datahandle++; nccip->datahandle++;
global.nsentdatapkt++; global.nsentdatapkt++;
...@@ -1969,7 +1968,7 @@ static void enable_dchannel_trace(capidrv_contr *card) ...@@ -1969,7 +1968,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 +1979,7 @@ static void enable_dchannel_trace(capidrv_contr *card) ...@@ -1980,7 +1979,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);
...@@ -2308,12 +2307,7 @@ static int __init capidrv_init(void) ...@@ -2308,12 +2307,7 @@ static int __init capidrv_init(void)
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
capifuncs = attach_capi_interface(&cuser); 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));
...@@ -2326,26 +2320,26 @@ static int __init capidrv_init(void) ...@@ -2326,26 +2320,26 @@ static int __init capidrv_init(void)
rparam.level3cnt = -2; /* number of bchannels twice */ rparam.level3cnt = -2; /* number of bchannels twice */
rparam.datablkcnt = 16; rparam.datablkcnt = 16;
rparam.datablklen = 2048; rparam.datablklen = 2048;
errcode = (*capifuncs->capi_register) (&rparam, &global.appid); errcode = capi20_register(&rparam, &global.appid);
if (errcode) { if (errcode) {
detach_capi_interface(&cuser); detach_capi_interface(&cuser);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return -EIO; return -EIO;
} }
errcode = (*capifuncs->capi_get_profile) (0, &profile); errcode = capi20_get_profile(0, &profile);
if (errcode != CAPI_NOERROR) { if (errcode != CAPI_NOERROR) {
(void) (*capifuncs->capi_release) (global.appid); capi20_release(global.appid);
detach_capi_interface(&cuser); 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); capi20_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,7 +2365,7 @@ static void __exit capidrv_exit(void) ...@@ -2371,7 +2365,7 @@ static void __exit capidrv_exit(void)
strcpy(rev, " ??? "); strcpy(rev, " ??? ");
} }
(void) (*capifuncs->capi_release) (global.appid); capi20_release(global.appid);
detach_capi_interface(&cuser); detach_capi_interface(&cuser);
......
...@@ -892,7 +892,7 @@ EXPORT_SYMBOL(detach_capi_driver); ...@@ -892,7 +892,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,7 +902,9 @@ static u16 capi_isinstalled(void) ...@@ -902,7 +902,9 @@ 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(capi_register_params * rparam, u16 * applidp)
{ {
struct capi_appl *ap; struct capi_appl *ap;
int appl; int appl;
...@@ -944,7 +946,9 @@ static u16 capi_register(capi_register_params * rparam, u16 * applidp) ...@@ -944,7 +946,9 @@ static u16 capi_register(capi_register_params * rparam, u16 * applidp)
return CAPI_NOERROR; return CAPI_NOERROR;
} }
static u16 capi_release(u16 applid) EXPORT_SYMBOL(capi20_register);
u16 capi20_release(u16 applid)
{ {
struct capi_appl *ap = get_capi_appl_by_nr(applid); struct capi_appl *ap = get_capi_appl_by_nr(applid);
int i; int i;
...@@ -967,7 +971,9 @@ static u16 capi_release(u16 applid) ...@@ -967,7 +971,9 @@ static u16 capi_release(u16 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(u16 applid, struct sk_buff *skb)
{ {
struct capi_ctr *card; struct capi_ctr *card;
struct capi_appl *ap; struct capi_appl *ap;
...@@ -1024,7 +1030,9 @@ static u16 capi_put_message(u16 applid, struct sk_buff *skb) ...@@ -1024,7 +1030,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);
u16 capi20_get_message(u16 applid, struct sk_buff **msgp)
{ {
struct capi_appl *ap = get_capi_appl_by_nr(applid); struct capi_appl *ap = get_capi_appl_by_nr(applid);
struct sk_buff *skb; struct sk_buff *skb;
...@@ -1037,7 +1045,9 @@ static u16 capi_get_message(u16 applid, struct sk_buff **msgp) ...@@ -1037,7 +1045,9 @@ static u16 capi_get_message(u16 applid, struct sk_buff **msgp)
return CAPI_NOERROR; return CAPI_NOERROR;
} }
static u16 capi_set_signal(u16 applid, EXPORT_SYMBOL(capi20_get_message);
u16 capi20_set_signal(u16 applid,
void (*signal) (u16 applid, void *param), void (*signal) (u16 applid, void *param),
void *param) void *param)
{ {
...@@ -1050,7 +1060,9 @@ static u16 capi_set_signal(u16 applid, ...@@ -1050,7 +1060,9 @@ static u16 capi_set_signal(u16 applid,
return CAPI_NOERROR; return CAPI_NOERROR;
} }
static u16 capi_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]) EXPORT_SYMBOL(capi20_set_signal);
u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN])
{ {
struct capi_ctr *card; struct capi_ctr *card;
...@@ -1066,7 +1078,9 @@ static u16 capi_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]) ...@@ -1066,7 +1078,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 +1096,9 @@ static u16 capi_get_version(u32 contr, struct capi_version *verp) ...@@ -1082,7 +1096,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 +1114,9 @@ static u16 capi_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]) ...@@ -1098,7 +1114,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 +1133,8 @@ static u16 capi_get_profile(u32 contr, struct capi_profile *profp) ...@@ -1115,6 +1133,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 +1275,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data) ...@@ -1255,7 +1275,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,44 +1316,29 @@ static int capi_manufacturer(unsigned int cmd, void *data) ...@@ -1296,44 +1316,29 @@ 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
};
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* -------- Exported Functions --------------------------------- */ /* -------- Exported Functions --------------------------------- */
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
struct capi_interface *attach_capi_interface(struct capi_interface_user *userp) void attach_capi_interface(struct capi_interface_user *userp)
{ {
spin_lock(&users_lock); spin_lock(&users_lock);
list_add_tail(&userp->user_list, &users); list_add_tail(&userp->user_list, &users);
spin_unlock(&users_lock); spin_unlock(&users_lock);
printk(KERN_NOTICE "kcapi: %s attached\n", userp->name); printk(KERN_NOTICE "kcapi: %s attached\n", userp->name);
return &avmb1_interface;
} }
EXPORT_SYMBOL(attach_capi_interface); EXPORT_SYMBOL(attach_capi_interface);
int detach_capi_interface(struct capi_interface_user *userp) void detach_capi_interface(struct capi_interface_user *userp)
{ {
spin_lock(&users_lock); spin_lock(&users_lock);
list_del(&userp->user_list); list_del(&userp->user_list);
spin_unlock(&users_lock);
printk(KERN_NOTICE "kcapi: %s detached\n", userp->name); printk(KERN_NOTICE "kcapi: %s detached\n", userp->name);
return 0;
} }
EXPORT_SYMBOL(detach_capi_interface); EXPORT_SYMBOL(detach_capi_interface);
......
...@@ -49,28 +49,6 @@ typedef struct kcapi_carddef { ...@@ -49,28 +49,6 @@ typedef struct kcapi_carddef {
#include <linux/skbuff.h> #include <linux/skbuff.h>
struct capi_interface {
__u16 (*capi_isinstalled) (void);
__u16 (*capi_register) (capi_register_params * rparam, __u16 * applidp);
__u16 (*capi_release) (__u16 applid);
__u16 (*capi_put_message) (__u16 applid, struct sk_buff * msg);
__u16 (*capi_get_message) (__u16 applid, struct sk_buff ** msgp);
__u16 (*capi_set_signal) (__u16 applid,
void (*signal) (__u16 applid, void *param),
void *param);
__u16 (*capi_get_manufacturer) (__u32 contr, __u8 buf[CAPI_MANUFACTURER_LEN]);
__u16 (*capi_get_version) (__u32 contr, struct capi_version * verp);
__u16(*capi_get_serial) (__u32 contr, __u8 serial[CAPI_SERIAL_LEN]);
__u16(*capi_get_profile) (__u32 contr, struct capi_profile * profp);
/*
* to init controllers, data is always in user memory
*/
int (*capi_manufacturer) (unsigned int cmd, void *data);
};
#define KCI_CONTRUP 0 /* struct capi_profile */ #define KCI_CONTRUP 0 /* struct capi_profile */
#define KCI_CONTRDOWN 1 /* NULL */ #define KCI_CONTRDOWN 1 /* NULL */
...@@ -81,9 +59,22 @@ struct capi_interface_user { ...@@ -81,9 +59,22 @@ struct capi_interface_user {
struct list_head user_list; struct list_head user_list;
}; };
struct capi_interface *attach_capi_interface(struct capi_interface_user *); void attach_capi_interface(struct capi_interface_user *);
int detach_capi_interface(struct capi_interface_user *); void detach_capi_interface(struct capi_interface_user *);
u16 capi20_isinstalled(void);
u16 capi20_register(capi_register_params * rparam, u16 * applidp);
u16 capi20_release(u16 applid);
u16 capi20_put_message(u16 applid, struct sk_buff *skb);
u16 capi20_get_message(u16 applid, struct sk_buff **msgp);
u16 capi20_set_signal(u16 applid,
void (*signal) (u16 applid, void *param),
void *param);
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);
#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