| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 1999 - 2010 Intel Corporation. |
|---|
| 3 | 4 | * Copyright (C) 2010 - 2012 LAPIS SEMICONDUCTOR CO., LTD. |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * This code was derived from the Intel e1000e Linux driver. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 9 | | - * the Free Software Foundation; version 2 of the License. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
|---|
| 18 | 7 | */ |
|---|
| 19 | 8 | |
|---|
| 20 | 9 | #include "pch_gbe.h" |
|---|
| .. | .. |
|---|
| 299 | 288 | /** |
|---|
| 300 | 289 | * pch_gbe_wait_clr_bit - Wait to clear a bit |
|---|
| 301 | 290 | * @reg: Pointer of register |
|---|
| 302 | | - * @busy: Busy bit |
|---|
| 291 | + * @bit: Busy bit |
|---|
| 303 | 292 | */ |
|---|
| 304 | 293 | static void pch_gbe_wait_clr_bit(void *reg, u32 bit) |
|---|
| 305 | 294 | { |
|---|
| .. | .. |
|---|
| 1038 | 1027 | |
|---|
| 1039 | 1028 | /** |
|---|
| 1040 | 1029 | * pch_gbe_watchdog - Watchdog process |
|---|
| 1041 | | - * @data: Board private structure |
|---|
| 1030 | + * @t: timer list containing a Board private structure |
|---|
| 1042 | 1031 | */ |
|---|
| 1043 | 1032 | static void pch_gbe_watchdog(struct timer_list *t) |
|---|
| 1044 | 1033 | { |
|---|
| .. | .. |
|---|
| 1177 | 1166 | buffer_info->dma = 0; |
|---|
| 1178 | 1167 | buffer_info->time_stamp = 0; |
|---|
| 1179 | 1168 | tx_ring->next_to_use = ring_num; |
|---|
| 1169 | + dev_kfree_skb_any(skb); |
|---|
| 1180 | 1170 | return; |
|---|
| 1181 | 1171 | } |
|---|
| 1182 | 1172 | buffer_info->mapped = true; |
|---|
| .. | .. |
|---|
| 1430 | 1420 | |
|---|
| 1431 | 1421 | size = rx_ring->count * bufsz + PCH_GBE_RESERVE_MEMORY; |
|---|
| 1432 | 1422 | rx_ring->rx_buff_pool = |
|---|
| 1433 | | - dma_zalloc_coherent(&pdev->dev, size, |
|---|
| 1434 | | - &rx_ring->rx_buff_pool_logic, GFP_KERNEL); |
|---|
| 1423 | + dma_alloc_coherent(&pdev->dev, size, |
|---|
| 1424 | + &rx_ring->rx_buff_pool_logic, GFP_KERNEL); |
|---|
| 1435 | 1425 | if (!rx_ring->rx_buff_pool) |
|---|
| 1436 | 1426 | return -ENOMEM; |
|---|
| 1437 | 1427 | |
|---|
| .. | .. |
|---|
| 1745 | 1735 | |
|---|
| 1746 | 1736 | tx_ring->size = tx_ring->count * (int)sizeof(struct pch_gbe_tx_desc); |
|---|
| 1747 | 1737 | |
|---|
| 1748 | | - tx_ring->desc = dma_zalloc_coherent(&pdev->dev, tx_ring->size, |
|---|
| 1749 | | - &tx_ring->dma, GFP_KERNEL); |
|---|
| 1738 | + tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size, |
|---|
| 1739 | + &tx_ring->dma, GFP_KERNEL); |
|---|
| 1750 | 1740 | if (!tx_ring->desc) { |
|---|
| 1751 | 1741 | vfree(tx_ring->buffer_info); |
|---|
| 1752 | 1742 | return -ENOMEM; |
|---|
| .. | .. |
|---|
| 1788 | 1778 | return -ENOMEM; |
|---|
| 1789 | 1779 | |
|---|
| 1790 | 1780 | rx_ring->size = rx_ring->count * (int)sizeof(struct pch_gbe_rx_desc); |
|---|
| 1791 | | - rx_ring->desc = dma_zalloc_coherent(&pdev->dev, rx_ring->size, |
|---|
| 1792 | | - &rx_ring->dma, GFP_KERNEL); |
|---|
| 1781 | + rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, |
|---|
| 1782 | + &rx_ring->dma, GFP_KERNEL); |
|---|
| 1793 | 1783 | if (!rx_ring->desc) { |
|---|
| 1794 | 1784 | vfree(rx_ring->buffer_info); |
|---|
| 1795 | 1785 | return -ENOMEM; |
|---|
| .. | .. |
|---|
| 2068 | 2058 | * - NETDEV_TX_OK: Normal end |
|---|
| 2069 | 2059 | * - NETDEV_TX_BUSY: Error end |
|---|
| 2070 | 2060 | */ |
|---|
| 2071 | | -static int pch_gbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
|---|
| 2061 | +static netdev_tx_t pch_gbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
|---|
| 2072 | 2062 | { |
|---|
| 2073 | 2063 | struct pch_gbe_adapter *adapter = netdev_priv(netdev); |
|---|
| 2074 | 2064 | struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring; |
|---|
| .. | .. |
|---|
| 2274 | 2264 | /** |
|---|
| 2275 | 2265 | * pch_gbe_tx_timeout - Respond to a Tx Hang |
|---|
| 2276 | 2266 | * @netdev: Network interface device structure |
|---|
| 2267 | + * @txqueue: index of hanging queue |
|---|
| 2277 | 2268 | */ |
|---|
| 2278 | | -static void pch_gbe_tx_timeout(struct net_device *netdev) |
|---|
| 2269 | +static void pch_gbe_tx_timeout(struct net_device *netdev, unsigned int txqueue) |
|---|
| 2279 | 2270 | { |
|---|
| 2280 | 2271 | struct pch_gbe_adapter *adapter = netdev_priv(netdev); |
|---|
| 2281 | 2272 | |
|---|
| .. | .. |
|---|
| 2491 | 2482 | unregister_netdev(netdev); |
|---|
| 2492 | 2483 | |
|---|
| 2493 | 2484 | pch_gbe_phy_hw_reset(&adapter->hw); |
|---|
| 2485 | + pci_dev_put(adapter->ptp_pdev); |
|---|
| 2494 | 2486 | |
|---|
| 2495 | 2487 | free_netdev(netdev); |
|---|
| 2496 | 2488 | } |
|---|
| .. | .. |
|---|
| 2572 | 2564 | /* setup the private structure */ |
|---|
| 2573 | 2565 | ret = pch_gbe_sw_init(adapter); |
|---|
| 2574 | 2566 | if (ret) |
|---|
| 2575 | | - goto err_free_netdev; |
|---|
| 2567 | + goto err_put_dev; |
|---|
| 2576 | 2568 | |
|---|
| 2577 | 2569 | /* Initialize PHY */ |
|---|
| 2578 | 2570 | ret = pch_gbe_init_phy(adapter); |
|---|
| .. | .. |
|---|
| 2630 | 2622 | |
|---|
| 2631 | 2623 | err_free_adapter: |
|---|
| 2632 | 2624 | pch_gbe_phy_hw_reset(&adapter->hw); |
|---|
| 2625 | +err_put_dev: |
|---|
| 2626 | + pci_dev_put(adapter->ptp_pdev); |
|---|
| 2633 | 2627 | err_free_netdev: |
|---|
| 2634 | 2628 | free_netdev(netdev); |
|---|
| 2635 | 2629 | return ret; |
|---|