.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright(c) 2006 - 2007 Atheros Corporation. All rights reserved. |
---|
3 | 4 | * Copyright(c) 2007 - 2008 Chris Snook <csnook@redhat.com> |
---|
4 | 5 | * |
---|
5 | 6 | * Derived from Intel e1000 driver |
---|
6 | 7 | * 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. |
---|
21 | 8 | */ |
---|
22 | 9 | |
---|
23 | 10 | #include <linux/atomic.h> |
---|
.. | .. |
---|
49 | 36 | |
---|
50 | 37 | #include "atl2.h" |
---|
51 | 38 | |
---|
52 | | -#define ATL2_DRV_VERSION "2.2.3" |
---|
53 | | - |
---|
54 | 39 | 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; |
---|
58 | 40 | static const struct ethtool_ops atl2_ethtool_ops; |
---|
59 | 41 | |
---|
60 | 42 | MODULE_AUTHOR("Atheros Corporation <xiong.huang@atheros.com>, Chris Snook <csnook@redhat.com>"); |
---|
61 | 43 | MODULE_DESCRIPTION("Atheros Fast Ethernet Network Driver"); |
---|
62 | 44 | MODULE_LICENSE("GPL"); |
---|
63 | | -MODULE_VERSION(ATL2_DRV_VERSION); |
---|
64 | 45 | |
---|
65 | 46 | /* |
---|
66 | 47 | * atl2_pci_tbl - PCI Device ID Table |
---|
.. | .. |
---|
300 | 281 | adapter->txs_ring_size * 4 + 7 + /* dword align */ |
---|
301 | 282 | adapter->rxd_ring_size * 1536 + 127; /* 128bytes align */ |
---|
302 | 283 | |
---|
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); |
---|
305 | 286 | if (!adapter->ring_vir_addr) |
---|
306 | 287 | return -ENOMEM; |
---|
307 | | - memset(adapter->ring_vir_addr, 0, adapter->ring_size); |
---|
308 | 288 | |
---|
309 | 289 | /* Init TXD Ring */ |
---|
310 | 290 | adapter->txd_dma = adapter->ring_dma ; |
---|
.. | .. |
---|
553 | 533 | netdev->stats.tx_aborted_errors++; |
---|
554 | 534 | if (txs->late_col) |
---|
555 | 535 | netdev->stats.tx_window_errors++; |
---|
556 | | - if (txs->underun) |
---|
| 536 | + if (txs->underrun) |
---|
557 | 537 | netdev->stats.tx_fifo_errors++; |
---|
558 | 538 | } while (1); |
---|
559 | 539 | |
---|
.. | .. |
---|
683 | 663 | static void atl2_free_ring_resources(struct atl2_adapter *adapter) |
---|
684 | 664 | { |
---|
685 | 665 | 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); |
---|
688 | 668 | } |
---|
689 | 669 | |
---|
690 | 670 | /** |
---|
.. | .. |
---|
908 | 888 | ATL2_WRITE_REGW(&adapter->hw, REG_MB_TXD_WR_IDX, |
---|
909 | 889 | (adapter->txd_write_ptr >> 2)); |
---|
910 | 890 | |
---|
911 | | - mmiowb(); |
---|
912 | | - dev_kfree_skb_any(skb); |
---|
| 891 | + dev_consume_skb_any(skb); |
---|
913 | 892 | return NETDEV_TX_OK; |
---|
914 | 893 | } |
---|
915 | 894 | |
---|
.. | .. |
---|
1015 | 994 | /** |
---|
1016 | 995 | * atl2_tx_timeout - Respond to a Tx Hang |
---|
1017 | 996 | * @netdev: network interface device structure |
---|
| 997 | + * @txqueue: index of the hanging transmit queue |
---|
1018 | 998 | */ |
---|
1019 | | -static void atl2_tx_timeout(struct net_device *netdev) |
---|
| 999 | +static void atl2_tx_timeout(struct net_device *netdev, unsigned int txqueue) |
---|
1020 | 1000 | { |
---|
1021 | 1001 | struct atl2_adapter *adapter = netdev_priv(netdev); |
---|
1022 | 1002 | |
---|
.. | .. |
---|
1026 | 1006 | |
---|
1027 | 1007 | /** |
---|
1028 | 1008 | * 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 |
---|
1030 | 1010 | */ |
---|
1031 | 1011 | static void atl2_watchdog(struct timer_list *t) |
---|
1032 | 1012 | { |
---|
.. | .. |
---|
1051 | 1031 | |
---|
1052 | 1032 | /** |
---|
1053 | 1033 | * 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 |
---|
1055 | 1035 | */ |
---|
1056 | 1036 | static void atl2_phy_config(struct timer_list *t) |
---|
1057 | 1037 | { |
---|
.. | .. |
---|
1106 | 1086 | |
---|
1107 | 1087 | static void atl2_reinit_locked(struct atl2_adapter *adapter) |
---|
1108 | 1088 | { |
---|
1109 | | - WARN_ON(in_interrupt()); |
---|
1110 | 1089 | while (test_and_set_bit(__ATL2_RESETTING, &adapter->flags)) |
---|
1111 | 1090 | msleep(1); |
---|
1112 | 1091 | atl2_down(adapter); |
---|
.. | .. |
---|
1256 | 1235 | |
---|
1257 | 1236 | /** |
---|
1258 | 1237 | * atl2_link_chg_task - deal with link change event Out of interrupt context |
---|
| 1238 | + * @work: pointer to work struct with private info |
---|
1259 | 1239 | */ |
---|
1260 | 1240 | static void atl2_link_chg_task(struct work_struct *work) |
---|
1261 | 1241 | { |
---|
.. | .. |
---|
1349 | 1329 | * until the kernel has the proper infrastructure to support 64-bit DMA |
---|
1350 | 1330 | * on these devices. |
---|
1351 | 1331 | */ |
---|
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))) { |
---|
1354 | 1334 | printk(KERN_ERR "atl2: No usable DMA configuration, aborting\n"); |
---|
1355 | 1335 | err = -EIO; |
---|
1356 | 1336 | goto err_dma; |
---|
.. | .. |
---|
1703 | 1683 | */ |
---|
1704 | 1684 | static int __init atl2_init_module(void) |
---|
1705 | 1685 | { |
---|
1706 | | - printk(KERN_INFO "%s - version %s\n", atl2_driver_string, |
---|
1707 | | - atl2_driver_version); |
---|
1708 | | - printk(KERN_INFO "%s\n", atl2_copyright); |
---|
1709 | 1686 | return pci_register_driver(&atl2_driver); |
---|
1710 | 1687 | } |
---|
1711 | 1688 | module_init(atl2_init_module); |
---|
.. | .. |
---|
2026 | 2003 | struct atl2_adapter *adapter = netdev_priv(netdev); |
---|
2027 | 2004 | |
---|
2028 | 2005 | strlcpy(drvinfo->driver, atl2_driver_name, sizeof(drvinfo->driver)); |
---|
2029 | | - strlcpy(drvinfo->version, atl2_driver_version, |
---|
2030 | | - sizeof(drvinfo->version)); |
---|
2031 | 2006 | strlcpy(drvinfo->fw_version, "L2", sizeof(drvinfo->fw_version)); |
---|
2032 | 2007 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
---|
2033 | 2008 | sizeof(drvinfo->bus_info)); |
---|
.. | .. |
---|
2944 | 2919 | if (*value == ent->i) { |
---|
2945 | 2920 | if (ent->str[0] != '\0') |
---|
2946 | 2921 | printk(KERN_INFO "%s\n", ent->str); |
---|
2947 | | - return 0; |
---|
| 2922 | + return 0; |
---|
2948 | 2923 | } |
---|
2949 | 2924 | } |
---|
2950 | 2925 | break; |
---|