[PATCH 01/14] [ISDN] HiSax: modularization prep

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <kkeil@...>, <isdn4linux@...>, <linux-kernel@...>
Date: Saturday, February 16, 2008 - 12:41 am

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>
---
 drivers/isdn/hisax/config.c    |   14 +++++++++-----
 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 a0ee43c..84d75a3 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -1169,7 +1169,9 @@ outf_cs:
 /* Used from an exported function but calls __devinit functions.
  * 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;
 	struct IsdnCard *card = cards + cardnr;
@@ -1187,7 +1189,7 @@ static int __ref checkcard(int cardnr, char *id, int *busy_flag, struct module *
 	       (card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
 	       "NONE", cs->iif.id, cs->myid);
 
-	ret = hisax_cs_setup_card(card);
+	ret = card_setup(card);
 	if (!ret) {
 		ll_unload(cs);
 		goto outf_cs;
@@ -1241,7 +1243,8 @@ static int HiSax_inithardware(int *busy_flag)
 			else
 				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++;
 			i++;
 		} else {
@@ -1549,7 +1552,8 @@ int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card)
 		sprintf(ids, "HiSax%d", nrcards);
 	else
 		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;
 
 	ret = nrcards;
@@ -1595,7 +1599,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
 	cards[i].protocol = protocol;
 	sprintf(id, "%s%d", name, i);
 	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
 		cards[i].typ = 0;
 		nrcards--;
diff --git a/drivers/isdn/hisax/hisax_cfg.h b/drivers/isdn/hisax/hisax_cfg.h
index ca3fe62..17a2fea 100644
--- a/drivers/isdn/hisax/hisax_cfg.h
+++ b/drivers/isdn/hisax/hisax_cfg.h
@@ -60,5 +60,7 @@ struct IsdnCard {
 	IsdnCardState_t	*cs;
 };
 
+typedef int (*hisax_setup_func_t)(struct IsdnCard *card);
+
 extern void	HiSax_closecard(int);
 extern int	hisax_init_pcmcia(void *, int *, IsdnCard_t *);
-- 
1.5.3.8

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/14] [ISDN] convert HiSax to hotplug APIs, Jeff Garzik, (Sat Feb 16, 12:41 am)
Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Sam Ravnborg, (Sun Feb 17, 3:52 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Andi Kleen, (Mon Feb 18, 8:08 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Sam Ravnborg, (Tue Feb 19, 4:50 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Gregory Nietsky, (Tue Feb 19, 5:25 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Tilman Schmidt, (Wed Feb 20, 10:19 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Simon Richter, (Thu Feb 21, 6:33 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Karsten Keil, (Fri Feb 22, 8:04 am)
Re: Plans for mISDN?, Tilman Schmidt, (Mon Feb 25, 10:39 am)
Re: Plans for mISDN?, Karsten Keil, (Mon Mar 3, 1:32 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Sam Ravnborg, (Sat Feb 23, 3:39 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Marcel Holtmann, (Thu Feb 21, 3:46 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Andi Kleen, (Thu Feb 21, 7:19 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Marcel Holtmann, (Thu Feb 21, 7:30 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Andi Kleen, (Thu Feb 21, 7:40 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Gregory Nietsky, (Thu Feb 21, 3:38 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Andi Kleen, (Wed Feb 20, 12:54 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Gregory Nietsky, (Wed Feb 20, 3:04 pm)
Re: Plans for mISDN?, Tilman Schmidt, (Wed Feb 20, 6:47 pm)
Re: Plans for mISDN?, Tilman Schmidt, (Wed Feb 20, 2:23 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Alan Cox, (Wed Feb 20, 10:23 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Sam Ravnborg, (Tue Feb 19, 5:54 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Andi Kleen, (Tue Feb 19, 5:40 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Sam Ravnborg, (Tue Feb 19, 5:56 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Andi Kleen, (Tue Feb 19, 5:58 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Marcel Holtmann, (Tue Feb 19, 12:14 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Tilman Schmidt, (Wed Feb 20, 10:24 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Sam Ravnborg, (Tue Feb 19, 7:55 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Gregory Nietsky, (Tue Feb 19, 12:12 pm)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Armin Schindler, (Tue Feb 19, 6:51 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Jeff Garzik, (Mon Feb 18, 8:36 am)
Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ..., Andi Kleen, (Mon Feb 18, 9:29 am)
[PATCH 01/14] [ISDN] HiSax: modularization prep, Jeff Garzik, (Sat Feb 16, 12:41 am)