hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/drivers/net/wan/farsync.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * FarSync WAN driver for Linux (2.6.x kernel version)
34 *
....@@ -5,11 +6,6 @@
56 *
67 * Copyright (C) 2001-2004 FarSite Communications Ltd.
78 * 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.
139 *
1410 * Author: R.J.Dunlop <bob.dunlop@farsite.co.uk>
1511 * Maintainer: Kevin Curtis <kevin.curtis@farsite.co.uk>
....@@ -128,7 +124,7 @@
128124 /* The Am186CH/CC processors support a SmartDMA mode using circular pools
129125 * of buffer descriptors. The structure is almost identical to that used
130126 * 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/\
132128 * 2.16bitcont/3.am186cxfa/a21914/21914.pdf
133129 */
134130 struct txdesc { /* Transmit descriptor */
....@@ -573,8 +569,8 @@
573569 static void fst_process_tx_work_q(unsigned long work_q);
574570 static void fst_process_int_work_q(unsigned long work_q);
575571
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);
578574
579575 static struct fst_card_info *fst_card_array[FST_MAX_CARDS];
580576 static spinlock_t fst_work_q_lock;
....@@ -2243,7 +2239,7 @@
22432239 }
22442240
22452241 static void
2246
-fst_tx_timeout(struct net_device *dev)
2242
+fst_tx_timeout(struct net_device *dev, unsigned int txqueue)
22472243 {
22482244 struct fst_port_info *port;
22492245 struct fst_card_info *card;
....@@ -2557,16 +2553,16 @@
25572553 * Allocate a dma buffer for transmit and receives
25582554 */
25592555 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);
25622558 if (card->rx_dma_handle_host == NULL) {
25632559 pr_err("Could not allocate rx dma buffer\n");
25642560 err = -ENOMEM;
25652561 goto rx_dma_fail;
25662562 }
25672563 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);
25702566 if (card->tx_dma_handle_host == NULL) {
25712567 pr_err("Could not allocate tx dma buffer\n");
25722568 err = -ENOMEM;
....@@ -2576,9 +2572,8 @@
25762572 return 0; /* Success */
25772573
25782574 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);
25822577 rx_dma_fail:
25832578 fst_disable_intr(card);
25842579 for (i = 0 ; i < card->nports ; i++)
....@@ -2617,6 +2612,7 @@
26172612 for (i = 0; i < card->nports; i++) {
26182613 struct net_device *dev = port_to_dev(&card->ports[i]);
26192614 unregister_hdlc_device(dev);
2615
+ free_netdev(dev);
26202616 }
26212617
26222618 fst_disable_intr(card);
....@@ -2629,23 +2625,22 @@
26292625 /*
26302626 * Free dma buffers
26312627 */
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);
26382634 }
26392635 fst_card_array[card->card_no] = NULL;
2636
+ kfree(card);
26402637 }
26412638
26422639 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,
26492644 };
26502645
26512646 static int __init