Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=881ebdc9f4fb6466a6198ef7943b8637e0a48232
Commit:     881ebdc9f4fb6466a6198ef7943b8637e0a48232
Parent:     82bcda95969dc9852f5cc64001c078ec7d3d95ef
Author:     Jeff Garzik <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 17:14:23 2007 -0400
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 17:14:23 2007 -0400

    [ISDN] HiSax: move card state alloc/setup code into separate functions
    
    Just code movement.  No code changes or cleanups besides that which
    is required to call the new functions from the old code site.
    
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/isdn/hisax/config.c |   72 ++++++++++++++++++++++++++++++++-----------
 1 files changed, 54 insertions(+), 18 deletions(-)

diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index 6bc49e6..5f7907e 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -1016,12 +1016,14 @@ static int hisax_cs_setup_card(struct IsdnCard *card)
        return ret;
 }
 
-static int checkcard(int cardnr, char *id, int *busy_flag, struct module 
*lockowner)
+static int hisax_cs_new(int cardnr, char *id, struct IsdnCard *card,
+                       struct IsdnCardState **cs_out, int *busy_flag,
+                       struct module *lockowner)
 {
-       int ret = 0;
-       struct IsdnCard *card = cards + cardnr;
        struct IsdnCardState *cs;
 
+       *cs_out = NULL;
+
        cs = kzalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
        if (!cs) {
                printk(KERN_WARNING
@@ -1098,19 +1100,23 @@ static int checkcard(int cardnr, char *id, int 
*busy_flag, struct module *lockow
        cs->iif.readstat = HiSax_readstatus;
        register_isdn(&cs->iif);
        cs->myid = cs->iif.channels;
-       printk(KERN_INFO
-              "HiSax: Card %d Protocol %s Id=%s (%d)\n", cardnr + 1,
-              (card->protocol == ISDN_PTYPE_1TR6) ? "1TR6" :
-              (card->protocol == ISDN_PTYPE_EURO) ? "EDSS1" :
-              (card->protocol == ISDN_PTYPE_LEASED) ? "LEASED" :
-              (card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
-              "NONE", cs->iif.id, cs->myid);
 
-       ret = hisax_cs_setup_card(card);
-       if (!ret) {
-               ll_unload(cs);
-               goto outf_cs;
-       }
+       *cs_out = cs;
+       return 1;       /* success */
+
+outf_dlog:
+       kfree(cs->dlog);
+outf_cs:
+       kfree(cs);
+       card->cs = NULL;
+out:
+       return 0;       /* error */
+}
+
+static int hisax_cs_setup(int cardnr, struct IsdnCard *card,
+                         struct IsdnCardState *cs)
+{
+       int ret;
 
        if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) {
                printk(KERN_WARNING "HiSax: No memory for isac rcvbuf\n");
@@ -1154,11 +1160,41 @@ static int checkcard(int cardnr, char *id, int 
*busy_flag, struct module *lockow
        if (!test_bit(HW_ISAR, &cs->HW_Flags))
                ll_run(cs, 0);
 
-       ret = 1;
+       return 1;
+
+outf_cs:
+       kfree(cs);
+       card->cs = NULL;
+       return ret;
+}
+
+static int checkcard(int cardnr, char *id, int *busy_flag, struct module 
*lockowner)
+{
+       int ret;
+       struct IsdnCard *card = cards + cardnr;
+       struct IsdnCardState *cs;
+
+       ret = hisax_cs_new(cardnr, id, card, &cs, busy_flag, lockowner);
+       if (!ret)
+               return 0;
+
+       printk(KERN_INFO
+              "HiSax: Card %d Protocol %s Id=%s (%d)\n", cardnr + 1,
+              (card->protocol == ISDN_PTYPE_1TR6) ? "1TR6" :
+              (card->protocol == ISDN_PTYPE_EURO) ? "EDSS1" :
+              (card->protocol == ISDN_PTYPE_LEASED) ? "LEASED" :
+              (card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
+              "NONE", cs->iif.id, cs->myid);
+
+       ret = hisax_cs_setup_card(card);
+       if (!ret) {
+               ll_unload(cs);
+               goto outf_cs;
+       }
+
+       ret = hisax_cs_setup(cardnr, card, cs);
        goto out;
 
- outf_dlog:
-       kfree(cs->dlog);
  outf_cs:
        kfree(cs);
        card->cs = NULL;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to