Commit b5919c97 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/CAPI: Export callbacks for CAPI drivers directly

They're always the same, so no point in using function pointers.
parent 2b8fd805
...@@ -324,8 +324,7 @@ static void recv_handler(void *dummy) ...@@ -324,8 +324,7 @@ static void recv_handler(void *dummy)
} }
} }
static void controllercb_handle_capimsg(struct capi_ctr * card, void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb)
u16 appl, struct sk_buff *skb)
{ {
int showctl = 0; int showctl = 0;
u8 cmd, subcmd; u8 cmd, subcmd;
...@@ -368,7 +367,9 @@ static void controllercb_handle_capimsg(struct capi_ctr * card, ...@@ -368,7 +367,9 @@ static void controllercb_handle_capimsg(struct capi_ctr * card,
kfree_skb(skb); kfree_skb(skb);
} }
static void controllercb_ready(struct capi_ctr * card) EXPORT_SYMBOL(capi_ctr_handle_message);
void capi_ctr_ready(struct capi_ctr * card)
{ {
u16 appl; u16 appl;
struct capi20_appl *ap; struct capi20_appl *ap;
...@@ -387,7 +388,9 @@ static void controllercb_ready(struct capi_ctr * card) ...@@ -387,7 +388,9 @@ static void controllercb_ready(struct capi_ctr * card)
notify_push(KCI_CONTRUP, card->cnr, 0, 0); notify_push(KCI_CONTRUP, card->cnr, 0, 0);
} }
static void controllercb_reseted(struct capi_ctr * card) EXPORT_SYMBOL(capi_ctr_ready);
void capi_ctr_reseted(struct capi_ctr * card)
{ {
u16 appl; u16 appl;
...@@ -416,7 +419,9 @@ static void controllercb_reseted(struct capi_ctr * card) ...@@ -416,7 +419,9 @@ static void controllercb_reseted(struct capi_ctr * card)
notify_push(KCI_CONTRDOWN, card->cnr, 0, 0); notify_push(KCI_CONTRDOWN, card->cnr, 0, 0);
} }
static void controllercb_suspend_output(struct capi_ctr *card) EXPORT_SYMBOL(capi_ctr_reseted);
void capi_ctr_suspend_output(struct capi_ctr *card)
{ {
if (!card->blocked) { if (!card->blocked) {
printk(KERN_DEBUG "kcapi: card %d suspend\n", card->cnr); printk(KERN_DEBUG "kcapi: card %d suspend\n", card->cnr);
...@@ -424,7 +429,9 @@ static void controllercb_suspend_output(struct capi_ctr *card) ...@@ -424,7 +429,9 @@ static void controllercb_suspend_output(struct capi_ctr *card)
} }
} }
static void controllercb_resume_output(struct capi_ctr *card) EXPORT_SYMBOL(capi_ctr_suspend_output);
void capi_ctr_resume_output(struct capi_ctr *card)
{ {
if (card->blocked) { if (card->blocked) {
printk(KERN_DEBUG "kcapi: card %d resume\n", card->cnr); printk(KERN_DEBUG "kcapi: card %d resume\n", card->cnr);
...@@ -432,6 +439,8 @@ static void controllercb_resume_output(struct capi_ctr *card) ...@@ -432,6 +439,8 @@ static void controllercb_resume_output(struct capi_ctr *card)
} }
} }
EXPORT_SYMBOL(capi_ctr_resume_output);
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
int int
...@@ -458,12 +467,6 @@ attach_capi_ctr(struct capi_ctr *card) ...@@ -458,12 +467,6 @@ attach_capi_ctr(struct capi_ctr *card)
card->blocked = 0; card->blocked = 0;
card->traceflag = showcapimsgs; card->traceflag = showcapimsgs;
card->ready = controllercb_ready;
card->reseted = controllercb_reseted;
card->suspend_output = controllercb_suspend_output;
card->resume_output = controllercb_resume_output;
card->handle_capimsg = controllercb_handle_capimsg;
sprintf(card->procfn, "capi/controllers/%d", card->cnr); sprintf(card->procfn, "capi/controllers/%d", card->cnr);
card->procent = create_proc_entry(card->procfn, 0, 0); card->procent = create_proc_entry(card->procfn, 0, 0);
if (card->procent) { if (card->procent) {
...@@ -484,9 +487,8 @@ EXPORT_SYMBOL(attach_capi_ctr); ...@@ -484,9 +487,8 @@ EXPORT_SYMBOL(attach_capi_ctr);
int detach_capi_ctr(struct capi_ctr *card) int detach_capi_ctr(struct capi_ctr *card)
{ {
if (card->cardstate != CARD_DETECTED) if (card->cardstate != CARD_DETECTED)
controllercb_reseted(card); capi_ctr_reseted(card);
list_del(&card->driver_list);
ncards--; ncards--;
if (card->procent) { if (card->procent) {
...@@ -496,7 +498,6 @@ int detach_capi_ctr(struct capi_ctr *card) ...@@ -496,7 +498,6 @@ int detach_capi_ctr(struct capi_ctr *card)
capi_cards[card->cnr - 1] = NULL; capi_cards[card->cnr - 1] = NULL;
printk(KERN_NOTICE "kcapi: Controller %d: %s unregistered\n", printk(KERN_NOTICE "kcapi: Controller %d: %s unregistered\n",
card->cnr, card->name); card->cnr, card->name);
kfree(card);
return 0; return 0;
} }
......
...@@ -330,7 +330,7 @@ void b1_reset_ctr(struct capi_ctr *ctrl) ...@@ -330,7 +330,7 @@ void b1_reset_ctr(struct capi_ctr *ctrl)
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head); capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl); capi_ctr_reseted(ctrl);
} }
void b1_register_appl(struct capi_ctr *ctrl, void b1_register_appl(struct capi_ctr *ctrl,
...@@ -529,7 +529,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -529,7 +529,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
} else { } else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -547,7 +547,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -547,7 +547,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
CAPIMSG_NCCI(skb->data), CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data)); CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -573,11 +573,11 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -573,11 +573,11 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
case RECEIVE_START: case RECEIVE_START:
/* b1_put_byte(card->port, SEND_POLLACK); */ /* b1_put_byte(card->port, SEND_POLLACK); */
ctrl->resume_output(ctrl); capi_ctr_resume_output(ctrl);
break; break;
case RECEIVE_STOP: case RECEIVE_STOP:
ctrl->suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
break; break;
case RECEIVE_INIT: case RECEIVE_INIT:
...@@ -588,7 +588,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -588,7 +588,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
card->name, card->name,
cinfo->version[VER_CARDTYPE], cinfo->version[VER_CARDTYPE],
cinfo->version[VER_DRIVER]); cinfo->version[VER_DRIVER]);
ctrl->ready(ctrl); capi_ctr_ready(ctrl);
break; break;
case RECEIVE_TASK_READY: case RECEIVE_TASK_READY:
......
...@@ -475,7 +475,7 @@ static void b1dma_handle_rx(avmcard *card) ...@@ -475,7 +475,7 @@ static void b1dma_handle_rx(avmcard *card)
} else { } else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -493,7 +493,7 @@ static void b1dma_handle_rx(avmcard *card) ...@@ -493,7 +493,7 @@ static void b1dma_handle_rx(avmcard *card)
CAPIMSG_NCCI(skb->data), CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data)); CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -523,11 +523,11 @@ static void b1dma_handle_rx(avmcard *card) ...@@ -523,11 +523,11 @@ static void b1dma_handle_rx(avmcard *card)
#endif #endif
if (!suppress_pollack) if (!suppress_pollack)
queue_pollack(card); queue_pollack(card);
ctrl->resume_output(ctrl); capi_ctr_resume_output(ctrl);
break; break;
case RECEIVE_STOP: case RECEIVE_STOP:
ctrl->suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
break; break;
case RECEIVE_INIT: case RECEIVE_INIT:
...@@ -538,7 +538,7 @@ static void b1dma_handle_rx(avmcard *card) ...@@ -538,7 +538,7 @@ static void b1dma_handle_rx(avmcard *card)
card->name, card->name,
cinfo->version[VER_CARDTYPE], cinfo->version[VER_CARDTYPE],
cinfo->version[VER_DRIVER]); cinfo->version[VER_DRIVER]);
ctrl->ready(ctrl); capi_ctr_ready(ctrl);
break; break;
case RECEIVE_TASK_READY: case RECEIVE_TASK_READY:
...@@ -740,7 +740,7 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl) ...@@ -740,7 +740,7 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl)
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head); capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl); capi_ctr_reseted(ctrl);
} }
......
...@@ -534,7 +534,7 @@ static void c4_handle_rx(avmcard *card) ...@@ -534,7 +534,7 @@ static void c4_handle_rx(avmcard *card)
} else { } else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -557,7 +557,7 @@ static void c4_handle_rx(avmcard *card) ...@@ -557,7 +557,7 @@ static void c4_handle_rx(avmcard *card)
CAPIMSG_NCCI(skb->data), CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data)); CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -593,16 +593,14 @@ static void c4_handle_rx(avmcard *card) ...@@ -593,16 +593,14 @@ static void c4_handle_rx(avmcard *card)
queue_pollack(card); queue_pollack(card);
for (cidx=0; cidx < card->nr_controllers; cidx++) { for (cidx=0; cidx < card->nr_controllers; cidx++) {
ctrl = &card->ctrlinfo[cidx].capi_ctrl; ctrl = &card->ctrlinfo[cidx].capi_ctrl;
if (ctrl) capi_ctr_resume_output(ctrl);
ctrl->resume_output(ctrl);
} }
break; break;
case RECEIVE_STOP: case RECEIVE_STOP:
for (cidx=0; cidx < card->nr_controllers; cidx++) { for (cidx=0; cidx < card->nr_controllers; cidx++) {
ctrl = &card->ctrlinfo[cidx].capi_ctrl; ctrl = &card->ctrlinfo[cidx].capi_ctrl;
if (ctrl) capi_ctr_suspend_output(ctrl);
ctrl->suspend_output(ctrl);
} }
break; break;
...@@ -623,7 +621,7 @@ static void c4_handle_rx(avmcard *card) ...@@ -623,7 +621,7 @@ static void c4_handle_rx(avmcard *card)
card->name, card->name,
cinfo->version[VER_CARDTYPE], cinfo->version[VER_CARDTYPE],
cinfo->version[VER_DRIVER]); cinfo->version[VER_DRIVER]);
ctrl->ready(&cinfo->capi_ctrl); capi_ctr_ready(&cinfo->capi_ctrl);
break; break;
case RECEIVE_TASK_READY: case RECEIVE_TASK_READY:
...@@ -675,7 +673,7 @@ static void c4_handle_interrupt(avmcard *card) ...@@ -675,7 +673,7 @@ static void c4_handle_interrupt(avmcard *card)
avmctrl_info *cinfo = &card->ctrlinfo[i]; avmctrl_info *cinfo = &card->ctrlinfo[i];
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head); capilib_release(&cinfo->ncci_head);
cinfo->capi_ctrl.reseted(&cinfo->capi_ctrl); capi_ctr_reseted(&cinfo->capi_ctrl);
} }
card->nlogcontr = 0; card->nlogcontr = 0;
return; return;
...@@ -888,7 +886,7 @@ void c4_reset_ctr(struct capi_ctr *ctrl) ...@@ -888,7 +886,7 @@ void c4_reset_ctr(struct capi_ctr *ctrl)
for (i=0; i < card->nr_controllers; i++) { for (i=0; i < card->nr_controllers; i++) {
cinfo = &card->ctrlinfo[i]; cinfo = &card->ctrlinfo[i];
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
cinfo->capi_ctrl.reseted(&cinfo->capi_ctrl); capi_ctr_reseted(&cinfo->capi_ctrl);
} }
card->nlogcontr = 0; card->nlogcontr = 0;
} }
......
...@@ -161,7 +161,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -161,7 +161,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
} else { } else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len); memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -179,7 +179,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -179,7 +179,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
CAPIMSG_NCCI(skb->data), CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data)); CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
break; break;
...@@ -205,11 +205,11 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -205,11 +205,11 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
case RECEIVE_START: case RECEIVE_START:
b1_put_byte(card->port, SEND_POLLACK); b1_put_byte(card->port, SEND_POLLACK);
ctrl->resume_output(ctrl); capi_ctr_resume_output(ctrl);
break; break;
case RECEIVE_STOP: case RECEIVE_STOP:
ctrl->suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
break; break;
case RECEIVE_INIT: case RECEIVE_INIT:
...@@ -220,7 +220,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -220,7 +220,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
card->name, card->name,
cinfo->version[VER_CARDTYPE], cinfo->version[VER_CARDTYPE],
cinfo->version[VER_DRIVER]); cinfo->version[VER_DRIVER]);
ctrl->ready(ctrl); capi_ctr_ready(ctrl);
break; break;
case RECEIVE_TASK_READY: case RECEIVE_TASK_READY:
...@@ -319,7 +319,7 @@ void t1isa_reset_ctr(struct capi_ctr *ctrl) ...@@ -319,7 +319,7 @@ void t1isa_reset_ctr(struct capi_ctr *ctrl)
memset(cinfo->version, 0, sizeof(cinfo->version)); memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head); capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl); capi_ctr_reseted(ctrl);
} }
static void t1isa_remove(struct pci_dev *pdev) static void t1isa_remove(struct pci_dev *pdev)
......
...@@ -53,8 +53,6 @@ static inline int _hycapi_appCheck(int app_id, int ctrl_no) ...@@ -53,8 +53,6 @@ static inline int _hycapi_appCheck(int app_id, int ctrl_no)
return ((hycapi_applications[app_id-1].ctrl_mask & (1 << (ctrl_no-1))) != 0); return ((hycapi_applications[app_id-1].ctrl_mask & (1 << (ctrl_no-1))) != 0);
} }
struct capi_driver_interface *hy_di = NULL;
/****************************** /******************************
Kernel-Capi callback reset_ctr Kernel-Capi callback reset_ctr
******************************/ ******************************/
...@@ -68,7 +66,7 @@ hycapi_reset_ctr(struct capi_ctr *ctrl) ...@@ -68,7 +66,7 @@ hycapi_reset_ctr(struct capi_ctr *ctrl)
printk(KERN_NOTICE "HYCAPI hycapi_reset_ctr\n"); printk(KERN_NOTICE "HYCAPI hycapi_reset_ctr\n");
#endif #endif
capilib_release(&cinfo->ncci_head); capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl); capi_ctr_reseted(ctrl);
} }
/****************************** /******************************
...@@ -94,7 +92,7 @@ hycapi_remove_ctr(struct capi_ctr *ctrl) ...@@ -94,7 +92,7 @@ hycapi_remove_ctr(struct capi_ctr *ctrl)
return; return;
} }
card = cinfo->card; card = cinfo->card;
ctrl->suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
for(i=0; i<CAPI_MAXAPPL;i++) { for(i=0; i<CAPI_MAXAPPL;i++) {
if(hycapi_applications[i].listen_req[ctrl->cnr-1]) { if(hycapi_applications[i].listen_req[ctrl->cnr-1]) {
kfree_skb(hycapi_applications[i].listen_req[ctrl->cnr-1]); kfree_skb(hycapi_applications[i].listen_req[ctrl->cnr-1]);
...@@ -133,7 +131,7 @@ hycapi_sendmsg_internal(struct capi_ctr *ctrl, struct sk_buff *skb) ...@@ -133,7 +131,7 @@ hycapi_sendmsg_internal(struct capi_ctr *ctrl, struct sk_buff *skb)
/* inform upper layers we're full */ /* inform upper layers we're full */
printk(KERN_ERR "HYSDN Card%d: CAPI-buffer overrun!\n", printk(KERN_ERR "HYSDN Card%d: CAPI-buffer overrun!\n",
card->myid); card->myid);
ctrl->suspend_output(ctrl); capi_ctr_suspend_output(ctrl);
} }
cinfo->tx_skb = skb; cinfo->tx_skb = skb;
spin_unlock_irq(&cinfo->lock); spin_unlock_irq(&cinfo->lock);
...@@ -334,7 +332,7 @@ int hycapi_capi_release(hysdn_card *card) ...@@ -334,7 +332,7 @@ int hycapi_capi_release(hysdn_card *card)
printk(KERN_NOTICE "hycapi_capi_release\n"); printk(KERN_NOTICE "hycapi_capi_release\n");
#endif #endif
if(cinfo) { if(cinfo) {
ctrl = cinfo->capi_ctrl; ctrl = &cinfo->capi_ctrl;
hycapi_remove_ctr(ctrl); hycapi_remove_ctr(ctrl);
} }
return 0; return 0;
...@@ -354,14 +352,9 @@ int hycapi_capi_stop(hysdn_card *card) ...@@ -354,14 +352,9 @@ int hycapi_capi_stop(hysdn_card *card)
printk(KERN_NOTICE "hycapi_capi_stop\n"); printk(KERN_NOTICE "hycapi_capi_stop\n");
#endif #endif
if(cinfo) { if(cinfo) {
if(cinfo->capi_ctrl) { ctrl = &cinfo->capi_ctrl;
ctrl = cinfo->capi_ctrl;
/* ctrl->suspend_output(ctrl); */ /* ctrl->suspend_output(ctrl); */
ctrl->reseted(ctrl); capi_ctr_reseted(ctrl);
} else {
printk(KERN_NOTICE "hycapi_capi_stop: cinfo but no capi_ctrl\n");
}
} }
return 0; return 0;
} }
...@@ -552,11 +545,7 @@ hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len) ...@@ -552,11 +545,7 @@ hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len)
if(!cinfo) { if(!cinfo) {
return; return;
} }
ctrl = cinfo->capi_ctrl; ctrl = &cinfo->capi_ctrl;
if(!ctrl)
{
return;
}
if(len < CAPI_MSG_BASELEN) { if(len < CAPI_MSG_BASELEN) {
printk(KERN_ERR "HYSDN Card%d: invalid CAPI-message, lenght %d!\n", printk(KERN_ERR "HYSDN Card%d: invalid CAPI-message, lenght %d!\n",
card->myid, len); card->myid, len);
...@@ -635,7 +624,7 @@ hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len) ...@@ -635,7 +624,7 @@ hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len)
default: default:
break; break;
} }
ctrl->handle_capimsg(ctrl, ApplId, skb); capi_ctr_handle_message(ctrl, ApplId, skb);
} }
/****************************************************************** /******************************************************************
...@@ -662,7 +651,7 @@ void hycapi_tx_capiack(hysdn_card * card) ...@@ -662,7 +651,7 @@ void hycapi_tx_capiack(hysdn_card * card)
cinfo->out_idx = 0; /* wrap around */ cinfo->out_idx = 0; /* wrap around */
if (cinfo->sk_count-- == HYSDN_MAX_CAPI_SKB) /* dec usage count */ if (cinfo->sk_count-- == HYSDN_MAX_CAPI_SKB) /* dec usage count */
cinfo->capi_ctrl->resume_output(cinfo->capi_ctrl); capi_ctr_resume_output(&cinfo->capi_ctrl);
spin_unlock_irq(&cinfo->lock); spin_unlock_irq(&cinfo->lock);
} }
...@@ -687,21 +676,6 @@ hycapi_tx_capiget(hysdn_card *card) ...@@ -687,21 +676,6 @@ hycapi_tx_capiget(hysdn_card *card)
} }
static struct capi_driver hycapi_driver = {
owner: THIS_MODULE,
name: "hysdn",
revision: "0.0",
load_firmware: hycapi_load_firmware,
reset_ctr: hycapi_reset_ctr,
register_appl: hycapi_register_appl,
release_appl: hycapi_release_appl,
send_message: hycapi_send_message,
procinfo: hycapi_procinfo,
ctr_read_proc: hycapi_read_proc,
};
/********************************************************** /**********************************************************
int hycapi_init() int hycapi_init()
...@@ -711,16 +685,11 @@ attach the capi-driver to the kernel-capi. ...@@ -711,16 +685,11 @@ attach the capi-driver to the kernel-capi.
int hycapi_init() int hycapi_init()
{ {
struct capi_driver *driver;
int i; int i;
if(hy_di) { if(hy_di) {
printk(KERN_NOTICE "HyDI allready set\n"); printk(KERN_NOTICE "HyDI allready set\n");
return 0; return 0;
} }
driver = &hycapi_driver;
printk(KERN_NOTICE "HYSDN: Attaching capi-driver\n");
attach_capi_driver(driver);
for(i=0;i<CAPI_MAXAPPL;i++) { for(i=0;i<CAPI_MAXAPPL;i++) {
memset(&(hycapi_applications[i]), 0, sizeof(hycapi_appl)); memset(&(hycapi_applications[i]), 0, sizeof(hycapi_appl));
} }
...@@ -737,16 +706,6 @@ free some more ressources. Do that later. ...@@ -737,16 +706,6 @@ free some more ressources. Do that later.
void void
hycapi_cleanup(void) hycapi_cleanup(void)
{ {
struct capi_driver *driver;
driver = &hycapi_driver;
if (!hy_di) {
printk(KERN_ERR "HYSDN: no capi-driver to detach (?)\n");
return;
}
printk(KERN_NOTICE "HYSDN: Detaching capi-driver\n");
detach_capi_driver(driver);
hy_di = 0;
return;
} }
/******************************************************************** /********************************************************************
...@@ -761,8 +720,7 @@ static void hycapi_fill_profile(hysdn_card *card) ...@@ -761,8 +720,7 @@ static void hycapi_fill_profile(hysdn_card *card)
struct capi_ctr *ctrl = NULL; struct capi_ctr *ctrl = NULL;
cinfo = card->hyctrlinfo; cinfo = card->hyctrlinfo;
if(!cinfo) return; if(!cinfo) return;
ctrl = cinfo->capi_ctrl; ctrl = &cinfo->capi_ctrl;
if(!ctrl) return;
strcpy(ctrl->manu, "Hypercope"); strcpy(ctrl->manu, "Hypercope");
ctrl->version.majorversion = 2; ctrl->version.majorversion = 2;
ctrl->version.minorversion = 0; ctrl->version.minorversion = 0;
...@@ -790,6 +748,7 @@ hycapi_capi_create(hysdn_card *card) ...@@ -790,6 +748,7 @@ hycapi_capi_create(hysdn_card *card)
{ {
hycapictrl_info *cinfo = NULL; hycapictrl_info *cinfo = NULL;
struct capi_ctr *ctrl = NULL; struct capi_ctr *ctrl = NULL;
int retval;
#ifdef HYCAPI_PRINTFNAMES #ifdef HYCAPI_PRINTFNAMES
printk(KERN_NOTICE "hycapi_capi_create\n"); printk(KERN_NOTICE "hycapi_capi_create\n");
#endif #endif
...@@ -817,28 +776,34 @@ hycapi_capi_create(hysdn_card *card) ...@@ -817,28 +776,34 @@ hycapi_capi_create(hysdn_card *card)
default: strcpy(cinfo->cardname,"HYSDN ???"); break; default: strcpy(cinfo->cardname,"HYSDN ???"); break;
} }
cinfo->capi_ctrl = attach_capi_ctr(&hycapi_driver, ctrl = &cinfo->capi_ctrl;
cinfo->cardname, cinfo); ctrl->driver_name = "hycapi";
ctrl = cinfo->capi_ctrl; ctrl->driverdata = cinfo;
if (!ctrl) { ctrl->register_appl = hycapi_register_appl;
printk(KERN_ERR "%s: attach controller failed.\n", ctrl->release_appl = hycapi_release_appl;
hycapi_driver.name); ctrl->send_message = hycapi_send_message;
ctrl->load_firmware = hycapi_load_firmware;
ctrl->reset_ctr = hycapi_reset_ctr;
ctrl->procinfo = hycapi_procinfo;
ctrl->ctr_read_proc = hycapi_read_proc;
strcpy(ctrl->name, cinfo->cardname);
SET_MODULE_OWNER(ctrl);
retval = attach_capi_ctr(ctrl);
if (retval) {
printk(KERN_ERR "hycapi: attach controller failed.\n");
return -EBUSY; return -EBUSY;
} }
/* fill in the blanks: */ /* fill in the blanks: */
hycapi_fill_profile(card); hycapi_fill_profile(card);
ctrl->ready(ctrl); capi_ctr_ready(ctrl);
} else { } else {
/* resume output on stopped ctrl */ /* resume output on stopped ctrl */
ctrl = card->hyctrlinfo->capi_ctrl; ctrl = &card->hyctrlinfo->capi_ctrl;
if(ctrl) {
hycapi_fill_profile(card); hycapi_fill_profile(card);
ctrl->ready(ctrl); capi_ctr_ready(ctrl);
hycapi_restart_internal(ctrl); hycapi_restart_internal(ctrl);
/* ctrl->resume_output(ctrl); */ /* ctrl->resume_output(ctrl); */
} else {
printk(KERN_WARNING "HYSDN: No ctrl???? How come?\n");
}
} }
return 0; return 0;
} }
...@@ -208,7 +208,7 @@ typedef struct HYSDN_CARD { ...@@ -208,7 +208,7 @@ typedef struct HYSDN_CARD {
char infobuf[128]; /* for function procinfo */ char infobuf[128]; /* for function procinfo */
struct HYSDN_CARD *card; struct HYSDN_CARD *card;
struct capi_ctr *capi_ctrl; struct capi_ctr capi_ctrl;
struct sk_buff *skbs[HYSDN_MAX_CAPI_SKB]; struct sk_buff *skbs[HYSDN_MAX_CAPI_SKB];
int in_idx, out_idx; /* indexes to buffer ring */ int in_idx, out_idx; /* indexes to buffer ring */
int sk_count; /* number of buffers currently in ring */ int sk_count; /* number of buffers currently in ring */
......
...@@ -59,14 +59,6 @@ struct capi_ctr { ...@@ -59,14 +59,6 @@ struct capi_ctr {
capi_profile profile; /* CAPI_GET_PROFILE */ capi_profile profile; /* CAPI_GET_PROFILE */
u8 serial[CAPI_SERIAL_LEN]; /* CAPI_GET_SERIAL */ u8 serial[CAPI_SERIAL_LEN]; /* CAPI_GET_SERIAL */
/* functions */
void (*ready)(struct capi_ctr * card);
void (*reseted)(struct capi_ctr * card);
void (*suspend_output)(struct capi_ctr * card);
void (*resume_output)(struct capi_ctr * card);
void (*handle_capimsg)(struct capi_ctr * card,
u16 appl, struct sk_buff *skb);
/* management information for kcapi */ /* management information for kcapi */
unsigned long nrecvctlpkt; unsigned long nrecvctlpkt;
...@@ -74,7 +66,6 @@ struct capi_ctr { ...@@ -74,7 +66,6 @@ struct capi_ctr {
unsigned long nsentctlpkt; unsigned long nsentctlpkt;
unsigned long nsentdatapkt; unsigned long nsentdatapkt;
struct list_head driver_list; /* contrs by driver */
int cnr; /* controller number */ int cnr; /* controller number */
volatile unsigned short cardstate; /* controller state */ volatile unsigned short cardstate; /* controller state */
volatile int blocked; /* output blocked */ volatile int blocked; /* output blocked */
...@@ -87,7 +78,11 @@ struct capi_ctr { ...@@ -87,7 +78,11 @@ struct capi_ctr {
int attach_capi_ctr(struct capi_ctr *); int attach_capi_ctr(struct capi_ctr *);
int detach_capi_ctr(struct capi_ctr *); int detach_capi_ctr(struct capi_ctr *);
void capi_ctr_ready(struct capi_ctr * card);
void capi_ctr_reseted(struct capi_ctr * card);
void capi_ctr_suspend_output(struct capi_ctr * card);
void capi_ctr_resume_output(struct capi_ctr * card);
void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// library functions for use by hardware controller drivers // library functions for use by hardware controller drivers
......
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