]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/isdn/hisax/config.c
ALSA: aaci - Fix NULL test at error path
[linux-2.6-omap-h63xx.git] / drivers / isdn / hisax / config.c
index 5f7907e57090cc93c259d81629ee9e602577cf67..84d75a3f5d17f20dfe9017baf455ba92edb28b25 100644 (file)
@@ -847,7 +847,7 @@ static int init_card(struct IsdnCardState *cs)
        return 3;
 }
 
-static int hisax_cs_setup_card(struct IsdnCard *card)
+static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 {
        int ret;
 
@@ -1146,14 +1146,12 @@ static int hisax_cs_setup(int cardnr, struct IsdnCard *card,
        }
        if (ret) {
                closecard(cardnr);
-               ret = 0;
                goto outf_cs;
        }
        init_tei(cs, cs->protocol);
        ret = CallcNewChan(cs);
        if (ret) {
                closecard(cardnr);
-               ret = 0;
                goto outf_cs;
        }
        /* ISAR needs firmware download first */
@@ -1165,10 +1163,15 @@ static int hisax_cs_setup(int cardnr, struct IsdnCard *card,
 outf_cs:
        kfree(cs);
        card->cs = NULL;
-       return ret;
+       return 0;
 }
 
-static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner)
+/* 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,
+                          hisax_setup_func_t card_setup)
 {
        int ret;
        struct IsdnCard *card = cards + cardnr;
@@ -1186,7 +1189,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;
@@ -1240,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 {
@@ -1548,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;
@@ -1594,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--;