Commit c0734386 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: CAPI use struct capi20_appl * in signal callback

Instead of passing an opaque handle, pass the actual struct capi20_appl,
which is now known to the applications. Applications can store
a pointer to the private data into struct capi20_appl::private.
parent 1d1a9e39
...@@ -566,9 +566,9 @@ static int handle_minor_send(struct capiminor *mp) ...@@ -566,9 +566,9 @@ 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_signal(struct capi20_appl *ap)
{ {
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;
...@@ -794,12 +794,13 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -794,12 +794,13 @@ capi_ioctl(struct inode *inode, struct file *file,
sizeof(struct capi_register_params))) sizeof(struct capi_register_params)))
return -EFAULT; return -EFAULT;
cdev->ap.private = cdev;
cdev->errcode = capi20_register(ap); cdev->errcode = capi20_register(ap);
if (cdev->errcode) { if (cdev->errcode) {
ap->applid = 0; ap->applid = 0;
return -EIO; return -EIO;
} }
capi20_set_signal(ap, capi_signal, cdev); capi20_set_signal(ap, capi_signal);
} }
return (int)ap->applid; return (int)ap->applid;
......
...@@ -1372,15 +1372,15 @@ static void handle_data(_cmsg * cmsg, struct sk_buff *skb) ...@@ -1372,15 +1372,15 @@ 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_signal(struct capi20_appl *ap)
{ {
struct sk_buff *skb = 0; struct sk_buff *skb = 0;
while (capi20_get_message(&global.ap, &skb) == CAPI_NOERROR) { while (capi20_get_message(ap, &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) {
...@@ -2328,7 +2328,7 @@ static int __init capidrv_init(void) ...@@ -2328,7 +2328,7 @@ static int __init capidrv_init(void)
return -EIO; return -EIO;
} }
capi20_set_signal(&global.ap, capidrv_signal, 0); capi20_set_signal(&global.ap, capidrv_signal);
ncontr = profile.ncontroller; ncontr = profile.ncontroller;
for (contr = 1; contr <= ncontr; contr++) { for (contr = 1; contr <= ncontr; contr++) {
......
...@@ -579,7 +579,7 @@ static void recv_handler(void *dummy) ...@@ -579,7 +579,7 @@ static void recv_handler(void *dummy)
ap->nrecvctlpkt++; ap->nrecvctlpkt++;
} }
skb_queue_tail(&ap->recv_queue, skb); skb_queue_tail(&ap->recv_queue, skb);
(ap->signal) (ap->applid, ap->param); (ap->signal) (ap);
} }
} }
...@@ -870,7 +870,6 @@ u16 capi20_register(struct capi20_appl *ap) ...@@ -870,7 +870,6 @@ u16 capi20_register(struct capi20_appl *ap)
ap->applid = applid; ap->applid = applid;
applications[applid - 1] = ap; applications[applid - 1] = ap;
ap->param = NULL;
ap->signal = NULL; ap->signal = NULL;
skb_queue_head_init(&ap->recv_queue); skb_queue_head_init(&ap->recv_queue);
ap->nncci = 0; ap->nncci = 0;
...@@ -984,13 +983,11 @@ u16 capi20_get_message(struct capi20_appl *ap, struct sk_buff **msgp) ...@@ -984,13 +983,11 @@ u16 capi20_get_message(struct capi20_appl *ap, struct sk_buff **msgp)
EXPORT_SYMBOL(capi20_get_message); EXPORT_SYMBOL(capi20_get_message);
u16 capi20_set_signal(struct capi20_appl *ap, u16 capi20_set_signal(struct capi20_appl *ap,
void (*signal) (u16 applid, void *param), void (*signal) (struct capi20_appl *appl))
void *param)
{ {
if (ap->applid == 0) if (ap->applid == 0)
return CAPI_ILLAPPNR; return CAPI_ILLAPPNR;
ap->signal = signal; ap->signal = signal;
ap->param = param;
return CAPI_NOERROR; return CAPI_NOERROR;
} }
......
...@@ -55,10 +55,10 @@ typedef struct kcapi_carddef { ...@@ -55,10 +55,10 @@ typedef struct kcapi_carddef {
struct capi20_appl { struct capi20_appl {
u16 applid; u16 applid;
capi_register_params rparam; capi_register_params rparam;
void *private;
/* internal to kernelcapi.o */ /* internal to kernelcapi.o */
void *param; void (*signal) (struct capi20_appl *ap);
void (*signal) (u16 applid, void *param);
struct sk_buff_head recv_queue; struct sk_buff_head recv_queue;
int nncci; int nncci;
struct capi_ncci *nccilist; struct capi_ncci *nccilist;
...@@ -80,8 +80,7 @@ u16 capi20_release(struct capi20_appl *ap); ...@@ -80,8 +80,7 @@ u16 capi20_release(struct capi20_appl *ap);
u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb); u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb);
u16 capi20_get_message(struct capi20_appl *ap, struct sk_buff **msgp); u16 capi20_get_message(struct capi20_appl *ap, struct sk_buff **msgp);
u16 capi20_set_signal(struct capi20_appl *ap, u16 capi20_set_signal(struct capi20_appl *ap,
void (*signal) (u16 applid, void *param), void (*signal) (struct capi20_appl *ap));
void *param);
u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]); u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
u16 capi20_get_version(u32 contr, struct capi_version *verp); u16 capi20_get_version(u32 contr, struct capi_version *verp);
u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]); u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
......
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