hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/drivers/net/ethernet/davicom/dm9000.c
....@@ -1,16 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Davicom DM9000 Fast Ethernet driver for Linux.
34 * Copyright (C) 1997 Sten Wang
4
- *
5
- * This program is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU General Public License
7
- * as published by the Free Software Foundation; either version 2
8
- * of the License, or (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
145 *
156 * (C) Copyright 1997-1998 DAVICOM Semiconductor,Inc. All Rights Reserved.
167 *
....@@ -51,7 +42,6 @@
5142 #define DM9000_PHY 0x40 /* PHY address 0x01 */
5243
5344 #define CARDNAME "dm9000"
54
-#define DRV_VERSION "1.31"
5545
5646 /*
5747 * Transmit timeout, default 5 seconds.
....@@ -397,6 +387,7 @@
397387
398388 case 3:
399389 dev_dbg(db->dev, ": 3 byte IO, falling back to 16bit\n");
390
+ fallthrough;
400391 case 2:
401392 db->dumpblk = dm9000_dumpblk_16bit;
402393 db->outblk = dm9000_outblk_16bit;
....@@ -553,7 +544,6 @@
553544 struct board_info *dm = to_dm9000_board(dev);
554545
555546 strlcpy(info->driver, CARDNAME, sizeof(info->driver));
556
- strlcpy(info->version, DRV_VERSION, sizeof(info->version));
557547 strlcpy(info->bus_info, to_platform_device(dm->dev)->name,
558548 sizeof(info->bus_info));
559549 }
....@@ -974,7 +964,7 @@
974964 }
975965
976966 /* Our watchdog timed out. Called by the networking layer */
977
-static void dm9000_timeout(struct net_device *dev)
967
+static void dm9000_timeout(struct net_device *dev, unsigned int txqueue)
978968 {
979969 struct board_info *db = netdev_priv(dev);
980970 u8 reg_save;
....@@ -1413,8 +1403,10 @@
14131403 pdata->flags |= DM9000_PLATF_NO_EEPROM;
14141404
14151405 mac_addr = of_get_mac_address(np);
1416
- if (mac_addr)
1417
- memcpy(pdata->dev_addr, mac_addr, sizeof(pdata->dev_addr));
1406
+ if (!IS_ERR(mac_addr))
1407
+ ether_addr_copy(pdata->dev_addr, mac_addr);
1408
+ else if (PTR_ERR(mac_addr) == -EPROBE_DEFER)
1409
+ return ERR_CAST(mac_addr);
14181410
14191411 return pdata;
14201412 }
....@@ -1516,13 +1508,11 @@
15161508
15171509 ndev->irq = platform_get_irq(pdev, 0);
15181510 if (ndev->irq < 0) {
1519
- dev_err(db->dev, "interrupt resource unavailable: %d\n",
1520
- ndev->irq);
15211511 ret = ndev->irq;
15221512 goto out;
15231513 }
15241514
1525
- db->irq_wake = platform_get_irq(pdev, 1);
1515
+ db->irq_wake = platform_get_irq_optional(pdev, 1);
15261516 if (db->irq_wake >= 0) {
15271517 dev_dbg(db->dev, "wakeup irq %d\n", db->irq_wake);
15281518
....@@ -1734,8 +1724,7 @@
17341724 static int
17351725 dm9000_drv_suspend(struct device *dev)
17361726 {
1737
- struct platform_device *pdev = to_platform_device(dev);
1738
- struct net_device *ndev = platform_get_drvdata(pdev);
1727
+ struct net_device *ndev = dev_get_drvdata(dev);
17391728 struct board_info *db;
17401729
17411730 if (ndev) {
....@@ -1757,8 +1746,7 @@
17571746 static int
17581747 dm9000_drv_resume(struct device *dev)
17591748 {
1760
- struct platform_device *pdev = to_platform_device(dev);
1761
- struct net_device *ndev = platform_get_drvdata(pdev);
1749
+ struct net_device *ndev = dev_get_drvdata(dev);
17621750 struct board_info *db = netdev_priv(ndev);
17631751
17641752 if (ndev) {