hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/isdn/hardware/mISDN/netjet.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * NETJet mISDN driver
34 *
45 * Author Karsten Keil <keil@isdn4linux.de>
56 *
67 * Copyright 2009 by Karsten Keil <keil@isdn4linux.de>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
- *
218 */
229
2310 #include <linux/interrupt.h>
....@@ -29,7 +16,7 @@
2916 #include "ipac.h"
3017 #include "iohelper.h"
3118 #include "netjet.h"
32
-#include <linux/isdn/hdlc.h>
19
+#include "isdnhdlc.h"
3320
3421 #define NETJET_REV "2.0"
3522
....@@ -310,8 +297,8 @@
310297 {
311298 int i;
312299
313
- card->dma_p = pci_alloc_consistent(card->pdev, NJ_DMA_SIZE,
314
- &card->dma);
300
+ card->dma_p = dma_alloc_coherent(&card->pdev->dev, NJ_DMA_SIZE,
301
+ &card->dma, GFP_ATOMIC);
315302 if (!card->dma_p) {
316303 pr_info("%s: No DMA memory\n", card->name);
317304 return -ENOMEM;
....@@ -393,8 +380,8 @@
393380 stat = bchannel_get_rxbuf(&bc->bch, cnt);
394381 /* only transparent use the count here, HDLC overun is detected later */
395382 if (stat == -ENOMEM) {
396
- pr_warning("%s.B%d: No memory for %d bytes\n",
397
- card->name, bc->bch.nr, cnt);
383
+ pr_warn("%s.B%d: No memory for %d bytes\n",
384
+ card->name, bc->bch.nr, cnt);
398385 return;
399386 }
400387 if (test_bit(FLG_TRANSPARENT, &bc->bch.Flags))
....@@ -433,8 +420,8 @@
433420 recv_Bchannel(&bc->bch, 0, false);
434421 stat = bchannel_get_rxbuf(&bc->bch, bc->bch.maxlen);
435422 if (stat < 0) {
436
- pr_warning("%s.B%d: No memory for %d bytes\n",
437
- card->name, bc->bch.nr, cnt);
423
+ pr_warn("%s.B%d: No memory for %d bytes\n",
424
+ card->name, bc->bch.nr, cnt);
438425 return;
439426 }
440427 } else if (stat == -HDLC_CRC_ERROR) {
....@@ -618,8 +605,7 @@
618605 if (bc->bch.tx_skb && bc->bch.tx_idx < bc->bch.tx_skb->len) {
619606 fill_dma(bc);
620607 } else {
621
- if (bc->bch.tx_skb)
622
- dev_kfree_skb(bc->bch.tx_skb);
608
+ dev_kfree_skb(bc->bch.tx_skb);
623609 if (get_next_bframe(&bc->bch)) {
624610 fill_dma(bc);
625611 test_and_clear_bit(FLG_TX_EMPTY, &bc->bch.Flags);
....@@ -970,7 +956,7 @@
970956 }
971957 if (card->irq > 0)
972958 free_irq(card->irq, card);
973
- if (card->isac.dch.dev.dev.class)
959
+ if (device_is_registered(&card->isac.dch.dev.dev))
974960 mISDN_unregister_device(&card->isac.dch.dev);
975961
976962 for (i = 0; i < 2; i++) {
....@@ -979,8 +965,8 @@
979965 kfree(card->bc[i].hrbuf);
980966 }
981967 if (card->dma_p)
982
- pci_free_consistent(card->pdev, NJ_DMA_SIZE,
983
- card->dma_p, card->dma);
968
+ dma_free_coherent(&card->pdev->dev, NJ_DMA_SIZE, card->dma_p,
969
+ card->dma);
984970 write_lock_irqsave(&card_lock, flags);
985971 list_del(&card->list);
986972 write_unlock_irqrestore(&card_lock, flags);