hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* 10G controller driver for Samsung SoCs
23 *
34 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
45 * http://www.samsung.com
56 *
67 * Author: Siva Reddy Kallam <siva.kallam@samsung.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -33,12 +30,15 @@
3330 {
3431 struct device_node *np = pdev->dev.of_node;
3532 struct sxgbe_dma_cfg *dma_cfg;
33
+ int err;
3634
3735 if (!np)
3836 return -ENODEV;
3937
4038 *mac = of_get_mac_address(np);
41
- plat->interface = of_get_phy_mode(np);
39
+ err = of_get_phy_mode(np, &plat->interface);
40
+ if (err && err != -ENODEV)
41
+ return err;
4242
4343 plat->bus_id = of_alias_get_id(np, "ethernet");
4444 if (plat->bus_id < 0)
....@@ -81,7 +81,6 @@
8181 {
8282 int ret;
8383 int i, chan;
84
- struct resource *res;
8584 struct device *dev = &pdev->dev;
8685 void __iomem *addr;
8786 struct sxgbe_priv_data *priv = NULL;
....@@ -91,8 +90,7 @@
9190 struct device_node *node = dev->of_node;
9291
9392 /* Get memory resource */
94
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
95
- addr = devm_ioremap_resource(dev, res);
93
+ addr = devm_platform_ioremap_resource(pdev, 0);
9694 if (IS_ERR(addr))
9795 return PTR_ERR(addr);
9896
....@@ -124,7 +122,7 @@
124122 }
125123
126124 /* Get MAC address if available (DT) */
127
- if (mac)
125
+ if (!IS_ERR_OR_NULL(mac))
128126 ether_addr_copy(priv->dev->dev_addr, mac);
129127
130128 /* Get the TX/RX IRQ numbers */