hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/net/ethernet/atheros/atlx/atl2.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright(c) 2006 - 2007 Atheros Corporation. All rights reserved.
34 * Copyright(c) 2007 - 2008 Chris Snook <csnook@redhat.com>
45 *
56 * Derived from Intel e1000 driver
67 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
7
- *
8
- * This program is free software; you can redistribute it and/or modify it
9
- * under the terms of the GNU General Public License as published by the Free
10
- * Software Foundation; either version 2 of the License, or (at your option)
11
- * any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful, but WITHOUT
14
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16
- * more details.
17
- *
18
- * You should have received a copy of the GNU General Public License along with
19
- * this program; if not, write to the Free Software Foundation, Inc., 59
20
- * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
218 */
229
2310 #include <linux/atomic.h>
....@@ -49,18 +36,12 @@
4936
5037 #include "atl2.h"
5138
52
-#define ATL2_DRV_VERSION "2.2.3"
53
-
5439 static const char atl2_driver_name[] = "atl2";
55
-static const char atl2_driver_string[] = "Atheros(R) L2 Ethernet Driver";
56
-static const char atl2_copyright[] = "Copyright (c) 2007 Atheros Corporation.";
57
-static const char atl2_driver_version[] = ATL2_DRV_VERSION;
5840 static const struct ethtool_ops atl2_ethtool_ops;
5941
6042 MODULE_AUTHOR("Atheros Corporation <xiong.huang@atheros.com>, Chris Snook <csnook@redhat.com>");
6143 MODULE_DESCRIPTION("Atheros Fast Ethernet Network Driver");
6244 MODULE_LICENSE("GPL");
63
-MODULE_VERSION(ATL2_DRV_VERSION);
6445
6546 /*
6647 * atl2_pci_tbl - PCI Device ID Table
....@@ -300,11 +281,10 @@
300281 adapter->txs_ring_size * 4 + 7 + /* dword align */
301282 adapter->rxd_ring_size * 1536 + 127; /* 128bytes align */
302283
303
- adapter->ring_vir_addr = pci_alloc_consistent(pdev, size,
304
- &adapter->ring_dma);
284
+ adapter->ring_vir_addr = dma_alloc_coherent(&pdev->dev, size,
285
+ &adapter->ring_dma, GFP_KERNEL);
305286 if (!adapter->ring_vir_addr)
306287 return -ENOMEM;
307
- memset(adapter->ring_vir_addr, 0, adapter->ring_size);
308288
309289 /* Init TXD Ring */
310290 adapter->txd_dma = adapter->ring_dma ;
....@@ -553,7 +533,7 @@
553533 netdev->stats.tx_aborted_errors++;
554534 if (txs->late_col)
555535 netdev->stats.tx_window_errors++;
556
- if (txs->underun)
536
+ if (txs->underrun)
557537 netdev->stats.tx_fifo_errors++;
558538 } while (1);
559539
....@@ -683,8 +663,8 @@
683663 static void atl2_free_ring_resources(struct atl2_adapter *adapter)
684664 {
685665 struct pci_dev *pdev = adapter->pdev;
686
- pci_free_consistent(pdev, adapter->ring_size, adapter->ring_vir_addr,
687
- adapter->ring_dma);
666
+ dma_free_coherent(&pdev->dev, adapter->ring_size,
667
+ adapter->ring_vir_addr, adapter->ring_dma);
688668 }
689669
690670 /**
....@@ -908,8 +888,7 @@
908888 ATL2_WRITE_REGW(&adapter->hw, REG_MB_TXD_WR_IDX,
909889 (adapter->txd_write_ptr >> 2));
910890
911
- mmiowb();
912
- dev_kfree_skb_any(skb);
891
+ dev_consume_skb_any(skb);
913892 return NETDEV_TX_OK;
914893 }
915894
....@@ -1015,8 +994,9 @@
1015994 /**
1016995 * atl2_tx_timeout - Respond to a Tx Hang
1017996 * @netdev: network interface device structure
997
+ * @txqueue: index of the hanging transmit queue
1018998 */
1019
-static void atl2_tx_timeout(struct net_device *netdev)
999
+static void atl2_tx_timeout(struct net_device *netdev, unsigned int txqueue)
10201000 {
10211001 struct atl2_adapter *adapter = netdev_priv(netdev);
10221002
....@@ -1026,7 +1006,7 @@
10261006
10271007 /**
10281008 * atl2_watchdog - Timer Call-back
1029
- * @data: pointer to netdev cast into an unsigned long
1009
+ * @t: timer list containing a pointer to netdev cast into an unsigned long
10301010 */
10311011 static void atl2_watchdog(struct timer_list *t)
10321012 {
....@@ -1051,7 +1031,7 @@
10511031
10521032 /**
10531033 * atl2_phy_config - Timer Call-back
1054
- * @data: pointer to netdev cast into an unsigned long
1034
+ * @t: timer list containing a pointer to netdev cast into an unsigned long
10551035 */
10561036 static void atl2_phy_config(struct timer_list *t)
10571037 {
....@@ -1106,7 +1086,6 @@
11061086
11071087 static void atl2_reinit_locked(struct atl2_adapter *adapter)
11081088 {
1109
- WARN_ON(in_interrupt());
11101089 while (test_and_set_bit(__ATL2_RESETTING, &adapter->flags))
11111090 msleep(1);
11121091 atl2_down(adapter);
....@@ -1256,6 +1235,7 @@
12561235
12571236 /**
12581237 * atl2_link_chg_task - deal with link change event Out of interrupt context
1238
+ * @work: pointer to work struct with private info
12591239 */
12601240 static void atl2_link_chg_task(struct work_struct *work)
12611241 {
....@@ -1349,8 +1329,8 @@
13491329 * until the kernel has the proper infrastructure to support 64-bit DMA
13501330 * on these devices.
13511331 */
1352
- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) &&
1353
- pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
1332
+ if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)) &&
1333
+ dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32))) {
13541334 printk(KERN_ERR "atl2: No usable DMA configuration, aborting\n");
13551335 err = -EIO;
13561336 goto err_dma;
....@@ -1703,9 +1683,6 @@
17031683 */
17041684 static int __init atl2_init_module(void)
17051685 {
1706
- printk(KERN_INFO "%s - version %s\n", atl2_driver_string,
1707
- atl2_driver_version);
1708
- printk(KERN_INFO "%s\n", atl2_copyright);
17091686 return pci_register_driver(&atl2_driver);
17101687 }
17111688 module_init(atl2_init_module);
....@@ -2026,8 +2003,6 @@
20262003 struct atl2_adapter *adapter = netdev_priv(netdev);
20272004
20282005 strlcpy(drvinfo->driver, atl2_driver_name, sizeof(drvinfo->driver));
2029
- strlcpy(drvinfo->version, atl2_driver_version,
2030
- sizeof(drvinfo->version));
20312006 strlcpy(drvinfo->fw_version, "L2", sizeof(drvinfo->fw_version));
20322007 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
20332008 sizeof(drvinfo->bus_info));
....@@ -2944,7 +2919,7 @@
29442919 if (*value == ent->i) {
29452920 if (ent->str[0] != '\0')
29462921 printk(KERN_INFO "%s\n", ent->str);
2947
- return 0;
2922
+ return 0;
29482923 }
29492924 }
29502925 break;