hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/ethernet/ti/netcp_core.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Keystone NetCP Core driver
34 *
....@@ -8,15 +9,6 @@
89 * Santosh Shilimkar <santosh.shilimkar@ti.com>
910 * Murali Karicheri <m-karicheri2@ti.com>
1011 * Wingman Kwok <w-kwok2@ti.com>
11
- *
12
- * This program is free software; you can redistribute it and/or
13
- * modify it under the terms of the GNU General Public License as
14
- * published by the Free Software Foundation version 2.
15
- *
16
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
17
- * kind, whether express or implied; without even the implied warranty
18
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU General Public License for more details.
2012 */
2113
2214 #include <linux/io.h>
....@@ -225,17 +217,6 @@
225217 return 0;
226218 }
227219
228
-static const char *netcp_node_name(struct device_node *node)
229
-{
230
- const char *name;
231
-
232
- if (of_property_read_string(node, "label", &name) < 0)
233
- name = node->name;
234
- if (!name)
235
- name = "unknown";
236
- return name;
237
-}
238
-
239220 /* Module management routines */
240221 static int netcp_register_interface(struct netcp_intf *netcp)
241222 {
....@@ -267,8 +248,13 @@
267248 }
268249
269250 for_each_available_child_of_node(devices, child) {
270
- const char *name = netcp_node_name(child);
251
+ const char *name;
252
+ char node_name[32];
271253
254
+ if (of_property_read_string(child, "label", &name) < 0) {
255
+ snprintf(node_name, sizeof(node_name), "%pOFn", child);
256
+ name = node_name;
257
+ }
272258 if (!strcasecmp(module->name, name))
273259 break;
274260 }
....@@ -1130,7 +1116,7 @@
11301116 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
11311117 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
11321118 struct page *page = skb_frag_page(frag);
1133
- u32 page_offset = frag->page_offset;
1119
+ u32 page_offset = skb_frag_off(frag);
11341120 u32 buf_len = skb_frag_size(frag);
11351121 dma_addr_t desc_dma;
11361122 u32 desc_dma_32;
....@@ -1364,9 +1350,9 @@
13641350 tx_pipe->dma_queue = knav_queue_open(name, tx_pipe->dma_queue_id,
13651351 KNAV_QUEUE_SHARED);
13661352 if (IS_ERR(tx_pipe->dma_queue)) {
1353
+ dev_err(dev, "Could not open DMA queue for channel \"%s\": %pe\n",
1354
+ name, tx_pipe->dma_queue);
13671355 ret = PTR_ERR(tx_pipe->dma_queue);
1368
- dev_err(dev, "Could not open DMA queue for channel \"%s\": %d\n",
1369
- name, ret);
13701356 goto err;
13711357 }
13721358
....@@ -1825,7 +1811,7 @@
18251811 return (ret == 0) ? 0 : err;
18261812 }
18271813
1828
-static void netcp_ndo_tx_timeout(struct net_device *ndev)
1814
+static void netcp_ndo_tx_timeout(struct net_device *ndev, unsigned int txqueue)
18291815 {
18301816 struct netcp_intf *netcp = netdev_priv(ndev);
18311817 unsigned int descs = knav_pool_count(netcp->tx_pool);
....@@ -2033,7 +2019,7 @@
20332019 goto quit;
20342020 }
20352021
2036
- efuse = devm_ioremap_nocache(dev, res.start, size);
2022
+ efuse = devm_ioremap(dev, res.start, size);
20372023 if (!efuse) {
20382024 dev_err(dev, "could not map resource\n");
20392025 devm_release_mem_region(dev, res.start, size);
....@@ -2051,7 +2037,7 @@
20512037 devm_release_mem_region(dev, res.start, size);
20522038 } else {
20532039 mac_addr = of_get_mac_address(node_interface);
2054
- if (mac_addr)
2040
+ if (!IS_ERR(mac_addr))
20552041 ether_addr_copy(ndev->dev_addr, mac_addr);
20562042 else
20572043 eth_random_addr(ndev->dev_addr);
....@@ -2209,8 +2195,8 @@
22092195 for_each_available_child_of_node(interfaces, child) {
22102196 ret = netcp_create_interface(netcp_device, child);
22112197 if (ret) {
2212
- dev_err(dev, "could not create interface(%s)\n",
2213
- child->name);
2198
+ dev_err(dev, "could not create interface(%pOFn)\n",
2199
+ child);
22142200 goto probe_quit_interface;
22152201 }
22162202 }