| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ks8842.c timberdale KS8842 ethernet driver |
|---|
| 3 | 4 | * Copyright (c) 2009 Intel Corporation |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 7 | | - * published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | - * GNU General Public License for more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * You should have received a copy of the GNU General Public License |
|---|
| 15 | | - * along with this program; if not, write to the Free Software |
|---|
| 16 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 17 | 5 | */ |
|---|
| 18 | 6 | |
|---|
| 19 | 7 | /* Supports: |
|---|
| .. | .. |
|---|
| 592 | 580 | dma_unmap_single(adapter->dev, sg_dma_address(sg), |
|---|
| 593 | 581 | DMA_BUFFER_SIZE, DMA_FROM_DEVICE); |
|---|
| 594 | 582 | sg_dma_address(sg) = 0; |
|---|
| 595 | | - if (ctl->skb) |
|---|
| 596 | | - dev_kfree_skb(ctl->skb); |
|---|
| 597 | | - |
|---|
| 583 | + dev_kfree_skb(ctl->skb); |
|---|
| 598 | 584 | ctl->skb = NULL; |
|---|
| 599 | 585 | |
|---|
| 600 | 586 | printk(KERN_ERR DRV_NAME": Failed to start RX DMA: %d\n", err); |
|---|
| 601 | 587 | return err; |
|---|
| 602 | 588 | } |
|---|
| 603 | 589 | |
|---|
| 604 | | -static void ks8842_rx_frame_dma_tasklet(unsigned long arg) |
|---|
| 590 | +static void ks8842_rx_frame_dma_tasklet(struct tasklet_struct *t) |
|---|
| 605 | 591 | { |
|---|
| 606 | | - struct net_device *netdev = (struct net_device *)arg; |
|---|
| 607 | | - struct ks8842_adapter *adapter = netdev_priv(netdev); |
|---|
| 592 | + struct ks8842_adapter *adapter = from_tasklet(adapter, t, dma_rx.tasklet); |
|---|
| 593 | + struct net_device *netdev = adapter->netdev; |
|---|
| 608 | 594 | struct ks8842_rx_dma_ctl *ctl = &adapter->dma_rx; |
|---|
| 609 | 595 | struct sk_buff *skb = ctl->skb; |
|---|
| 610 | 596 | dma_addr_t addr = sg_dma_address(&ctl->sg); |
|---|
| .. | .. |
|---|
| 734 | 720 | netdev->stats.rx_fifo_errors++; |
|---|
| 735 | 721 | } |
|---|
| 736 | 722 | |
|---|
| 737 | | -static void ks8842_tasklet(unsigned long arg) |
|---|
| 723 | +static void ks8842_tasklet(struct tasklet_struct *t) |
|---|
| 738 | 724 | { |
|---|
| 739 | | - struct net_device *netdev = (struct net_device *)arg; |
|---|
| 740 | | - struct ks8842_adapter *adapter = netdev_priv(netdev); |
|---|
| 725 | + struct ks8842_adapter *adapter = from_tasklet(adapter, t, tasklet); |
|---|
| 726 | + struct net_device *netdev = adapter->netdev; |
|---|
| 741 | 727 | u16 isr; |
|---|
| 742 | 728 | unsigned long flags; |
|---|
| 743 | 729 | u16 entry_bank; |
|---|
| .. | .. |
|---|
| 967 | 953 | goto err; |
|---|
| 968 | 954 | } |
|---|
| 969 | 955 | |
|---|
| 970 | | - tasklet_init(&rx_ctl->tasklet, ks8842_rx_frame_dma_tasklet, |
|---|
| 971 | | - (unsigned long)netdev); |
|---|
| 956 | + tasklet_setup(&rx_ctl->tasklet, ks8842_rx_frame_dma_tasklet); |
|---|
| 972 | 957 | |
|---|
| 973 | 958 | return 0; |
|---|
| 974 | 959 | err: |
|---|
| .. | .. |
|---|
| 1117 | 1102 | __ks8842_start_new_rx_dma(netdev); |
|---|
| 1118 | 1103 | } |
|---|
| 1119 | 1104 | |
|---|
| 1120 | | -static void ks8842_tx_timeout(struct net_device *netdev) |
|---|
| 1105 | +static void ks8842_tx_timeout(struct net_device *netdev, unsigned int txqueue) |
|---|
| 1121 | 1106 | { |
|---|
| 1122 | 1107 | struct ks8842_adapter *adapter = netdev_priv(netdev); |
|---|
| 1123 | 1108 | |
|---|
| .. | .. |
|---|
| 1191 | 1176 | adapter->dma_tx.channel = -1; |
|---|
| 1192 | 1177 | } |
|---|
| 1193 | 1178 | |
|---|
| 1194 | | - tasklet_init(&adapter->tasklet, ks8842_tasklet, (unsigned long)netdev); |
|---|
| 1179 | + tasklet_setup(&adapter->tasklet, ks8842_tasklet); |
|---|
| 1195 | 1180 | spin_lock_init(&adapter->lock); |
|---|
| 1196 | 1181 | |
|---|
| 1197 | 1182 | netdev->netdev_ops = &ks8842_netdev_ops; |
|---|