From: Jeff Garzik <jeff@garzik.org>
To: linux-kernel@vger.kernel.org, isdn4linux@listserv.isdn4linux.de
Cc: kkeil@suse.de, akpm@linux-foundation.org
Subject: [PATCH 01/16] [ISDN] HiSax: modularize card setup
Date: Mon, 29 Oct 2007 15:38:56 -0400 (EDT) [thread overview]
Message-ID: <20071029193856.AC45F1F816B@havoc.gtf.org> (raw)
In-Reply-To: <eb2aa159d7f722c61d637feb287bc0f2f9519b1d.1193686445.git.jeff@garzik.org>
Now that the previous no-behavior-change code movement patches have
occurred, we can easily replace the big per-card "call the setup
function for <this card>" switch statement with a function pointer.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
---
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 97097ef..4c536b7 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -1166,7 +1166,9 @@ outf_cs:
return 0;
}
-static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner)
+static int checkcard(int cardnr, char *id, int *busy_flag,
+ struct module *lockowner,
+ hisax_setup_func_t card_setup)
{
int ret;
struct IsdnCard *card = cards + cardnr;
@@ -1184,7 +1186,7 @@ static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockow
(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;
@@ -1238,7 +1240,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 {
@@ -1546,7 +1549,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;
@@ -1592,7 +1596,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.2.4
next prev parent reply other threads:[~2007-10-29 19:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-29 19:38 [PATCH 00/16] " Jeff Garzik
2007-10-29 19:38 ` Jeff Garzik [this message]
2007-10-29 19:38 ` [PATCH 02/16] [ISDN] Ready HiSax driver for modularization Jeff Garzik
2007-10-29 19:38 ` [PATCH 03/16] [ISDN] HiSax bkm_a4t: convert to PCI hotplug API Jeff Garzik
2007-10-29 19:39 ` [PATCH 04/16] [ISDN] HiSax enternow: " Jeff Garzik
2007-10-29 19:39 ` [PATCH 05/16] [ISDN] HiSax hfc_pci, w6692: " Jeff Garzik
2007-10-29 19:39 ` [PATCH 06/16] [ISDN] HiSax nj_s, nj_u: " Jeff Garzik
2007-10-29 19:39 ` [PATCH 07/16] [ISDN] HiSax telespci: " Jeff Garzik
2007-10-29 19:39 ` [PATCH 08/16] [ISDN] HiSax: additional export to make things proper Jeff Garzik
2007-10-29 19:39 ` [PATCH 09/16] [ISDN] HiSax avm_pci: convert to modern probing Jeff Garzik
2007-10-29 19:39 ` [PATCH 10/16] [ISDN] HiSax acm_pci: fix module unload Jeff Garzik
2007-10-29 19:39 ` [PATCH 11/16] [ISDN] HiSax gazel: convert to ISA/PCI new probing Jeff Garzik
2007-10-29 19:39 ` [PATCH 12/16] [ISDN] HiSax gazel: ifdef bug fixes for x86-64 Jeff Garzik
2007-10-29 19:39 ` [PATCH 13/16] [ISDN] HiSax niccy: convert to ISA/PNP/PCI new style probing Jeff Garzik
2007-10-29 19:39 ` [PATCH 14/16] [ISDN] HiSax diva: convert to PCI/PNP/ISA new-style APIs Jeff Garzik
2007-10-29 19:39 ` [PATCH 15/16] [ISDN] HiSax diva: ia32 build fixes Jeff Garzik
2007-10-29 19:39 ` [PATCH 16/16] [ISDN] HiSax bkm_a8: convert to PCI hotplug API Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071029193856.AC45F1F816B@havoc.gtf.org \
--to=jeff@garzik.org \
--cc=akpm@linux-foundation.org \
--cc=isdn4linux@listserv.isdn4linux.de \
--cc=kkeil@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®