aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKarsten Keil <keil@b1-systems.de>2009-07-09 04:02:29 -0400
committerKarsten Keil <keil@b1-systems.de>2009-07-25 14:18:16 -0400
commitfb286f0471a04ef646c8e5c79750ae6718183745 (patch)
tree6e88ae4869ca1aedb5e674733a903324530d6ee1 /drivers
parentf3fad223ed69f406f33c9619c256858d5a5fc5c7 (diff)
mISDN: Make clearing B-channel a common function
Clearing B-channel is needed in every driver, so it makes sense to have it as common function. Signed-off-by: Karsten Keil <keil@b1-systems.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/isdn/hardware/mISDN/hfcmulti.c16
-rw-r--r--drivers/isdn/hardware/mISDN/hfcpci.c16
-rw-r--r--drivers/isdn/hardware/mISDN/hfcsusb.c16
-rw-r--r--drivers/isdn/mISDN/hwchannel.c15
4 files changed, 16 insertions, 47 deletions
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index e1dab30aed30..fd77bb15d790 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -3416,22 +3416,8 @@ deactivate_bchannel(struct bchannel *bch)
3416 u_long flags; 3416 u_long flags;
3417 3417
3418 spin_lock_irqsave(&hc->lock, flags); 3418 spin_lock_irqsave(&hc->lock, flags);
3419 if (test_and_clear_bit(FLG_TX_NEXT, &bch->Flags)) { 3419 mISDN_clear_bchannel(bch);
3420 dev_kfree_skb(bch->next_skb);
3421 bch->next_skb = NULL;
3422 }
3423 if (bch->tx_skb) {
3424 dev_kfree_skb(bch->tx_skb);
3425 bch->tx_skb = NULL;
3426 }
3427 bch->tx_idx = 0;
3428 if (bch->rx_skb) {
3429 dev_kfree_skb(bch->rx_skb);
3430 bch->rx_skb = NULL;
3431 }
3432 hc->chan[bch->slot].coeff_count = 0; 3420 hc->chan[bch->slot].coeff_count = 0;
3433 test_and_clear_bit(FLG_ACTIVE, &bch->Flags);
3434 test_and_clear_bit(FLG_TX_BUSY, &bch->Flags);
3435 hc->chan[bch->slot].rx_off = 0; 3421 hc->chan[bch->slot].rx_off = 0;
3436 hc->chan[bch->slot].conf = -1; 3422 hc->chan[bch->slot].conf = -1;
3437 mode_hfcmulti(hc, bch->slot, ISDN_P_NONE, -1, 0, -1, 0); 3423 mode_hfcmulti(hc, bch->slot, ISDN_P_NONE, -1, 0, -1, 0);
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index 228ffbed1286..70e6b0e01121 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -1522,22 +1522,8 @@ deactivate_bchannel(struct bchannel *bch)
1522 u_long flags; 1522 u_long flags;
1523 1523
1524 spin_lock_irqsave(&hc->lock, flags); 1524 spin_lock_irqsave(&hc->lock, flags);
1525 if (test_and_clear_bit(FLG_TX_NEXT, &bch->Flags)) { 1525 mISDN_clear_bchannel(bch);
1526 dev_kfree_skb(bch->next_skb);
1527 bch->next_skb = NULL;
1528 }
1529 if (bch->tx_skb) {
1530 dev_kfree_skb(bch->tx_skb);
1531 bch->tx_skb = NULL;
1532 }
1533 bch->tx_idx = 0;
1534 if (bch->rx_skb) {
1535 dev_kfree_skb(bch->rx_skb);
1536 bch->rx_skb = NULL;
1537 }
1538 mode_hfcpci(bch, bch->nr, ISDN_P_NONE); 1526 mode_hfcpci(bch, bch->nr, ISDN_P_NONE);
1539 test_and_clear_bit(FLG_ACTIVE, &bch->Flags);
1540 test_and_clear_bit(FLG_TX_BUSY, &bch->Flags);
1541 spin_unlock_irqrestore(&hc->lock, flags); 1527 spin_unlock_irqrestore(&hc->lock, flags);
1542} 1528}
1543 1529
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 6b7704c41b94..fc46a26cb14f 100644
--- a/drivers/isdn/hardware/mISDN/hfcsusb.c
+++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
@@ -1809,21 +1809,7 @@ deactivate_bchannel(struct bchannel *bch)
1809 hw->name, __func__, bch->nr); 1809 hw->name, __func__, bch->nr);
1810 1810
1811 spin_lock_irqsave(&hw->lock, flags); 1811 spin_lock_irqsave(&hw->lock, flags);
1812 if (test_and_clear_bit(FLG_TX_NEXT, &bch->Flags)) { 1812 mISDN_clear_bchannel(bch);
1813 dev_kfree_skb(bch->next_skb);
1814 bch->next_skb = NULL;
1815 }
1816 if (bch->tx_skb) {
1817 dev_kfree_skb(bch->tx_skb);
1818 bch->tx_skb = NULL;
1819 }
1820 bch->tx_idx = 0;
1821 if (bch->rx_skb) {
1822 dev_kfree_skb(bch->rx_skb);
1823 bch->rx_skb = NULL;
1824 }
1825 clear_bit(FLG_ACTIVE, &bch->Flags);
1826 clear_bit(FLG_TX_BUSY, &bch->Flags);
1827 spin_unlock_irqrestore(&hw->lock, flags); 1813 spin_unlock_irqrestore(&hw->lock, flags);
1828 hfcsusb_setup_bch(bch, ISDN_P_NONE); 1814 hfcsusb_setup_bch(bch, ISDN_P_NONE);
1829 hfcsusb_stop_endpoint(hw, bch->nr); 1815 hfcsusb_stop_endpoint(hw, bch->nr);
diff --git a/drivers/isdn/mISDN/hwchannel.c b/drivers/isdn/mISDN/hwchannel.c
index 0481a0cdf6db..e8049be552aa 100644
--- a/drivers/isdn/mISDN/hwchannel.c
+++ b/drivers/isdn/mISDN/hwchannel.c
@@ -114,13 +114,14 @@ mISDN_freedchannel(struct dchannel *ch)
114} 114}
115EXPORT_SYMBOL(mISDN_freedchannel); 115EXPORT_SYMBOL(mISDN_freedchannel);
116 116
117int 117void
118mISDN_freebchannel(struct bchannel *ch) 118mISDN_clear_bchannel(struct bchannel *ch)
119{ 119{
120 if (ch->tx_skb) { 120 if (ch->tx_skb) {
121 dev_kfree_skb(ch->tx_skb); 121 dev_kfree_skb(ch->tx_skb);
122 ch->tx_skb = NULL; 122 ch->tx_skb = NULL;
123 } 123 }
124 ch->tx_idx = 0;
124 if (ch->rx_skb) { 125 if (ch->rx_skb) {
125 dev_kfree_skb(ch->rx_skb); 126 dev_kfree_skb(ch->rx_skb);
126 ch->rx_skb = NULL; 127 ch->rx_skb = NULL;
@@ -129,6 +130,16 @@ mISDN_freebchannel(struct bchannel *ch)
129 dev_kfree_skb(ch->next_skb); 130 dev_kfree_skb(ch->next_skb);
130 ch->next_skb = NULL; 131 ch->next_skb = NULL;
131 } 132 }
133 test_and_clear_bit(FLG_TX_BUSY, &ch->Flags);
134 test_and_clear_bit(FLG_TX_NEXT, &ch->Flags);
135 test_and_clear_bit(FLG_ACTIVE, &ch->Flags);
136}
137EXPORT_SYMBOL(mISDN_clear_bchannel);
138
139int
140mISDN_freebchannel(struct bchannel *ch)
141{
142 mISDN_clear_bchannel(ch);
132 skb_queue_purge(&ch->rqueue); 143 skb_queue_purge(&ch->rqueue);
133 ch->rcount = 0; 144 ch->rcount = 0;
134 flush_scheduled_work(); 145 flush_scheduled_work();