diff options
author | Jeff Garzik <jeff@garzik.org> | 2008-02-15 23:41:15 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-20 18:22:30 -0400 |
commit | d38c8475b4f3a684ac673dcedc88ffdb17b74882 (patch) | |
tree | 6534f17c8029697a239ba3b962ecd82c77a4d8d9 | |
parent | 3925e6fc1f774048404fdd910b0345b06c699eb4 (diff) |
[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: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r-- | drivers/isdn/hisax/config.c | 14 | ||||
-rw-r--r-- | drivers/isdn/hisax/hisax_cfg.h | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c index a0ee43c04dd5..84d75a3f5d17 100644 --- a/drivers/isdn/hisax/config.c +++ b/drivers/isdn/hisax/config.c | |||
@@ -1169,7 +1169,9 @@ outf_cs: | |||
1169 | /* Used from an exported function but calls __devinit functions. | 1169 | /* Used from an exported function but calls __devinit functions. |
1170 | * Tell modpost not to warn (__ref) | 1170 | * Tell modpost not to warn (__ref) |
1171 | */ | 1171 | */ |
1172 | static int __ref checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner) | 1172 | static int __ref checkcard(int cardnr, char *id, int *busy_flag, |
1173 | struct module *lockowner, | ||
1174 | hisax_setup_func_t card_setup) | ||
1173 | { | 1175 | { |
1174 | int ret; | 1176 | int ret; |
1175 | struct IsdnCard *card = cards + cardnr; | 1177 | struct IsdnCard *card = cards + cardnr; |
@@ -1187,7 +1189,7 @@ static int __ref checkcard(int cardnr, char *id, int *busy_flag, struct module * | |||
1187 | (card->protocol == ISDN_PTYPE_NI1) ? "NI1" : | 1189 | (card->protocol == ISDN_PTYPE_NI1) ? "NI1" : |
1188 | "NONE", cs->iif.id, cs->myid); | 1190 | "NONE", cs->iif.id, cs->myid); |
1189 | 1191 | ||
1190 | ret = hisax_cs_setup_card(card); | 1192 | ret = card_setup(card); |
1191 | if (!ret) { | 1193 | if (!ret) { |
1192 | ll_unload(cs); | 1194 | ll_unload(cs); |
1193 | goto outf_cs; | 1195 | goto outf_cs; |
@@ -1241,7 +1243,8 @@ static int HiSax_inithardware(int *busy_flag) | |||
1241 | else | 1243 | else |
1242 | sprintf(ids, "%s%d", id, i); | 1244 | sprintf(ids, "%s%d", id, i); |
1243 | } | 1245 | } |
1244 | if (checkcard(i, ids, busy_flag, THIS_MODULE)) { | 1246 | if (checkcard(i, ids, busy_flag, THIS_MODULE, |
1247 | hisax_cs_setup_card)) { | ||
1245 | foundcards++; | 1248 | foundcards++; |
1246 | i++; | 1249 | i++; |
1247 | } else { | 1250 | } else { |
@@ -1549,7 +1552,8 @@ int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card) | |||
1549 | sprintf(ids, "HiSax%d", nrcards); | 1552 | sprintf(ids, "HiSax%d", nrcards); |
1550 | else | 1553 | else |
1551 | sprintf(ids, "HiSax"); | 1554 | sprintf(ids, "HiSax"); |
1552 | if (!checkcard(nrcards, ids, busy_flag, THIS_MODULE)) | 1555 | if (!checkcard(nrcards, ids, busy_flag, THIS_MODULE, |
1556 | hisax_cs_setup_card)) | ||
1553 | goto error; | 1557 | goto error; |
1554 | 1558 | ||
1555 | ret = nrcards; | 1559 | ret = nrcards; |
@@ -1595,7 +1599,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[], | |||
1595 | cards[i].protocol = protocol; | 1599 | cards[i].protocol = protocol; |
1596 | sprintf(id, "%s%d", name, i); | 1600 | sprintf(id, "%s%d", name, i); |
1597 | nrcards++; | 1601 | nrcards++; |
1598 | retval = checkcard(i, id, NULL, hisax_d_if->owner); | 1602 | retval = checkcard(i, id, NULL, hisax_d_if->owner, hisax_cs_setup_card); |
1599 | if (retval == 0) { // yuck | 1603 | if (retval == 0) { // yuck |
1600 | cards[i].typ = 0; | 1604 | cards[i].typ = 0; |
1601 | nrcards--; | 1605 | nrcards--; |
diff --git a/drivers/isdn/hisax/hisax_cfg.h b/drivers/isdn/hisax/hisax_cfg.h index ca3fe6259bca..17a2fea64efe 100644 --- a/drivers/isdn/hisax/hisax_cfg.h +++ b/drivers/isdn/hisax/hisax_cfg.h | |||
@@ -60,5 +60,7 @@ struct IsdnCard { | |||
60 | IsdnCardState_t *cs; | 60 | IsdnCardState_t *cs; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | typedef int (*hisax_setup_func_t)(struct IsdnCard *card); | ||
64 | |||
63 | extern void HiSax_closecard(int); | 65 | extern void HiSax_closecard(int); |
64 | extern int hisax_init_pcmcia(void *, int *, IsdnCard_t *); | 66 | extern int hisax_init_pcmcia(void *, int *, IsdnCard_t *); |