forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/isdn/hardware/mISDN/hfcmulti.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * hfcmulti.c low level driver for hfc-4s/hfc-8s/hfc-e1 based cards
34 *
....@@ -9,21 +10,6 @@
910 * Copyright 1999 by Werner Cornelius (werner@isdn-development.de)
1011 * Copyright 2008 by Karsten Keil (kkeil@suse.de)
1112 * Copyright 2008 by Andreas Eversberg (jolly@eversberg.eu)
12
- *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 2, or (at your option)
16
- * any later version.
17
- *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License
24
- * along with this program; if not, write to the Free Software
25
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
- *
2713 *
2814 * Thanks to Cologne Chip AG for this great controller!
2915 */
....@@ -2262,8 +2248,8 @@
22622248 if (bch) {
22632249 maxlen = bchannel_get_rxbuf(bch, Zsize);
22642250 if (maxlen < 0) {
2265
- pr_warning("card%d.B%d: No bufferspace for %d bytes\n",
2266
- hc->id + 1, bch->nr, Zsize);
2251
+ pr_warn("card%d.B%d: No bufferspace for %d bytes\n",
2252
+ hc->id + 1, bch->nr, Zsize);
22672253 return;
22682254 }
22692255 sp = &bch->rx_skb;
....@@ -2274,8 +2260,8 @@
22742260 if (*sp == NULL) {
22752261 *sp = mI_alloc_skb(maxlen, GFP_ATOMIC);
22762262 if (*sp == NULL) {
2277
- pr_warning("card%d: No mem for dch rx_skb\n",
2278
- hc->id + 1);
2263
+ pr_warn("card%d: No mem for dch rx_skb\n",
2264
+ hc->id + 1);
22792265 return;
22802266 }
22812267 }
....@@ -3233,6 +3219,7 @@
32333219 hfcm_l1callback(struct dchannel *dch, u_int cmd)
32343220 {
32353221 struct hfc_multi *hc = dch->hw;
3222
+ struct sk_buff_head free_queue;
32363223 u_long flags;
32373224
32383225 switch (cmd) {
....@@ -3261,6 +3248,7 @@
32613248 l1_event(dch->l1, HW_POWERUP_IND);
32623249 break;
32633250 case HW_DEACT_REQ:
3251
+ __skb_queue_head_init(&free_queue);
32643252 /* start deactivation */
32653253 spin_lock_irqsave(&hc->lock, flags);
32663254 if (hc->ctype == HFC_TYPE_E1) {
....@@ -3280,20 +3268,21 @@
32803268 plxsd_checksync(hc, 0);
32813269 }
32823270 }
3283
- skb_queue_purge(&dch->squeue);
3271
+ skb_queue_splice_init(&dch->squeue, &free_queue);
32843272 if (dch->tx_skb) {
3285
- dev_kfree_skb(dch->tx_skb);
3273
+ __skb_queue_tail(&free_queue, dch->tx_skb);
32863274 dch->tx_skb = NULL;
32873275 }
32883276 dch->tx_idx = 0;
32893277 if (dch->rx_skb) {
3290
- dev_kfree_skb(dch->rx_skb);
3278
+ __skb_queue_tail(&free_queue, dch->rx_skb);
32913279 dch->rx_skb = NULL;
32923280 }
32933281 test_and_clear_bit(FLG_TX_BUSY, &dch->Flags);
32943282 if (test_and_clear_bit(FLG_BUSY_TIMER, &dch->Flags))
32953283 del_timer(&dch->timer);
32963284 spin_unlock_irqrestore(&hc->lock, flags);
3285
+ __skb_queue_purge(&free_queue);
32973286 break;
32983287 case HW_POWERUP_REQ:
32993288 spin_lock_irqsave(&hc->lock, flags);
....@@ -3400,6 +3389,9 @@
34003389 case PH_DEACTIVATE_REQ:
34013390 test_and_clear_bit(FLG_L2_ACTIVATED, &dch->Flags);
34023391 if (dch->dev.D.protocol != ISDN_P_TE_S0) {
3392
+ struct sk_buff_head free_queue;
3393
+
3394
+ __skb_queue_head_init(&free_queue);
34033395 spin_lock_irqsave(&hc->lock, flags);
34043396 if (debug & DEBUG_HFCMULTI_MSG)
34053397 printk(KERN_DEBUG
....@@ -3421,14 +3413,14 @@
34213413 /* deactivate */
34223414 dch->state = 1;
34233415 }
3424
- skb_queue_purge(&dch->squeue);
3416
+ skb_queue_splice_init(&dch->squeue, &free_queue);
34253417 if (dch->tx_skb) {
3426
- dev_kfree_skb(dch->tx_skb);
3418
+ __skb_queue_tail(&free_queue, dch->tx_skb);
34273419 dch->tx_skb = NULL;
34283420 }
34293421 dch->tx_idx = 0;
34303422 if (dch->rx_skb) {
3431
- dev_kfree_skb(dch->rx_skb);
3423
+ __skb_queue_tail(&free_queue, dch->rx_skb);
34323424 dch->rx_skb = NULL;
34333425 }
34343426 test_and_clear_bit(FLG_TX_BUSY, &dch->Flags);
....@@ -3440,6 +3432,7 @@
34403432 #endif
34413433 ret = 0;
34423434 spin_unlock_irqrestore(&hc->lock, flags);
3435
+ __skb_queue_purge(&free_queue);
34433436 } else
34443437 ret = l1_event(dch->l1, hh->prim);
34453438 break;