.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Davicom DM9000 Fast Ethernet driver for Linux. |
---|
3 | 4 | * 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. |
---|
14 | 5 | * |
---|
15 | 6 | * (C) Copyright 1997-1998 DAVICOM Semiconductor,Inc. All Rights Reserved. |
---|
16 | 7 | * |
---|
.. | .. |
---|
51 | 42 | #define DM9000_PHY 0x40 /* PHY address 0x01 */ |
---|
52 | 43 | |
---|
53 | 44 | #define CARDNAME "dm9000" |
---|
54 | | -#define DRV_VERSION "1.31" |
---|
55 | 45 | |
---|
56 | 46 | /* |
---|
57 | 47 | * Transmit timeout, default 5 seconds. |
---|
.. | .. |
---|
397 | 387 | |
---|
398 | 388 | case 3: |
---|
399 | 389 | dev_dbg(db->dev, ": 3 byte IO, falling back to 16bit\n"); |
---|
| 390 | + fallthrough; |
---|
400 | 391 | case 2: |
---|
401 | 392 | db->dumpblk = dm9000_dumpblk_16bit; |
---|
402 | 393 | db->outblk = dm9000_outblk_16bit; |
---|
.. | .. |
---|
553 | 544 | struct board_info *dm = to_dm9000_board(dev); |
---|
554 | 545 | |
---|
555 | 546 | strlcpy(info->driver, CARDNAME, sizeof(info->driver)); |
---|
556 | | - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
---|
557 | 547 | strlcpy(info->bus_info, to_platform_device(dm->dev)->name, |
---|
558 | 548 | sizeof(info->bus_info)); |
---|
559 | 549 | } |
---|
.. | .. |
---|
974 | 964 | } |
---|
975 | 965 | |
---|
976 | 966 | /* 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) |
---|
978 | 968 | { |
---|
979 | 969 | struct board_info *db = netdev_priv(dev); |
---|
980 | 970 | u8 reg_save; |
---|
.. | .. |
---|
1413 | 1403 | pdata->flags |= DM9000_PLATF_NO_EEPROM; |
---|
1414 | 1404 | |
---|
1415 | 1405 | 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); |
---|
1418 | 1410 | |
---|
1419 | 1411 | return pdata; |
---|
1420 | 1412 | } |
---|
.. | .. |
---|
1516 | 1508 | |
---|
1517 | 1509 | ndev->irq = platform_get_irq(pdev, 0); |
---|
1518 | 1510 | if (ndev->irq < 0) { |
---|
1519 | | - dev_err(db->dev, "interrupt resource unavailable: %d\n", |
---|
1520 | | - ndev->irq); |
---|
1521 | 1511 | ret = ndev->irq; |
---|
1522 | 1512 | goto out; |
---|
1523 | 1513 | } |
---|
1524 | 1514 | |
---|
1525 | | - db->irq_wake = platform_get_irq(pdev, 1); |
---|
| 1515 | + db->irq_wake = platform_get_irq_optional(pdev, 1); |
---|
1526 | 1516 | if (db->irq_wake >= 0) { |
---|
1527 | 1517 | dev_dbg(db->dev, "wakeup irq %d\n", db->irq_wake); |
---|
1528 | 1518 | |
---|
.. | .. |
---|
1734 | 1724 | static int |
---|
1735 | 1725 | dm9000_drv_suspend(struct device *dev) |
---|
1736 | 1726 | { |
---|
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); |
---|
1739 | 1728 | struct board_info *db; |
---|
1740 | 1729 | |
---|
1741 | 1730 | if (ndev) { |
---|
.. | .. |
---|
1757 | 1746 | static int |
---|
1758 | 1747 | dm9000_drv_resume(struct device *dev) |
---|
1759 | 1748 | { |
---|
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); |
---|
1762 | 1750 | struct board_info *db = netdev_priv(ndev); |
---|
1763 | 1751 | |
---|
1764 | 1752 | if (ndev) { |
---|