Commit 06082418 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 56677816 d095870d
This diff is collapsed.
...@@ -357,8 +357,6 @@ void b1_register_appl(struct capi_ctr *ctrl, ...@@ -357,8 +357,6 @@ void b1_register_appl(struct capi_ctr *ctrl,
b1_put_word(port, rp->datablkcnt); b1_put_word(port, rp->datablkcnt);
b1_put_word(port, rp->datablklen); b1_put_word(port, rp->datablklen);
restore_flags(flags); restore_flags(flags);
ctrl->appl_registered(ctrl, appl);
} }
void b1_release_appl(struct capi_ctr *ctrl, u16 appl) void b1_release_appl(struct capi_ctr *ctrl, u16 appl)
...@@ -548,7 +546,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -548,7 +546,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
if (NCCI != 0xffffffff) if (NCCI != 0xffffffff)
ctrl->free_ncci(ctrl, ApplId, NCCI); ctrl->free_ncci(ctrl, ApplId, NCCI);
else ctrl->appl_released(ctrl, ApplId);
break; break;
case RECEIVE_START: case RECEIVE_START:
......
...@@ -509,7 +509,7 @@ static void b1dma_handle_rx(avmcard *card) ...@@ -509,7 +509,7 @@ static void b1dma_handle_rx(avmcard *card)
if (NCCI != 0xffffffff) if (NCCI != 0xffffffff)
ctrl->free_ncci(ctrl, ApplId, NCCI); ctrl->free_ncci(ctrl, ApplId, NCCI);
else ctrl->appl_released(ctrl, ApplId);
break; break;
case RECEIVE_START: case RECEIVE_START:
...@@ -774,8 +774,6 @@ void b1dma_register_appl(struct capi_ctr *ctrl, ...@@ -774,8 +774,6 @@ void b1dma_register_appl(struct capi_ctr *ctrl,
skb_put(skb, (u8 *)p - (u8 *)skb->data); skb_put(skb, (u8 *)p - (u8 *)skb->data);
b1dma_queue_tx(card, skb); b1dma_queue_tx(card, skb);
ctrl->appl_registered(ctrl, appl);
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
......
...@@ -34,10 +34,6 @@ MODULE_LICENSE("GPL"); ...@@ -34,10 +34,6 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver_interface *di;
/* ------------------------------------------------------------- */
static void b1isa_remove_ctr(struct capi_ctr *ctrl) static void b1isa_remove_ctr(struct capi_ctr *ctrl)
{ {
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
...@@ -47,7 +43,7 @@ static void b1isa_remove_ctr(struct capi_ctr *ctrl) ...@@ -47,7 +43,7 @@ static void b1isa_remove_ctr(struct capi_ctr *ctrl)
b1_reset(port); b1_reset(port);
b1_reset(port); b1_reset(port);
di->detach_ctr(ctrl); detach_capi_ctr(ctrl);
free_irq(card->irq, card); free_irq(card->irq, card);
release_region(card->port, AVMB1_PORTLEN); release_region(card->port, AVMB1_PORTLEN);
b1_free_card(card); b1_free_card(card);
...@@ -111,7 +107,7 @@ static int b1isa_add_card(struct capi_driver *driver, struct capicardparams *p) ...@@ -111,7 +107,7 @@ static int b1isa_add_card(struct capi_driver *driver, struct capicardparams *p)
b1_reset(card->port); b1_reset(card->port);
b1_getrevision(card); b1_getrevision(card);
cinfo->capi_ctrl = di->attach_ctr(driver, card->name, cinfo); cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo);
if (!cinfo->capi_ctrl) { if (!cinfo->capi_ctrl) {
printk(KERN_ERR "b1isa: attach controller failed.\n"); printk(KERN_ERR "b1isa: attach controller failed.\n");
retval = -EBUSY; retval = -EBUSY;
...@@ -154,27 +150,27 @@ static char *b1isa_procinfo(struct capi_ctr *ctrl) ...@@ -154,27 +150,27 @@ static char *b1isa_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver b1isa_driver = { static struct capi_driver b1isa_driver = {
name: "b1isa", owner: THIS_MODULE,
revision: "0.0", name: "b1isa",
load_firmware: b1_load_firmware, revision: "0.0",
reset_ctr: b1_reset_ctr, load_firmware: b1_load_firmware,
remove_ctr: b1isa_remove_ctr, reset_ctr: b1_reset_ctr,
register_appl: b1_register_appl, remove_ctr: b1isa_remove_ctr,
release_appl: b1_release_appl, register_appl: b1_register_appl,
send_message: b1_send_message, release_appl: b1_release_appl,
send_message: b1_send_message,
procinfo: b1isa_procinfo,
ctr_read_proc: b1ctl_read_proc, procinfo: b1isa_procinfo,
driver_read_proc: 0, /* use standard driver_read_proc */ ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: b1isa_add_card,
add_card: b1isa_add_card,
}; };
static int __init b1isa_init(void) static int __init b1isa_init(void)
{ {
struct capi_driver *driver = &b1isa_driver; struct capi_driver *driver = &b1isa_driver;
char *p; char *p;
int retval = 0;
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
...@@ -187,15 +183,9 @@ static int __init b1isa_init(void) ...@@ -187,15 +183,9 @@ static int __init b1isa_init(void)
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision); printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
di = attach_capi_driver(driver); attach_capi_driver(driver);
if (!di) {
printk(KERN_ERR "%s: failed to attach capi_driver\n",
driver->name);
retval = -EIO;
}
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return retval; return 0;
} }
static void __exit b1isa_exit(void) static void __exit b1isa_exit(void)
......
...@@ -42,10 +42,6 @@ MODULE_LICENSE("GPL"); ...@@ -42,10 +42,6 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver_interface *di;
/* ------------------------------------------------------------- */
static char *b1pci_procinfo(struct capi_ctr *ctrl) static char *b1pci_procinfo(struct capi_ctr *ctrl)
{ {
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
...@@ -113,7 +109,7 @@ static int b1pci_add_card(struct capi_driver *driver, ...@@ -113,7 +109,7 @@ static int b1pci_add_card(struct capi_driver *driver,
goto err_release_region; goto err_release_region;
} }
cinfo->capi_ctrl = di->attach_ctr(driver, card->name, cinfo); cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo);
if (!cinfo->capi_ctrl) { if (!cinfo->capi_ctrl) {
printk(KERN_ERR "%s: attach controller failed.\n", printk(KERN_ERR "%s: attach controller failed.\n",
driver->name); driver->name);
...@@ -153,7 +149,7 @@ static void b1pci_remove_ctr(struct capi_ctr *ctrl) ...@@ -153,7 +149,7 @@ static void b1pci_remove_ctr(struct capi_ctr *ctrl)
b1_reset(port); b1_reset(port);
b1_reset(port); b1_reset(port);
di->detach_ctr(ctrl); detach_capi_ctr(ctrl);
free_irq(card->irq, card); free_irq(card->irq, card);
release_region(card->port, AVMB1_PORTLEN); release_region(card->port, AVMB1_PORTLEN);
ctrl->driverdata = 0; ctrl->driverdata = 0;
...@@ -165,29 +161,26 @@ static void b1pci_remove_ctr(struct capi_ctr *ctrl) ...@@ -165,29 +161,26 @@ static void b1pci_remove_ctr(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver b1pci_driver = { static struct capi_driver b1pci_driver = {
name: "b1pci", owner: THIS_MODULE,
revision: "0.0", name: "b1pci",
load_firmware: b1_load_firmware, revision: "0.0",
reset_ctr: b1_reset_ctr, load_firmware: b1_load_firmware,
remove_ctr: b1pci_remove_ctr, reset_ctr: b1_reset_ctr,
register_appl: b1_register_appl, remove_ctr: b1pci_remove_ctr,
release_appl: b1_release_appl, register_appl: b1_register_appl,
send_message: b1_send_message, release_appl: b1_release_appl,
send_message: b1_send_message,
procinfo: b1pci_procinfo,
ctr_read_proc: b1ctl_read_proc, procinfo: b1pci_procinfo,
driver_read_proc: 0, /* use standard driver_read_proc */ ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
add_card: 0, /* no add_card function */
}; };
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver_interface *div4;
/* ------------------------------------------------------------- */
static char *b1pciv4_procinfo(struct capi_ctr *ctrl) static char *b1pciv4_procinfo(struct capi_ctr *ctrl)
{ {
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
...@@ -274,7 +267,7 @@ static int b1pciv4_add_card(struct capi_driver *driver, ...@@ -274,7 +267,7 @@ static int b1pciv4_add_card(struct capi_driver *driver,
goto err_unmap; goto err_unmap;
} }
cinfo->capi_ctrl = div4->attach_ctr(driver, card->name, cinfo); cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo);
if (!cinfo->capi_ctrl) { if (!cinfo->capi_ctrl) {
printk(KERN_ERR "%s: attach controller failed.\n", driver->name); printk(KERN_ERR "%s: attach controller failed.\n", driver->name);
retval = -EBUSY; retval = -EBUSY;
...@@ -312,7 +305,7 @@ static void b1pciv4_remove_ctr(struct capi_ctr *ctrl) ...@@ -312,7 +305,7 @@ static void b1pciv4_remove_ctr(struct capi_ctr *ctrl)
b1dma_reset(card); b1dma_reset(card);
div4->detach_ctr(ctrl); detach_capi_ctr(ctrl);
free_irq(card->irq, card); free_irq(card->irq, card);
iounmap(card->mbase); iounmap(card->mbase);
release_region(card->port, AVMB1_PORTLEN); release_region(card->port, AVMB1_PORTLEN);
...@@ -327,20 +320,21 @@ static void b1pciv4_remove_ctr(struct capi_ctr *ctrl) ...@@ -327,20 +320,21 @@ static void b1pciv4_remove_ctr(struct capi_ctr *ctrl)
static struct capi_driver b1pciv4_driver = { static struct capi_driver b1pciv4_driver = {
name: "b1pciv4", owner: THIS_MODULE,
revision: "0.0", name: "b1pciv4",
load_firmware: b1dma_load_firmware, revision: "0.0",
reset_ctr: b1dma_reset_ctr, load_firmware: b1dma_load_firmware,
remove_ctr: b1pciv4_remove_ctr, reset_ctr: b1dma_reset_ctr,
register_appl: b1dma_register_appl, remove_ctr: b1pciv4_remove_ctr,
release_appl: b1dma_release_appl, register_appl: b1dma_register_appl,
send_message: b1dma_send_message, release_appl: b1dma_release_appl,
send_message: b1dma_send_message,
procinfo: b1pciv4_procinfo,
ctr_read_proc: b1dmactl_read_proc, procinfo: b1pciv4_procinfo,
driver_read_proc: 0, /* use standard driver_read_proc */ ctr_read_proc: b1dmactl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
add_card: 0, /* no add_card function */
}; };
#endif /* CONFIG_ISDN_DRV_AVMB1_B1PCIV4 */ #endif /* CONFIG_ISDN_DRV_AVMB1_B1PCIV4 */
...@@ -432,25 +426,12 @@ static int __init b1pci_init(void) ...@@ -432,25 +426,12 @@ static int __init b1pci_init(void)
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision); printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
di = attach_capi_driver(driver); attach_capi_driver(driver);
if (!di) {
printk(KERN_ERR "%s: failed to attach capi_driver\n",
driver->name);
MOD_DEC_USE_COUNT;
return -ENODEV;
}
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
printk(KERN_INFO "%s: revision %s\n", driverv4->name, driverv4->revision); printk(KERN_INFO "%s: revision %s\n", driverv4->name, driverv4->revision);
div4 = attach_capi_driver(driverv4); attach_capi_driver(driverv4);
if (!div4) {
detach_capi_driver(driver);
printk(KERN_ERR "%s: failed to attach capi_driver\n",
driverv4->name);
MOD_DEC_USE_COUNT;
return -ENODEV;
}
#endif #endif
ncards = pci_register_driver(&b1pci_pci_driver); ncards = pci_register_driver(&b1pci_pci_driver);
......
...@@ -35,10 +35,6 @@ MODULE_LICENSE("GPL"); ...@@ -35,10 +35,6 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver_interface *di;
/* ------------------------------------------------------------- */
static void b1pcmcia_remove_ctr(struct capi_ctr *ctrl) static void b1pcmcia_remove_ctr(struct capi_ctr *ctrl)
{ {
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
...@@ -48,7 +44,7 @@ static void b1pcmcia_remove_ctr(struct capi_ctr *ctrl) ...@@ -48,7 +44,7 @@ static void b1pcmcia_remove_ctr(struct capi_ctr *ctrl)
b1_reset(port); b1_reset(port);
b1_reset(port); b1_reset(port);
di->detach_ctr(ctrl); detach_capi_ctr(ctrl);
free_irq(card->irq, card); free_irq(card->irq, card);
b1_free_card(card); b1_free_card(card);
...@@ -103,7 +99,7 @@ static int b1pcmcia_add_card(struct capi_driver *driver, ...@@ -103,7 +99,7 @@ static int b1pcmcia_add_card(struct capi_driver *driver,
b1_reset(card->port); b1_reset(card->port);
b1_getrevision(card); b1_getrevision(card);
cinfo->capi_ctrl = di->attach_ctr(driver, card->name, cinfo); cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo);
if (!cinfo->capi_ctrl) { if (!cinfo->capi_ctrl) {
printk(KERN_ERR "%s: attach controller failed.\n", printk(KERN_ERR "%s: attach controller failed.\n",
driver->name); driver->name);
...@@ -152,20 +148,21 @@ static char *b1pcmcia_procinfo(struct capi_ctr *ctrl) ...@@ -152,20 +148,21 @@ static char *b1pcmcia_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver b1pcmcia_driver = { static struct capi_driver b1pcmcia_driver = {
name: "b1pcmcia", owner: THIS_MODULE,
revision: "0.0", name: "b1pcmcia",
load_firmware: b1_load_firmware, revision: "0.0",
reset_ctr: b1_reset_ctr, load_firmware: b1_load_firmware,
remove_ctr: b1pcmcia_remove_ctr, reset_ctr: b1_reset_ctr,
register_appl: b1_register_appl, remove_ctr: b1pcmcia_remove_ctr,
release_appl: b1_release_appl, register_appl: b1_register_appl,
send_message: b1_send_message, release_appl: b1_release_appl,
send_message: b1_send_message,
procinfo: b1pcmcia_procinfo,
ctr_read_proc: b1ctl_read_proc, procinfo: b1pcmcia_procinfo,
driver_read_proc: 0, /* use standard driver_read_proc */ ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0,
add_card: 0,
}; };
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
...@@ -187,10 +184,12 @@ int b1pcmcia_addcard_m2(unsigned int port, unsigned irq) ...@@ -187,10 +184,12 @@ int b1pcmcia_addcard_m2(unsigned int port, unsigned irq)
int b1pcmcia_delcard(unsigned int port, unsigned irq) int b1pcmcia_delcard(unsigned int port, unsigned irq)
{ {
struct list_head *l;
struct capi_ctr *ctrl; struct capi_ctr *ctrl;
avmcard *card; avmcard *card;
for (ctrl = b1pcmcia_driver.controller; ctrl; ctrl = ctrl->next) { list_for_each(l, &b1pcmcia_driver.contr_head) {
ctrl = list_entry(l, struct capi_ctr, driver_list);
card = ((avmctrl_info *)(ctrl->driverdata))->card; card = ((avmctrl_info *)(ctrl->driverdata))->card;
if (card->port == port && card->irq == irq) { if (card->port == port && card->irq == irq) {
b1pcmcia_remove_ctr(ctrl); b1pcmcia_remove_ctr(ctrl);
...@@ -224,13 +223,8 @@ static int __init b1pcmcia_init(void) ...@@ -224,13 +223,8 @@ static int __init b1pcmcia_init(void)
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision); printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
di = attach_capi_driver(driver); attach_capi_driver(driver);
if (!di) {
printk(KERN_ERR "%s: failed to attach capi_driver\n",
driver->name);
retval = -EIO;
}
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return retval; return retval;
} }
......
...@@ -52,10 +52,6 @@ MODULE_PARM(suppress_pollack, "0-1i"); ...@@ -52,10 +52,6 @@ MODULE_PARM(suppress_pollack, "0-1i");
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver_interface *di;
/* ------------------------------------------------------------- */
static void c4_dispatch_tx(avmcard *card); static void c4_dispatch_tx(avmcard *card);
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
...@@ -587,12 +583,6 @@ static void c4_handle_rx(avmcard *card) ...@@ -587,12 +583,6 @@ static void c4_handle_rx(avmcard *card)
ctrl = card->ctrlinfo[cidx].capi_ctrl; ctrl = card->ctrlinfo[cidx].capi_ctrl;
if (ctrl) if (ctrl)
ctrl->free_ncci(ctrl, ApplId, NCCI); ctrl->free_ncci(ctrl, ApplId, NCCI);
} else {
for (cidx=0; cidx < 4; cidx++) {
ctrl = card->ctrlinfo[cidx].capi_ctrl;
if (ctrl)
ctrl->appl_released(ctrl, ApplId);
}
} }
break; break;
...@@ -918,7 +908,7 @@ static void c4_remove_ctr(struct capi_ctr *ctrl) ...@@ -918,7 +908,7 @@ static void c4_remove_ctr(struct capi_ctr *ctrl)
for (i=0; i < 4; i++) { for (i=0; i < 4; i++) {
cinfo = &card->ctrlinfo[i]; cinfo = &card->ctrlinfo[i];
if (cinfo->capi_ctrl) { if (cinfo->capi_ctrl) {
di->detach_ctr(cinfo->capi_ctrl); detach_capi_ctr(cinfo->capi_ctrl);
cinfo->capi_ctrl = NULL; cinfo->capi_ctrl = NULL;
} }
} }
...@@ -973,8 +963,6 @@ void c4_register_appl(struct capi_ctr *ctrl, ...@@ -973,8 +963,6 @@ void c4_register_appl(struct capi_ctr *ctrl,
skb_queue_tail(&card->dma->send_queue, skb); skb_queue_tail(&card->dma->send_queue, skb);
c4_dispatch_tx(card); c4_dispatch_tx(card);
} }
ctrl->appl_registered(ctrl, appl);
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
...@@ -1170,13 +1158,13 @@ static int c4_add_card(struct capi_driver *driver, ...@@ -1170,13 +1158,13 @@ static int c4_add_card(struct capi_driver *driver,
for (i=0; i < nr_controllers ; i++) { for (i=0; i < nr_controllers ; i++) {
cinfo = &card->ctrlinfo[i]; cinfo = &card->ctrlinfo[i];
cinfo->capi_ctrl = di->attach_ctr(driver, card->name, cinfo); cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo);
if (!cinfo->capi_ctrl) { if (!cinfo->capi_ctrl) {
printk(KERN_ERR "%s: attach controller failed (%d).\n", printk(KERN_ERR "%s: attach controller failed (%d).\n",
driver->name, i); driver->name, i);
for (i--; i >= 0; i--) { for (i--; i >= 0; i--) {
cinfo = &card->ctrlinfo[i]; cinfo = &card->ctrlinfo[i];
di->detach_ctr(cinfo->capi_ctrl); detach_capi_ctr(cinfo->capi_ctrl);
} }
goto err_free_irq; goto err_free_irq;
} }
...@@ -1208,37 +1196,39 @@ static int c4_add_card(struct capi_driver *driver, ...@@ -1208,37 +1196,39 @@ static int c4_add_card(struct capi_driver *driver,
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver c2_driver = { static struct capi_driver c2_driver = {
name: "c2", owner: THIS_MODULE,
revision: "0.0", name: "c2",
load_firmware: c4_load_firmware, revision: "0.0",
reset_ctr: c4_reset_ctr, load_firmware: c4_load_firmware,
remove_ctr: c4_remove_ctr, reset_ctr: c4_reset_ctr,
register_appl: c4_register_appl, remove_ctr: c4_remove_ctr,
release_appl: c4_release_appl, register_appl: c4_register_appl,
send_message: c4_send_message, release_appl: c4_release_appl,
send_message: c4_send_message,
procinfo: c4_procinfo,
ctr_read_proc: c4_read_proc, procinfo: c4_procinfo,
driver_read_proc: 0, /* use standard driver_read_proc */ ctr_read_proc: c4_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
add_card: 0, /* no add_card function */
}; };
static struct capi_driver c4_driver = { static struct capi_driver c4_driver = {
name: "c4", owner: THIS_MODULE,
revision: "0.0", name: "c4",
load_firmware: c4_load_firmware, revision: "0.0",
reset_ctr: c4_reset_ctr, load_firmware: c4_load_firmware,
remove_ctr: c4_remove_ctr, reset_ctr: c4_reset_ctr,
register_appl: c4_register_appl, remove_ctr: c4_remove_ctr,
release_appl: c4_release_appl, register_appl: c4_register_appl,
send_message: c4_send_message, release_appl: c4_release_appl,
send_message: c4_send_message,
procinfo: c4_procinfo,
ctr_read_proc: c4_read_proc, procinfo: c4_procinfo,
driver_read_proc: 0, /* use standard driver_read_proc */ ctr_read_proc: c4_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
add_card: 0, /* no add_card function */
}; };
static int c4_attach_driver (struct capi_driver * driver) static int c4_attach_driver (struct capi_driver * driver)
...@@ -1253,13 +1243,7 @@ static int c4_attach_driver (struct capi_driver * driver) ...@@ -1253,13 +1243,7 @@ static int c4_attach_driver (struct capi_driver * driver)
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision); printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
di = attach_capi_driver(driver); attach_capi_driver(driver);
if (!di) {
printk(KERN_ERR "%s: failed to attach capi_driver\n",
driver->name);
MOD_DEC_USE_COUNT;
return -ENODEV;
}
return 0; return 0;
} }
......
...@@ -35,10 +35,6 @@ MODULE_LICENSE("GPL"); ...@@ -35,10 +35,6 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver_interface *di;
/* ------------------------------------------------------------- */
static int hema_irq_table[16] = static int hema_irq_table[16] =
{0, {0,
0, 0,
...@@ -199,7 +195,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs) ...@@ -199,7 +195,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
if (NCCI != 0xffffffff) if (NCCI != 0xffffffff)
ctrl->free_ncci(ctrl, ApplId, NCCI); ctrl->free_ncci(ctrl, ApplId, NCCI);
else ctrl->appl_released(ctrl, ApplId);
break; break;
case RECEIVE_START: case RECEIVE_START:
...@@ -331,7 +327,7 @@ static void t1isa_remove_ctr(struct capi_ctr *ctrl) ...@@ -331,7 +327,7 @@ static void t1isa_remove_ctr(struct capi_ctr *ctrl)
b1_reset(port); b1_reset(port);
t1_reset(port); t1_reset(port);
di->detach_ctr(ctrl); detach_capi_ctr(ctrl);
free_irq(card->irq, card); free_irq(card->irq, card);
release_region(card->port, AVMB1_PORTLEN); release_region(card->port, AVMB1_PORTLEN);
b1_free_card(card); b1_free_card(card);
...@@ -344,6 +340,7 @@ static void t1isa_remove_ctr(struct capi_ctr *ctrl) ...@@ -344,6 +340,7 @@ static void t1isa_remove_ctr(struct capi_ctr *ctrl)
static int t1isa_add_card(struct capi_driver *driver, struct capicardparams *p) static int t1isa_add_card(struct capi_driver *driver, struct capicardparams *p)
{ {
struct capi_ctr *ctrl; struct capi_ctr *ctrl;
struct list_head *l;
avmctrl_info *cinfo; avmctrl_info *cinfo;
avmcard *card; avmcard *card;
int retval; int retval;
...@@ -376,8 +373,11 @@ static int t1isa_add_card(struct capi_driver *driver, struct capicardparams *p) ...@@ -376,8 +373,11 @@ static int t1isa_add_card(struct capi_driver *driver, struct capicardparams *p)
retval = -EINVAL; retval = -EINVAL;
goto err_free; goto err_free;
} }
for (ctrl = driver->controller; ctrl; ctrl = ctrl->next) { list_for_each(l, &driver->contr_head) {
avmcard *cardp = ((avmctrl_info *)(ctrl->driverdata))->card; avmcard *cardp;
ctrl = list_entry(l, struct capi_ctr, driver_list);
cardp = ((avmctrl_info *)(ctrl->driverdata))->card;
if (cardp->cardnr == card->cardnr) { if (cardp->cardnr == card->cardnr) {
printk(KERN_WARNING "%s: card with number %d already installed at 0x%x.\n", printk(KERN_WARNING "%s: card with number %d already installed at 0x%x.\n",
driver->name, card->cardnr, cardp->port); driver->name, card->cardnr, cardp->port);
...@@ -408,7 +408,7 @@ static int t1isa_add_card(struct capi_driver *driver, struct capicardparams *p) ...@@ -408,7 +408,7 @@ static int t1isa_add_card(struct capi_driver *driver, struct capicardparams *p)
t1_disable_irq(card->port); t1_disable_irq(card->port);
b1_reset(card->port); b1_reset(card->port);
cinfo->capi_ctrl = di->attach_ctr(driver, card->name, cinfo); cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo);
if (!cinfo->capi_ctrl) { if (!cinfo->capi_ctrl) {
printk(KERN_ERR "%s: attach controller failed.\n", printk(KERN_ERR "%s: attach controller failed.\n",
driver->name); driver->name);
...@@ -479,20 +479,21 @@ static char *t1isa_procinfo(struct capi_ctr *ctrl) ...@@ -479,20 +479,21 @@ static char *t1isa_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver t1isa_driver = { static struct capi_driver t1isa_driver = {
name: "t1isa", owner: THIS_MODULE,
revision: "0.0", name: "t1isa",
load_firmware: t1isa_load_firmware, revision: "0.0",
reset_ctr: t1isa_reset_ctr, load_firmware: t1isa_load_firmware,
remove_ctr: t1isa_remove_ctr, reset_ctr: t1isa_reset_ctr,
register_appl: b1_register_appl, remove_ctr: t1isa_remove_ctr,
release_appl: b1_release_appl, register_appl: b1_register_appl,
send_message: t1isa_send_message, release_appl: b1_release_appl,
send_message: t1isa_send_message,
procinfo: t1isa_procinfo,
ctr_read_proc: b1ctl_read_proc, procinfo: t1isa_procinfo,
driver_read_proc: 0, /* use standard driver_read_proc */ ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: t1isa_add_card,
add_card: t1isa_add_card,
}; };
static int __init t1isa_init(void) static int __init t1isa_init(void)
...@@ -512,13 +513,7 @@ static int __init t1isa_init(void) ...@@ -512,13 +513,7 @@ static int __init t1isa_init(void)
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision); printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
di = attach_capi_driver(driver); attach_capi_driver(driver);
if (!di) {
printk(KERN_ERR "%s: failed to attach capi_driver\n",
driver->name);
retval = -EIO;
}
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return retval; return retval;
......
...@@ -45,10 +45,6 @@ MODULE_LICENSE("GPL"); ...@@ -45,10 +45,6 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver_interface *di;
/* ------------------------------------------------------------- */
static int t1pci_add_card(struct capi_driver *driver, static int t1pci_add_card(struct capi_driver *driver,
struct capicardparams *p, struct capicardparams *p,
struct pci_dev *dev) struct pci_dev *dev)
...@@ -119,7 +115,7 @@ static int t1pci_add_card(struct capi_driver *driver, ...@@ -119,7 +115,7 @@ static int t1pci_add_card(struct capi_driver *driver,
goto err_unmap; goto err_unmap;
} }
cinfo->capi_ctrl = di->attach_ctr(driver, card->name, cinfo); cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo);
if (!cinfo->capi_ctrl) { if (!cinfo->capi_ctrl) {
printk(KERN_ERR "%s: attach controller failed.\n", driver->name); printk(KERN_ERR "%s: attach controller failed.\n", driver->name);
retval = -EBUSY; retval = -EBUSY;
...@@ -157,7 +153,7 @@ static void t1pci_remove_ctr(struct capi_ctr *ctrl) ...@@ -157,7 +153,7 @@ static void t1pci_remove_ctr(struct capi_ctr *ctrl)
b1dma_reset(card); b1dma_reset(card);
di->detach_ctr(ctrl); detach_capi_ctr(ctrl);
free_irq(card->irq, card); free_irq(card->irq, card);
iounmap(card->mbase); iounmap(card->mbase);
release_region(card->port, AVMB1_PORTLEN); release_region(card->port, AVMB1_PORTLEN);
...@@ -189,20 +185,21 @@ static char *t1pci_procinfo(struct capi_ctr *ctrl) ...@@ -189,20 +185,21 @@ static char *t1pci_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static struct capi_driver t1pci_driver = { static struct capi_driver t1pci_driver = {
name: "t1pci", owner: THIS_MODULE,
revision: "0.0", name: "t1pci",
load_firmware: b1dma_load_firmware, revision: "0.0",
reset_ctr: b1dma_reset_ctr, load_firmware: b1dma_load_firmware,
remove_ctr: t1pci_remove_ctr, reset_ctr: b1dma_reset_ctr,
register_appl: b1dma_register_appl, remove_ctr: t1pci_remove_ctr,
release_appl: b1dma_release_appl, register_appl: b1dma_register_appl,
send_message: b1dma_send_message, release_appl: b1dma_release_appl,
send_message: b1dma_send_message,
procinfo: t1pci_procinfo,
ctr_read_proc: b1dmactl_read_proc, procinfo: t1pci_procinfo,
driver_read_proc: 0, /* use standard driver_read_proc */ ctr_read_proc: b1dmactl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
add_card: 0, /* no add_card function */
}; };
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
...@@ -261,13 +258,7 @@ static int __init t1pci_init(void) ...@@ -261,13 +258,7 @@ static int __init t1pci_init(void)
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision); printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
di = attach_capi_driver(&t1pci_driver); attach_capi_driver(&t1pci_driver);
if (!di) {
printk(KERN_ERR "%s: failed to attach capi_driver\n",
driver->name);
MOD_DEC_USE_COUNT;
return -EIO;
}
ncards = pci_register_driver(&t1pci_pci_driver); ncards = pci_register_driver(&t1pci_pci_driver);
if (ncards) { if (ncards) {
......
...@@ -98,7 +98,7 @@ hycapi_remove_ctr(struct capi_ctr *ctrl) ...@@ -98,7 +98,7 @@ hycapi_remove_ctr(struct capi_ctr *ctrl)
hycapi_applications[i].listen_req[ctrl->cnr-1] = NULL; hycapi_applications[i].listen_req[ctrl->cnr-1] = NULL;
} }
} }
hy_di->detach_ctr(ctrl); detach_capi_ctr(ctrl);
ctrl->driverdata = 0; ctrl->driverdata = 0;
kfree(card->hyctrlinfo); kfree(card->hyctrlinfo);
...@@ -252,7 +252,6 @@ hycapi_register_appl(struct capi_ctr *ctrl, __u16 appl, ...@@ -252,7 +252,6 @@ hycapi_register_appl(struct capi_ctr *ctrl, __u16 appl,
rp, sizeof(capi_register_params)); rp, sizeof(capi_register_params));
/* MOD_INC_USE_COUNT; */ /* MOD_INC_USE_COUNT; */
ctrl->appl_registered(ctrl, appl);
} }
/********************************************************************* /*********************************************************************
...@@ -313,7 +312,6 @@ hycapi_release_appl(struct capi_ctr *ctrl, __u16 appl) ...@@ -313,7 +312,6 @@ hycapi_release_appl(struct capi_ctr *ctrl, __u16 appl)
{ {
hycapi_release_internal(ctrl, appl); hycapi_release_internal(ctrl, appl);
} }
ctrl->appl_released(ctrl, appl);
/* MOD_DEC_USE_COUNT; */ /* MOD_DEC_USE_COUNT; */
} }
...@@ -666,18 +664,21 @@ hycapi_tx_capiget(hysdn_card *card) ...@@ -666,18 +664,21 @@ hycapi_tx_capiget(hysdn_card *card)
static struct capi_driver hycapi_driver = { static struct capi_driver hycapi_driver = {
"hysdn", owner: THIS_MODULE,
"0.0", name: "hysdn",
hycapi_load_firmware, revision: "0.0",
hycapi_reset_ctr, load_firmware: hycapi_load_firmware,
hycapi_remove_ctr, reset_ctr: hycapi_reset_ctr,
hycapi_register_appl, remove_ctr: hycapi_remove_ctr,
hycapi_release_appl, register_appl: hycapi_register_appl,
hycapi_send_message, release_appl: hycapi_release_appl,
hycapi_procinfo, send_message: hycapi_send_message,
hycapi_read_proc,
0, /* use standard driver_read_proc */ procinfo: hycapi_procinfo,
0, /* no add_card function */ ctr_read_proc: hycapi_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
}; };
...@@ -698,11 +699,8 @@ int hycapi_init() ...@@ -698,11 +699,8 @@ int hycapi_init()
} }
driver = &hycapi_driver; driver = &hycapi_driver;
printk(KERN_NOTICE "HYSDN: Attaching capi-driver\n"); printk(KERN_NOTICE "HYSDN: Attaching capi-driver\n");
hy_di = attach_capi_driver(driver); attach_capi_driver(driver);
if (!hy_di) {
printk(KERN_ERR "HYCAPI: failed to attach capi_driver\n");
return(-1);
}
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));
} }
...@@ -798,8 +796,8 @@ hycapi_capi_create(hysdn_card *card) ...@@ -798,8 +796,8 @@ hycapi_capi_create(hysdn_card *card)
default: strcpy(cinfo->cardname,"HYSDN ???"); break; default: strcpy(cinfo->cardname,"HYSDN ???"); break;
} }
cinfo->capi_ctrl = hy_di->attach_ctr(&hycapi_driver, cinfo->capi_ctrl = attach_capi_ctr(&hycapi_driver,
cinfo->cardname, cinfo); cinfo->cardname, cinfo);
ctrl = cinfo->capi_ctrl; ctrl = cinfo->capi_ctrl;
if (!ctrl) { if (!ctrl) {
printk(KERN_ERR "%s: attach controller failed.\n", printk(KERN_ERR "%s: attach controller failed.\n",
......
/* $Id: capidev.h,v 1.6.6.2 2001/09/23 22:24:33 kai Exp $
*
* CAPI 2.0 Interface for Linux
*
* Copyright 1996 by Carsten Paeth <calle@calle.de>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
struct capidev {
struct capidev *next;
struct file *file;
__u16 applid;
__u16 errcode;
unsigned int minor;
struct sk_buff_head recv_queue;
wait_queue_head_t recv_wait;
/* Statistic */
unsigned long nrecvctlpkt;
unsigned long nrecvdatapkt;
unsigned long nsentctlpkt;
unsigned long nsentdatapkt;
};
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#ifndef __CAPILLI_H__ #ifndef __CAPILLI_H__
#define __CAPILLI_H__ #define __CAPILLI_H__
#include <linux/list.h>
typedef struct capiloaddatapart { typedef struct capiloaddatapart {
int user; /* data in userspace ? */ int user; /* data in userspace ? */
int len; int len;
...@@ -34,7 +36,7 @@ typedef struct capicardparams { ...@@ -34,7 +36,7 @@ typedef struct capicardparams {
struct capi_driver; struct capi_driver;
struct capi_ctr { struct capi_ctr {
struct capi_ctr *next; /* next ctr of same driver */ struct list_head driver_list; /* contrs by driver */
struct capi_driver *driver; struct capi_driver *driver;
int cnr; /* controller number */ int cnr; /* controller number */
char name[32]; /* name of controller */ char name[32]; /* name of controller */
...@@ -57,8 +59,6 @@ struct capi_ctr { ...@@ -57,8 +59,6 @@ struct capi_ctr {
void (*resume_output)(struct capi_ctr * card); void (*resume_output)(struct capi_ctr * card);
void (*handle_capimsg)(struct capi_ctr * card, void (*handle_capimsg)(struct capi_ctr * card,
__u16 appl, struct sk_buff *skb); __u16 appl, struct sk_buff *skb);
void (*appl_registered)(struct capi_ctr * card, __u16 appl);
void (*appl_released)(struct capi_ctr * card, __u16 appl);
void (*new_ncci)(struct capi_ctr * card, void (*new_ncci)(struct capi_ctr * card,
__u16 appl, __u32 ncci, __u32 winsize); __u16 appl, __u32 ncci, __u32 winsize);
...@@ -75,39 +75,38 @@ struct capi_ctr { ...@@ -75,39 +75,38 @@ struct capi_ctr {
char procfn[128]; char procfn[128];
}; };
struct capi_driver_interface {
struct capi_ctr *(*attach_ctr)(struct capi_driver *driver, char *name, void *data);
int (*detach_ctr)(struct capi_ctr *);
};
struct capi_driver { struct capi_driver {
char name[32]; /* driver name */ struct module *owner;
char revision[32]; char name[32]; /* driver name */
int (*load_firmware)(struct capi_ctr *, capiloaddata *); char revision[32];
void (*reset_ctr)(struct capi_ctr *); int (*load_firmware)(struct capi_ctr *, capiloaddata *);
void (*remove_ctr)(struct capi_ctr *); void (*reset_ctr)(struct capi_ctr *);
void (*register_appl)(struct capi_ctr *, __u16 appl, void (*remove_ctr)(struct capi_ctr *);
capi_register_params *); void (*register_appl)(struct capi_ctr *, __u16 appl,
void (*release_appl)(struct capi_ctr *, __u16 appl); capi_register_params *);
void (*send_message)(struct capi_ctr *, struct sk_buff *skb); void (*release_appl)(struct capi_ctr *, __u16 appl);
void (*send_message)(struct capi_ctr *, struct sk_buff *skb);
char *(*procinfo)(struct capi_ctr *);
int (*ctr_read_proc)(char *page, char **start, off_t off, char *(*procinfo)(struct capi_ctr *);
int count, int *eof, struct capi_ctr *card); int (*ctr_read_proc)(char *page, char **start, off_t off,
int (*driver_read_proc)(char *page, char **start, off_t off, int count, int *eof, struct capi_ctr *card);
int count, int *eof, struct capi_driver *driver); int (*driver_read_proc)(char *page, char **start, off_t off,
int count, int *eof, struct capi_driver *driver);
int (*add_card)(struct capi_driver *driver, capicardparams *data);
int (*add_card)(struct capi_driver *driver, capicardparams *data);
/* intitialized by kcapi */
struct capi_ctr *controller; /* list of controllers */ /* intitialized by kcapi */
struct capi_driver *next; struct list_head contr_head; /* list of controllers */
int ncontroller; struct list_head driver_list;
struct proc_dir_entry *procent; int ncontroller;
char procfn[128]; struct proc_dir_entry *procent;
char procfn[128];
}; };
struct capi_driver_interface *attach_capi_driver(struct capi_driver *driver); void attach_capi_driver(struct capi_driver *driver);
void detach_capi_driver(struct capi_driver *driver); void detach_capi_driver(struct capi_driver *driver);
struct capi_ctr *attach_capi_ctr(struct capi_driver *driver, char *name, void *data);
int detach_capi_ctr(struct capi_ctr *);
#endif /* __CAPILLI_H__ */ #endif /* __CAPILLI_H__ */
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#ifndef __KERNELCAPI_H__ #ifndef __KERNELCAPI_H__
#define __KERNELCAPI_H__ #define __KERNELCAPI_H__
#include <linux/list.h>
#define CAPI_MAXAPPL 128 /* maximum number of applications */ #define CAPI_MAXAPPL 128 /* maximum number of applications */
#define CAPI_MAXCONTR 16 /* maximum number of controller */ #define CAPI_MAXCONTR 16 /* maximum number of controller */
#define CAPI_MAXDATAWINDOW 8 #define CAPI_MAXDATAWINDOW 8
...@@ -81,7 +83,7 @@ struct capi_interface_user { ...@@ -81,7 +83,7 @@ struct capi_interface_user {
char name[20]; char name[20];
void (*callback) (unsigned int cmd, __u32 contr, void *data); void (*callback) (unsigned int cmd, __u32 contr, void *data);
/* internal */ /* internal */
struct capi_interface_user *next; struct list_head user_list;
}; };
struct capi_interface *attach_capi_interface(struct capi_interface_user *); struct capi_interface *attach_capi_interface(struct capi_interface_user *);
......
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