hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/net/ethernet/smsc/smc91x.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * smc91x.c
34 * This is a driver for SMSC's 91C9x/91C1xx single-chip Ethernet devices.
....@@ -7,19 +8,6 @@
78 * Developed by Simple Network Magic Corporation
89 * Copyright (C) 2003 Monta Vista Software, Inc.
910 * Unified SMC91x driver by Nicolas Pitre
10
- *
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License as published by
13
- * the Free Software Foundation; either version 2 of the License, or
14
- * (at your option) any later version.
15
- *
16
- * This program is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU General Public License
22
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
2311 *
2412 * Arguments:
2513 * io = for the base address
....@@ -390,8 +378,7 @@
390378 pending_skb = lp->pending_tx_skb;
391379 lp->pending_tx_skb = NULL;
392380 spin_unlock_irq(&lp->lock);
393
- if (pending_skb)
394
- dev_kfree_skb(pending_skb);
381
+ dev_kfree_skb(pending_skb);
395382
396383 /* and tell the card to stay away from that nasty outside world */
397384 SMC_SELECT_BANK(lp, 0);
....@@ -548,10 +535,10 @@
548535 /*
549536 * This is called to actually send a packet to the chip.
550537 */
551
-static void smc_hardware_send_pkt(unsigned long data)
538
+static void smc_hardware_send_pkt(struct tasklet_struct *t)
552539 {
553
- struct net_device *dev = (struct net_device *)data;
554
- struct smc_local *lp = netdev_priv(dev);
540
+ struct smc_local *lp = from_tasklet(lp, t, tx_task);
541
+ struct net_device *dev = lp->dev;
555542 void __iomem *ioaddr = lp->base;
556543 struct sk_buff *skb;
557544 unsigned int packet_no, len;
....@@ -701,7 +688,7 @@
701688 * Allocation succeeded: push packet to the chip's own memory
702689 * immediately.
703690 */
704
- smc_hardware_send_pkt((unsigned long)dev);
691
+ smc_hardware_send_pkt(&lp->tx_task);
705692 }
706693
707694 return NETDEV_TX_OK;
....@@ -1049,7 +1036,6 @@
10491036 int phyaddr = lp->mii.phy_id;
10501037 int my_phy_caps; /* My PHY capabilities */
10511038 int my_ad_caps; /* My Advertised capabilities */
1052
- int status;
10531039
10541040 DBG(3, dev, "smc_program_phy()\n");
10551041
....@@ -1123,7 +1109,7 @@
11231109 * auto-negotiation is restarted, sometimes it isn't ready and
11241110 * the link does not come up.
11251111 */
1126
- status = smc_phy_read(dev, phyaddr, MII_ADVERTISE);
1112
+ smc_phy_read(dev, phyaddr, MII_ADVERTISE);
11271113
11281114 DBG(2, dev, "phy caps=%x\n", my_phy_caps);
11291115 DBG(2, dev, "phy advertised caps=%x\n", my_ad_caps);
....@@ -1334,7 +1320,7 @@
13341320 #endif
13351321
13361322 /* Our watchdog timed out. Called by the networking layer */
1337
-static void smc_timeout(struct net_device *dev)
1323
+static void smc_timeout(struct net_device *dev, unsigned int txqueue)
13381324 {
13391325 struct smc_local *lp = netdev_priv(dev);
13401326 void __iomem *ioaddr = lp->base;
....@@ -1978,7 +1964,7 @@
19781964 dev->netdev_ops = &smc_netdev_ops;
19791965 dev->ethtool_ops = &smc_ethtool_ops;
19801966
1981
- tasklet_init(&lp->tx_task, smc_hardware_send_pkt, (unsigned long)dev);
1967
+ tasklet_setup(&lp->tx_task, smc_hardware_send_pkt);
19821968 INIT_WORK(&lp->phy_configure, smc_phy_configure);
19831969 lp->dev = dev;
19841970 lp->mii.phy_id_mask = 0x1f;
....@@ -2447,8 +2433,7 @@
24472433
24482434 static int smc_drv_suspend(struct device *dev)
24492435 {
2450
- struct platform_device *pdev = to_platform_device(dev);
2451
- struct net_device *ndev = platform_get_drvdata(pdev);
2436
+ struct net_device *ndev = dev_get_drvdata(dev);
24522437
24532438 if (ndev) {
24542439 if (netif_running(ndev)) {