Commit 5120022f authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/CAPI: Move methods from capi_driver to capi_ctr

parent 664fd502
......@@ -77,8 +77,8 @@ static struct tq_struct tq_recv_notify;
static inline struct capi_ctr *
capi_ctr_get(struct capi_ctr *card)
{
if (card->driver->owner) {
if (try_inc_mod_count(card->driver->owner)) {
if (card->owner) {
if (try_inc_mod_count(card->owner)) {
DBG("MOD_COUNT INC");
return card;
} else
......@@ -91,8 +91,8 @@ capi_ctr_get(struct capi_ctr *card)
static inline void
capi_ctr_put(struct capi_ctr *card)
{
if (card->driver->owner)
__MOD_DEC_USE_COUNT(card->driver->owner);
if (card->owner)
__MOD_DEC_USE_COUNT(card->owner);
DBG("MOD_COUNT DEC");
}
......@@ -157,7 +157,7 @@ static void register_appl(struct capi_ctr *card, u16 applid, capi_register_param
{
card = capi_ctr_get(card);
card->driver->register_appl(card, applid, rparam);
card->register_appl(card, applid, rparam);
}
......@@ -165,7 +165,7 @@ static void release_appl(struct capi_ctr *card, u16 applid)
{
DBG("applid %#x", applid);
card->driver->release_appl(card, applid);
card->release_appl(card, applid);
capi_ctr_put(card);
}
......@@ -471,7 +471,7 @@ attach_capi_ctr(struct capi_ctr *card)
if (card->procent) {
card->procent->read_proc =
(int (*)(char *,char **,off_t,int,int *,void *))
card->driver->ctr_read_proc;
card->ctr_read_proc;
card->procent->data = card;
}
......@@ -659,7 +659,7 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
}
}
return card->driver->send_message(card, skb);
return card->send_message(card, skb);
}
EXPORT_SYMBOL(capi20_put_message);
......@@ -782,7 +782,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
card = capi_ctr_get(card);
if (!card)
return -ESRCH;
if (card->driver->load_firmware == 0) {
if (card->load_firmware == 0) {
printk(KERN_DEBUG "kcapi: load: driver \%s\" has no load function\n", card->driver->name);
return -ESRCH;
}
......@@ -809,7 +809,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
}
card->cardstate = CARD_LOADING;
retval = card->driver->load_firmware(card, &ldata);
retval = card->load_firmware(card, &ldata);
if (retval) {
card->cardstate = CARD_DETECTED;
......@@ -840,7 +840,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
if (card->cardstate == CARD_DETECTED)
return 0;
card->driver->reset_ctr(card);
card->reset_ctr(card);
while (card->cardstate > CARD_DETECTED) {
......
......@@ -104,7 +104,7 @@ static int controller_show(struct seq_file *seq, void *v)
ctr->cnr, ctr->driver->name,
cardstate2str(ctr->cardstate),
ctr->name,
ctr->driver->procinfo ? ctr->driver->procinfo(ctr) : "");
ctr->procinfo ? ctr->procinfo(ctr) : "");
return 0;
}
......
......@@ -54,6 +54,8 @@ static void b1isa_remove(struct pci_dev *pdev)
/* ------------------------------------------------------------- */
static char *b1isa_procinfo(struct capi_ctr *ctrl);
static int __init b1isa_probe(struct pci_dev *pdev)
{
avmctrl_info *cinfo;
......@@ -108,7 +110,16 @@ static int __init b1isa_probe(struct pci_dev *pdev)
cinfo->capi_ctrl.driver = &b1isa_driver;
cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = b1_register_appl;
cinfo->capi_ctrl.release_appl = b1_release_appl;
cinfo->capi_ctrl.send_message = b1_send_message;
cinfo->capi_ctrl.load_firmware = b1_load_firmware;
cinfo->capi_ctrl.reset_ctr = b1_reset_ctr;
cinfo->capi_ctrl.procinfo = b1isa_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "b1isa: attach controller failed.\n");
......@@ -151,17 +162,8 @@ static char *b1isa_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static struct capi_driver b1isa_driver = {
owner: THIS_MODULE,
name: "b1isa",
revision: "0.0",
load_firmware: b1_load_firmware,
reset_ctr: b1_reset_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: b1_send_message,
procinfo: b1isa_procinfo,
ctr_read_proc: b1ctl_read_proc,
};
#define MAX_CARDS 4
......
......@@ -109,7 +109,16 @@ static int b1pci_probe(struct capi_driver *driver,
cinfo->capi_ctrl.driver = driver;
cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = b1_register_appl;
cinfo->capi_ctrl.release_appl = b1_release_appl;
cinfo->capi_ctrl.send_message = b1_send_message;
cinfo->capi_ctrl.load_firmware = b1_load_firmware;
cinfo->capi_ctrl.reset_ctr = b1_reset_ctr;
cinfo->capi_ctrl.procinfo = b1pci_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "%s: attach controller failed.\n",
......@@ -158,17 +167,8 @@ static void b1pci_remove(struct pci_dev *pdev)
/* ------------------------------------------------------------- */
static struct capi_driver b1pci_driver = {
owner: THIS_MODULE,
name: "b1pci",
revision: "0.0",
load_firmware: b1_load_firmware,
reset_ctr: b1_reset_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: b1_send_message,
procinfo: b1pci_procinfo,
ctr_read_proc: b1ctl_read_proc,
};
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
......@@ -260,7 +260,16 @@ static int b1pciv4_probe(struct capi_driver *driver,
cinfo->capi_ctrl.driver = driver;
cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = b1dma_register_appl;
cinfo->capi_ctrl.release_appl = b1dma_release_appl;
cinfo->capi_ctrl.send_message = b1dma_send_message;
cinfo->capi_ctrl.load_firmware = b1dma_load_firmware;
cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr;
cinfo->capi_ctrl.procinfo = b1pciv4_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1dmactl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "%s: attach controller failed.\n", driver->name);
......@@ -310,17 +319,8 @@ static void b1pciv4_remove(struct pci_dev *pdev)
static struct capi_driver b1pciv4_driver = {
owner: THIS_MODULE,
name: "b1pciv4",
revision: "0.0",
load_firmware: b1dma_load_firmware,
reset_ctr: b1dma_reset_ctr,
register_appl: b1dma_register_appl,
release_appl: b1dma_release_appl,
send_message: b1dma_send_message,
procinfo: b1pciv4_procinfo,
ctr_read_proc: b1dmactl_read_proc,
};
#endif /* CONFIG_ISDN_DRV_AVMB1_B1PCIV4 */
......
......@@ -51,6 +51,8 @@ static void b1pcmcia_remove_ctr(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static char *b1pcmcia_procinfo(struct capi_ctr *ctrl);
static int b1pcmcia_add_card(struct capi_driver *driver,
unsigned int port,
unsigned irq,
......@@ -97,7 +99,16 @@ static int b1pcmcia_add_card(struct capi_driver *driver,
cinfo->capi_ctrl.driver = driver;
cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = b1_register_appl;
cinfo->capi_ctrl.release_appl = b1_release_appl;
cinfo->capi_ctrl.send_message = b1_send_message;
cinfo->capi_ctrl.load_firmware = b1_load_firmware;
cinfo->capi_ctrl.reset_ctr = b1_reset_ctr;
cinfo->capi_ctrl.procinfo = b1pcmcia_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "%s: attach controller failed.\n",
......@@ -145,17 +156,8 @@ static char *b1pcmcia_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static struct capi_driver b1pcmcia_driver = {
owner: THIS_MODULE,
name: "b1pcmcia",
revision: "0.0",
load_firmware: b1_load_firmware,
reset_ctr: b1_reset_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: b1_send_message,
procinfo: b1pcmcia_procinfo,
ctr_read_proc: b1ctl_read_proc,
};
/* ------------------------------------------------------------- */
......
......@@ -1165,7 +1165,16 @@ static int c4_add_card(struct capi_driver *driver,
cinfo = &card->ctrlinfo[i];
cinfo->capi_ctrl.driver = driver;
cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = c4_register_appl;
cinfo->capi_ctrl.release_appl = c4_release_appl;
cinfo->capi_ctrl.send_message = c4_send_message;
cinfo->capi_ctrl.load_firmware = c4_load_firmware;
cinfo->capi_ctrl.reset_ctr = c4_reset_ctr;
cinfo->capi_ctrl.procinfo = c4_procinfo;
cinfo->capi_ctrl.ctr_read_proc = c4_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "%s: attach controller failed (%d).\n",
......@@ -1203,31 +1212,13 @@ static int c4_add_card(struct capi_driver *driver,
/* ------------------------------------------------------------- */
static struct capi_driver c2_driver = {
owner: THIS_MODULE,
name: "c2",
revision: "0.0",
load_firmware: c4_load_firmware,
reset_ctr: c4_reset_ctr,
register_appl: c4_register_appl,
release_appl: c4_release_appl,
send_message: c4_send_message,
procinfo: c4_procinfo,
ctr_read_proc: c4_read_proc,
};
static struct capi_driver c4_driver = {
owner: THIS_MODULE,
name: "c4",
revision: "0.0",
load_firmware: c4_load_firmware,
reset_ctr: c4_reset_ctr,
register_appl: c4_register_appl,
release_appl: c4_release_appl,
send_message: c4_send_message,
procinfo: c4_procinfo,
ctr_read_proc: c4_read_proc,
};
static int __devinit c4_probe(struct pci_dev *dev,
......
......@@ -345,6 +345,9 @@ static void t1isa_remove(struct pci_dev *pdev)
/* ------------------------------------------------------------- */
static u16 t1isa_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
static char *t1isa_procinfo(struct capi_ctr *ctrl);
static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
{
avmctrl_info *cinfo;
......@@ -402,7 +405,16 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
cinfo->capi_ctrl.driver = &t1isa_driver;
cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = b1_register_appl;
cinfo->capi_ctrl.release_appl = b1_release_appl;
cinfo->capi_ctrl.send_message = t1isa_send_message;
cinfo->capi_ctrl.load_firmware = t1isa_load_firmware;
cinfo->capi_ctrl.reset_ctr = t1isa_reset_ctr;
cinfo->capi_ctrl.procinfo = t1isa_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_INFO "%s: attach controller failed.\n",
......@@ -488,17 +500,8 @@ static char *t1isa_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static struct capi_driver t1isa_driver = {
owner: THIS_MODULE,
name: "t1isa",
revision: "0.0",
load_firmware: t1isa_load_firmware,
reset_ctr: t1isa_reset_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: t1isa_send_message,
procinfo: t1isa_procinfo,
ctr_read_proc: b1ctl_read_proc,
};
#define MAX_CARDS 4
......
......@@ -45,6 +45,8 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */
static char *t1pci_procinfo(struct capi_ctr *ctrl);
static int t1pci_add_card(struct capi_driver *driver,
struct capicardparams *p,
struct pci_dev *pdev)
......@@ -115,7 +117,16 @@ static int t1pci_add_card(struct capi_driver *driver,
cinfo->capi_ctrl.driver = driver;
cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = b1dma_register_appl;
cinfo->capi_ctrl.release_appl = b1dma_release_appl;
cinfo->capi_ctrl.send_message = b1dma_send_message;
cinfo->capi_ctrl.load_firmware = b1dma_load_firmware;
cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr;
cinfo->capi_ctrl.procinfo = t1pci_procinfo;
cinfo->capi_ctrl.ctr_read_proc = b1dmactl_read_proc;
strcpy(cinfo->capi_ctrl.name, card->name);
SET_MODULE_OWNER(&cinfo->capi_ctrl);
retval = attach_capi_ctr(&cinfo->capi_ctrl);
if (retval) {
printk(KERN_ERR "%s: attach controller failed.\n", driver->name);
......@@ -183,17 +194,8 @@ static char *t1pci_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static struct capi_driver t1pci_driver = {
owner: THIS_MODULE,
name: "t1pci",
revision: "0.0",
load_firmware: b1dma_load_firmware,
reset_ctr: b1dma_reset_ctr,
register_appl: b1dma_register_appl,
release_appl: b1dma_release_appl,
send_message: b1dma_send_message,
procinfo: t1pci_procinfo,
ctr_read_proc: b1dmactl_read_proc,
};
/* ------------------------------------------------------------- */
......
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