forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/net/ethernet/micrel/ks8842.c
....@@ -1,19 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ks8842.c timberdale KS8842 ethernet driver
34 * 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.
175 */
186
197 /* Supports:
....@@ -592,19 +580,17 @@
592580 dma_unmap_single(adapter->dev, sg_dma_address(sg),
593581 DMA_BUFFER_SIZE, DMA_FROM_DEVICE);
594582 sg_dma_address(sg) = 0;
595
- if (ctl->skb)
596
- dev_kfree_skb(ctl->skb);
597
-
583
+ dev_kfree_skb(ctl->skb);
598584 ctl->skb = NULL;
599585
600586 printk(KERN_ERR DRV_NAME": Failed to start RX DMA: %d\n", err);
601587 return err;
602588 }
603589
604
-static void ks8842_rx_frame_dma_tasklet(unsigned long arg)
590
+static void ks8842_rx_frame_dma_tasklet(struct tasklet_struct *t)
605591 {
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;
608594 struct ks8842_rx_dma_ctl *ctl = &adapter->dma_rx;
609595 struct sk_buff *skb = ctl->skb;
610596 dma_addr_t addr = sg_dma_address(&ctl->sg);
....@@ -734,10 +720,10 @@
734720 netdev->stats.rx_fifo_errors++;
735721 }
736722
737
-static void ks8842_tasklet(unsigned long arg)
723
+static void ks8842_tasklet(struct tasklet_struct *t)
738724 {
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;
741727 u16 isr;
742728 unsigned long flags;
743729 u16 entry_bank;
....@@ -967,8 +953,7 @@
967953 goto err;
968954 }
969955
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);
972957
973958 return 0;
974959 err:
....@@ -1117,7 +1102,7 @@
11171102 __ks8842_start_new_rx_dma(netdev);
11181103 }
11191104
1120
-static void ks8842_tx_timeout(struct net_device *netdev)
1105
+static void ks8842_tx_timeout(struct net_device *netdev, unsigned int txqueue)
11211106 {
11221107 struct ks8842_adapter *adapter = netdev_priv(netdev);
11231108
....@@ -1191,7 +1176,7 @@
11911176 adapter->dma_tx.channel = -1;
11921177 }
11931178
1194
- tasklet_init(&adapter->tasklet, ks8842_tasklet, (unsigned long)netdev);
1179
+ tasklet_setup(&adapter->tasklet, ks8842_tasklet);
11951180 spin_lock_init(&adapter->lock);
11961181
11971182 netdev->netdev_ops = &ks8842_netdev_ops;