| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * NETJet mISDN driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Author Karsten Keil <keil@isdn4linux.de> |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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 | | - * |
|---|
| 21 | 8 | */ |
|---|
| 22 | 9 | |
|---|
| 23 | 10 | #include <linux/interrupt.h> |
|---|
| .. | .. |
|---|
| 29 | 16 | #include "ipac.h" |
|---|
| 30 | 17 | #include "iohelper.h" |
|---|
| 31 | 18 | #include "netjet.h" |
|---|
| 32 | | -#include <linux/isdn/hdlc.h> |
|---|
| 19 | +#include "isdnhdlc.h" |
|---|
| 33 | 20 | |
|---|
| 34 | 21 | #define NETJET_REV "2.0" |
|---|
| 35 | 22 | |
|---|
| .. | .. |
|---|
| 310 | 297 | { |
|---|
| 311 | 298 | int i; |
|---|
| 312 | 299 | |
|---|
| 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); |
|---|
| 315 | 302 | if (!card->dma_p) { |
|---|
| 316 | 303 | pr_info("%s: No DMA memory\n", card->name); |
|---|
| 317 | 304 | return -ENOMEM; |
|---|
| .. | .. |
|---|
| 393 | 380 | stat = bchannel_get_rxbuf(&bc->bch, cnt); |
|---|
| 394 | 381 | /* only transparent use the count here, HDLC overun is detected later */ |
|---|
| 395 | 382 | 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); |
|---|
| 398 | 385 | return; |
|---|
| 399 | 386 | } |
|---|
| 400 | 387 | if (test_bit(FLG_TRANSPARENT, &bc->bch.Flags)) |
|---|
| .. | .. |
|---|
| 433 | 420 | recv_Bchannel(&bc->bch, 0, false); |
|---|
| 434 | 421 | stat = bchannel_get_rxbuf(&bc->bch, bc->bch.maxlen); |
|---|
| 435 | 422 | 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); |
|---|
| 438 | 425 | return; |
|---|
| 439 | 426 | } |
|---|
| 440 | 427 | } else if (stat == -HDLC_CRC_ERROR) { |
|---|
| .. | .. |
|---|
| 618 | 605 | if (bc->bch.tx_skb && bc->bch.tx_idx < bc->bch.tx_skb->len) { |
|---|
| 619 | 606 | fill_dma(bc); |
|---|
| 620 | 607 | } else { |
|---|
| 621 | | - if (bc->bch.tx_skb) |
|---|
| 622 | | - dev_kfree_skb(bc->bch.tx_skb); |
|---|
| 608 | + dev_kfree_skb(bc->bch.tx_skb); |
|---|
| 623 | 609 | if (get_next_bframe(&bc->bch)) { |
|---|
| 624 | 610 | fill_dma(bc); |
|---|
| 625 | 611 | test_and_clear_bit(FLG_TX_EMPTY, &bc->bch.Flags); |
|---|
| .. | .. |
|---|
| 970 | 956 | } |
|---|
| 971 | 957 | if (card->irq > 0) |
|---|
| 972 | 958 | free_irq(card->irq, card); |
|---|
| 973 | | - if (card->isac.dch.dev.dev.class) |
|---|
| 959 | + if (device_is_registered(&card->isac.dch.dev.dev)) |
|---|
| 974 | 960 | mISDN_unregister_device(&card->isac.dch.dev); |
|---|
| 975 | 961 | |
|---|
| 976 | 962 | for (i = 0; i < 2; i++) { |
|---|
| .. | .. |
|---|
| 979 | 965 | kfree(card->bc[i].hrbuf); |
|---|
| 980 | 966 | } |
|---|
| 981 | 967 | 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); |
|---|
| 984 | 970 | write_lock_irqsave(&card_lock, flags); |
|---|
| 985 | 971 | list_del(&card->list); |
|---|
| 986 | 972 | write_unlock_irqrestore(&card_lock, flags); |
|---|