Commit d38c8475 authored by Jeff Garzik's avatar Jeff Garzik Committed by Jeff Garzik

[ISDN] HiSax: modularization prep

Pass a function pointer into the core HiSax probe function checkcard(),
in order to facilitate modular drivers passing in their own setup
routines.
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 3925e6fc
...@@ -1169,7 +1169,9 @@ static int hisax_cs_setup(int cardnr, struct IsdnCard *card, ...@@ -1169,7 +1169,9 @@ static int hisax_cs_setup(int cardnr, struct IsdnCard *card,
/* Used from an exported function but calls __devinit functions. /* Used from an exported function but calls __devinit functions.
* Tell modpost not to warn (__ref) * Tell modpost not to warn (__ref)
*/ */
static int __ref checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner) static int __ref checkcard(int cardnr, char *id, int *busy_flag,
struct module *lockowner,
hisax_setup_func_t card_setup)
{ {
int ret; int ret;
struct IsdnCard *card = cards + cardnr; struct IsdnCard *card = cards + cardnr;
...@@ -1187,7 +1189,7 @@ static int __ref checkcard(int cardnr, char *id, int *busy_flag, struct module * ...@@ -1187,7 +1189,7 @@ static int __ref checkcard(int cardnr, char *id, int *busy_flag, struct module *
(card->protocol == ISDN_PTYPE_NI1) ? "NI1" : (card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
"NONE", cs->iif.id, cs->myid); "NONE", cs->iif.id, cs->myid);
ret = hisax_cs_setup_card(card); ret = card_setup(card);
if (!ret) { if (!ret) {
ll_unload(cs); ll_unload(cs);
goto outf_cs; goto outf_cs;
...@@ -1241,7 +1243,8 @@ static int HiSax_inithardware(int *busy_flag) ...@@ -1241,7 +1243,8 @@ static int HiSax_inithardware(int *busy_flag)
else else
sprintf(ids, "%s%d", id, i); sprintf(ids, "%s%d", id, i);
} }
if (checkcard(i, ids, busy_flag, THIS_MODULE)) { if (checkcard(i, ids, busy_flag, THIS_MODULE,
hisax_cs_setup_card)) {
foundcards++; foundcards++;
i++; i++;
} else { } else {
...@@ -1549,7 +1552,8 @@ int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card) ...@@ -1549,7 +1552,8 @@ int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card)
sprintf(ids, "HiSax%d", nrcards); sprintf(ids, "HiSax%d", nrcards);
else else
sprintf(ids, "HiSax"); sprintf(ids, "HiSax");
if (!checkcard(nrcards, ids, busy_flag, THIS_MODULE)) if (!checkcard(nrcards, ids, busy_flag, THIS_MODULE,
hisax_cs_setup_card))
goto error; goto error;
ret = nrcards; ret = nrcards;
...@@ -1595,7 +1599,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[], ...@@ -1595,7 +1599,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
cards[i].protocol = protocol; cards[i].protocol = protocol;
sprintf(id, "%s%d", name, i); sprintf(id, "%s%d", name, i);
nrcards++; nrcards++;
retval = checkcard(i, id, NULL, hisax_d_if->owner); retval = checkcard(i, id, NULL, hisax_d_if->owner, hisax_cs_setup_card);
if (retval == 0) { // yuck if (retval == 0) { // yuck
cards[i].typ = 0; cards[i].typ = 0;
nrcards--; nrcards--;
......
...@@ -60,5 +60,7 @@ struct IsdnCard { ...@@ -60,5 +60,7 @@ struct IsdnCard {
IsdnCardState_t *cs; IsdnCardState_t *cs;
}; };
typedef int (*hisax_setup_func_t)(struct IsdnCard *card);
extern void HiSax_closecard(int); extern void HiSax_closecard(int);
extern int hisax_init_pcmcia(void *, int *, IsdnCard_t *); extern int hisax_init_pcmcia(void *, int *, IsdnCard_t *);
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