]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
mISDN: Cleanup channel also if it already was deactivated
authorKarsten Keil <kkeil@linux-pingi.de>
Tue, 15 May 2012 23:51:01 +0000 (23:51 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 May 2012 19:22:06 +0000 (15:22 -0400)
If a channel was closed after it was deactivated it could happen that
something was not proper resetted. The test if a channel is still activ
was wrong, so remove it and always do the cleanup.

Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/hardware/mISDN/avmfritz.c
drivers/isdn/hardware/mISDN/hfcmulti.c
drivers/isdn/hardware/mISDN/hfcpci.c
drivers/isdn/hardware/mISDN/hfcsusb.c
drivers/isdn/hardware/mISDN/mISDNipac.c
drivers/isdn/hardware/mISDN/mISDNisar.c
drivers/isdn/hardware/mISDN/netjet.c
drivers/isdn/hardware/mISDN/w6692.c

index 6bf2c58795a31de8af2b2c34ff434094af1df61d..2271f2b7d50147ce8c41dce0ffdfc18f0d12868e 100644 (file)
@@ -839,14 +839,10 @@ avm_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
        switch (cmd) {
        case CLOSE_CHANNEL:
                test_and_clear_bit(FLG_OPEN, &bch->Flags);
-               if (test_bit(FLG_ACTIVE, &bch->Flags)) {
-                       spin_lock_irqsave(&fc->lock, flags);
-                       mISDN_freebchannel(bch);
-                       test_and_clear_bit(FLG_TX_BUSY, &bch->Flags);
-                       test_and_clear_bit(FLG_ACTIVE, &bch->Flags);
-                       modehdlc(bch, ISDN_P_NONE);
-                       spin_unlock_irqrestore(&fc->lock, flags);
-               }
+               spin_lock_irqsave(&fc->lock, flags);
+               mISDN_freebchannel(bch);
+               modehdlc(bch, ISDN_P_NONE);
+               spin_unlock_irqrestore(&fc->lock, flags);
                ch->protocol = ISDN_P_NONE;
                ch->peer = NULL;
                module_put(THIS_MODULE);
index 9f4e2efa7ff684652448e9cc5649a5646c720d65..1dae761d973e99e0d3ccf394f87ac37898c6fc23 100644 (file)
@@ -3725,8 +3725,7 @@ hfcm_bctrl(struct mISDNchannel *ch, u_int cmd, void *arg)
        switch (cmd) {
        case CLOSE_CHANNEL:
                test_and_clear_bit(FLG_OPEN, &bch->Flags);
-               if (test_bit(FLG_ACTIVE, &bch->Flags))
-                       deactivate_bchannel(bch); /* locked there */
+               deactivate_bchannel(bch); /* locked there */
                ch->protocol = ISDN_P_NONE;
                ch->peer = NULL;
                module_put(THIS_MODULE);
index 5fe993e2dee916fa3348ceae5fd555e80d0e2775..f7a5ea7988ed7f0ce2de032d8dd80f67cbabe81f 100644 (file)
@@ -1581,8 +1581,7 @@ hfc_bctrl(struct mISDNchannel *ch, u_int cmd, void *arg)
                break;
        case CLOSE_CHANNEL:
                test_and_clear_bit(FLG_OPEN, &bch->Flags);
-               if (test_bit(FLG_ACTIVE, &bch->Flags))
-                       deactivate_bchannel(bch);
+               deactivate_bchannel(bch);
                ch->protocol = ISDN_P_NONE;
                ch->peer = NULL;
                module_put(THIS_MODULE);
index 8cde2a0538ab862f65b36411d4c3f06d2e0ec45e..add28acd54d785c4d7a99f1c22679b50df997809 100644 (file)
@@ -1836,8 +1836,7 @@ hfc_bctrl(struct mISDNchannel *ch, u_int cmd, void *arg)
 
        case CLOSE_CHANNEL:
                test_and_clear_bit(FLG_OPEN, &bch->Flags);
-               if (test_bit(FLG_ACTIVE, &bch->Flags))
-                       deactivate_bchannel(bch);
+               deactivate_bchannel(bch);
                ch->protocol = ISDN_P_NONE;
                ch->peer = NULL;
                module_put(THIS_MODULE);
index 92d4a78bc0a594a8380642c48724b7d5e4f4c279..6c044d55536bb9b8b822cbbbd7c96b28e817a00b 100644 (file)
@@ -1420,15 +1420,10 @@ hscx_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
        switch (cmd) {
        case CLOSE_CHANNEL:
                test_and_clear_bit(FLG_OPEN, &bch->Flags);
-               if (test_bit(FLG_ACTIVE, &bch->Flags)) {
-                       spin_lock_irqsave(hx->ip->hwlock, flags);
-                       mISDN_freebchannel(bch);
-                       hscx_mode(hx, ISDN_P_NONE);
-                       spin_unlock_irqrestore(hx->ip->hwlock, flags);
-               } else {
-                       skb_queue_purge(&bch->rqueue);
-                       bch->rcount = 0;
-               }
+               spin_lock_irqsave(hx->ip->hwlock, flags);
+               mISDN_freebchannel(bch);
+               hscx_mode(hx, ISDN_P_NONE);
+               spin_unlock_irqrestore(hx->ip->hwlock, flags);
                ch->protocol = ISDN_P_NONE;
                ch->peer = NULL;
                module_put(hx->ip->owner);
index 9a6da6edcfa899c99f62c140af7fe48223ce44cc..af9a966a1fdf242ff04d94bdeac6bc09c0b55389 100644 (file)
@@ -1603,15 +1603,10 @@ isar_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
        switch (cmd) {
        case CLOSE_CHANNEL:
                test_and_clear_bit(FLG_OPEN, &bch->Flags);
-               if (test_bit(FLG_ACTIVE, &bch->Flags)) {
-                       spin_lock_irqsave(ich->is->hwlock, flags);
-                       mISDN_freebchannel(bch);
-                       modeisar(ich, ISDN_P_NONE);
-                       spin_unlock_irqrestore(ich->is->hwlock, flags);
-               } else {
-                       skb_queue_purge(&bch->rqueue);
-                       bch->rcount = 0;
-               }
+               spin_lock_irqsave(ich->is->hwlock, flags);
+               mISDN_freebchannel(bch);
+               modeisar(ich, ISDN_P_NONE);
+               spin_unlock_irqrestore(ich->is->hwlock, flags);
                ch->protocol = ISDN_P_NONE;
                ch->peer = NULL;
                module_put(ich->is->owner);
index 27998d7188a5cb0f5365da0427f87bce83eab75f..55a77ed7b176e629a66d7b50421e017fbc5a9e7d 100644 (file)
@@ -808,14 +808,10 @@ nj_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
        switch (cmd) {
        case CLOSE_CHANNEL:
                test_and_clear_bit(FLG_OPEN, &bch->Flags);
-               if (test_bit(FLG_ACTIVE, &bch->Flags)) {
-                       spin_lock_irqsave(&card->lock, flags);
-                       mISDN_freebchannel(bch);
-                       test_and_clear_bit(FLG_TX_BUSY, &bch->Flags);
-                       test_and_clear_bit(FLG_ACTIVE, &bch->Flags);
-                       mode_tiger(bc, ISDN_P_NONE);
-                       spin_unlock_irqrestore(&card->lock, flags);
-               }
+               spin_lock_irqsave(&card->lock, flags);
+               mISDN_freebchannel(bch);
+               mode_tiger(bc, ISDN_P_NONE);
+               spin_unlock_irqrestore(&card->lock, flags);
                ch->protocol = ISDN_P_NONE;
                ch->peer = NULL;
                module_put(THIS_MODULE);
index 1d044670ff6696fd0996ec53431f3cda59faca73..0b5e9297e95b793b17fb4c408c286dceed175baa 100644 (file)
@@ -1061,15 +1061,10 @@ w6692_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
        switch (cmd) {
        case CLOSE_CHANNEL:
                test_and_clear_bit(FLG_OPEN, &bch->Flags);
-               if (test_bit(FLG_ACTIVE, &bch->Flags)) {
-                       spin_lock_irqsave(&card->lock, flags);
-                       mISDN_freebchannel(bch);
-                       w6692_mode(bc, ISDN_P_NONE);
-                       spin_unlock_irqrestore(&card->lock, flags);
-               } else {
-                       skb_queue_purge(&bch->rqueue);
-                       bch->rcount = 0;
-               }
+               spin_lock_irqsave(&card->lock, flags);
+               mISDN_freebchannel(bch);
+               w6692_mode(bc, ISDN_P_NONE);
+               spin_unlock_irqrestore(&card->lock, flags);
                ch->protocol = ISDN_P_NONE;
                ch->peer = NULL;
                module_put(THIS_MODULE);