| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * FarSync WAN driver for Linux (2.6.x kernel version) |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright (C) 2001-2004 FarSite Communications Ltd. |
|---|
| 7 | 8 | * www.farsite.co.uk |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or |
|---|
| 10 | | - * modify it under the terms of the GNU General Public License |
|---|
| 11 | | - * as published by the Free Software Foundation; either version |
|---|
| 12 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 13 | 9 | * |
|---|
| 14 | 10 | * Author: R.J.Dunlop <bob.dunlop@farsite.co.uk> |
|---|
| 15 | 11 | * Maintainer: Kevin Curtis <kevin.curtis@farsite.co.uk> |
|---|
| .. | .. |
|---|
| 128 | 124 | /* The Am186CH/CC processors support a SmartDMA mode using circular pools |
|---|
| 129 | 125 | * of buffer descriptors. The structure is almost identical to that used |
|---|
| 130 | 126 | * in the LANCE Ethernet controllers. Details available as PDF from the |
|---|
| 131 | | - * AMD web site: http://www.amd.com/products/epd/processors/\ |
|---|
| 127 | + * AMD web site: https://www.amd.com/products/epd/processors/\ |
|---|
| 132 | 128 | * 2.16bitcont/3.am186cxfa/a21914/21914.pdf |
|---|
| 133 | 129 | */ |
|---|
| 134 | 130 | struct txdesc { /* Transmit descriptor */ |
|---|
| .. | .. |
|---|
| 573 | 569 | static void fst_process_tx_work_q(unsigned long work_q); |
|---|
| 574 | 570 | static void fst_process_int_work_q(unsigned long work_q); |
|---|
| 575 | 571 | |
|---|
| 576 | | -static DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0); |
|---|
| 577 | | -static DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0); |
|---|
| 572 | +static DECLARE_TASKLET_OLD(fst_tx_task, fst_process_tx_work_q); |
|---|
| 573 | +static DECLARE_TASKLET_OLD(fst_int_task, fst_process_int_work_q); |
|---|
| 578 | 574 | |
|---|
| 579 | 575 | static struct fst_card_info *fst_card_array[FST_MAX_CARDS]; |
|---|
| 580 | 576 | static spinlock_t fst_work_q_lock; |
|---|
| .. | .. |
|---|
| 2243 | 2239 | } |
|---|
| 2244 | 2240 | |
|---|
| 2245 | 2241 | static void |
|---|
| 2246 | | -fst_tx_timeout(struct net_device *dev) |
|---|
| 2242 | +fst_tx_timeout(struct net_device *dev, unsigned int txqueue) |
|---|
| 2247 | 2243 | { |
|---|
| 2248 | 2244 | struct fst_port_info *port; |
|---|
| 2249 | 2245 | struct fst_card_info *card; |
|---|
| .. | .. |
|---|
| 2557 | 2553 | * Allocate a dma buffer for transmit and receives |
|---|
| 2558 | 2554 | */ |
|---|
| 2559 | 2555 | card->rx_dma_handle_host = |
|---|
| 2560 | | - pci_alloc_consistent(card->device, FST_MAX_MTU, |
|---|
| 2561 | | - &card->rx_dma_handle_card); |
|---|
| 2556 | + dma_alloc_coherent(&card->device->dev, FST_MAX_MTU, |
|---|
| 2557 | + &card->rx_dma_handle_card, GFP_KERNEL); |
|---|
| 2562 | 2558 | if (card->rx_dma_handle_host == NULL) { |
|---|
| 2563 | 2559 | pr_err("Could not allocate rx dma buffer\n"); |
|---|
| 2564 | 2560 | err = -ENOMEM; |
|---|
| 2565 | 2561 | goto rx_dma_fail; |
|---|
| 2566 | 2562 | } |
|---|
| 2567 | 2563 | card->tx_dma_handle_host = |
|---|
| 2568 | | - pci_alloc_consistent(card->device, FST_MAX_MTU, |
|---|
| 2569 | | - &card->tx_dma_handle_card); |
|---|
| 2564 | + dma_alloc_coherent(&card->device->dev, FST_MAX_MTU, |
|---|
| 2565 | + &card->tx_dma_handle_card, GFP_KERNEL); |
|---|
| 2570 | 2566 | if (card->tx_dma_handle_host == NULL) { |
|---|
| 2571 | 2567 | pr_err("Could not allocate tx dma buffer\n"); |
|---|
| 2572 | 2568 | err = -ENOMEM; |
|---|
| .. | .. |
|---|
| 2576 | 2572 | return 0; /* Success */ |
|---|
| 2577 | 2573 | |
|---|
| 2578 | 2574 | tx_dma_fail: |
|---|
| 2579 | | - pci_free_consistent(card->device, FST_MAX_MTU, |
|---|
| 2580 | | - card->rx_dma_handle_host, |
|---|
| 2581 | | - card->rx_dma_handle_card); |
|---|
| 2575 | + dma_free_coherent(&card->device->dev, FST_MAX_MTU, |
|---|
| 2576 | + card->rx_dma_handle_host, card->rx_dma_handle_card); |
|---|
| 2582 | 2577 | rx_dma_fail: |
|---|
| 2583 | 2578 | fst_disable_intr(card); |
|---|
| 2584 | 2579 | for (i = 0 ; i < card->nports ; i++) |
|---|
| .. | .. |
|---|
| 2617 | 2612 | for (i = 0; i < card->nports; i++) { |
|---|
| 2618 | 2613 | struct net_device *dev = port_to_dev(&card->ports[i]); |
|---|
| 2619 | 2614 | unregister_hdlc_device(dev); |
|---|
| 2615 | + free_netdev(dev); |
|---|
| 2620 | 2616 | } |
|---|
| 2621 | 2617 | |
|---|
| 2622 | 2618 | fst_disable_intr(card); |
|---|
| .. | .. |
|---|
| 2629 | 2625 | /* |
|---|
| 2630 | 2626 | * Free dma buffers |
|---|
| 2631 | 2627 | */ |
|---|
| 2632 | | - pci_free_consistent(card->device, FST_MAX_MTU, |
|---|
| 2633 | | - card->rx_dma_handle_host, |
|---|
| 2634 | | - card->rx_dma_handle_card); |
|---|
| 2635 | | - pci_free_consistent(card->device, FST_MAX_MTU, |
|---|
| 2636 | | - card->tx_dma_handle_host, |
|---|
| 2637 | | - card->tx_dma_handle_card); |
|---|
| 2628 | + dma_free_coherent(&card->device->dev, FST_MAX_MTU, |
|---|
| 2629 | + card->rx_dma_handle_host, |
|---|
| 2630 | + card->rx_dma_handle_card); |
|---|
| 2631 | + dma_free_coherent(&card->device->dev, FST_MAX_MTU, |
|---|
| 2632 | + card->tx_dma_handle_host, |
|---|
| 2633 | + card->tx_dma_handle_card); |
|---|
| 2638 | 2634 | } |
|---|
| 2639 | 2635 | fst_card_array[card->card_no] = NULL; |
|---|
| 2636 | + kfree(card); |
|---|
| 2640 | 2637 | } |
|---|
| 2641 | 2638 | |
|---|
| 2642 | 2639 | static struct pci_driver fst_driver = { |
|---|
| 2643 | | - .name = FST_NAME, |
|---|
| 2644 | | - .id_table = fst_pci_dev_id, |
|---|
| 2645 | | - .probe = fst_add_one, |
|---|
| 2646 | | - .remove = fst_remove_one, |
|---|
| 2647 | | - .suspend = NULL, |
|---|
| 2648 | | - .resume = NULL, |
|---|
| 2640 | + .name = FST_NAME, |
|---|
| 2641 | + .id_table = fst_pci_dev_id, |
|---|
| 2642 | + .probe = fst_add_one, |
|---|
| 2643 | + .remove = fst_remove_one, |
|---|
| 2649 | 2644 | }; |
|---|
| 2650 | 2645 | |
|---|
| 2651 | 2646 | static int __init |
|---|