forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/powerpc/platforms/powermac/pci.c
....@@ -1,13 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Support for PCI bridges found on Power Macintoshes.
34 *
45 * Copyright (C) 2003-2005 Benjamin Herrenschmuidt (benh@kernel.crashing.org)
56 * Copyright (C) 1997 Paul Mackerras (paulus@samba.org)
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * as published by the Free Software Foundation; either version
10
- * 2 of the License, or (at your option) any later version.
117 */
128
139 #include <linux/kernel.h>
....@@ -501,9 +497,7 @@
501497 /* XXX it would be better here to identify the specific
502498 PCI-PCI bridge chip we have. */
503499 p2pbridge = of_find_node_by_name(NULL, "pci-bridge");
504
- if (p2pbridge == NULL
505
- || p2pbridge->parent == NULL
506
- || strcmp(p2pbridge->parent->name, "pci") != 0)
500
+ if (p2pbridge == NULL || !of_node_name_eq(p2pbridge->parent, "pci"))
507501 goto done;
508502 if (pci_device_from_OF_node(p2pbridge, &bus, &devfn) < 0) {
509503 DBG("Can't find PCI infos for PCI<->PCI bridge\n");
....@@ -828,14 +822,14 @@
828822 if (of_device_is_compatible(dev, "uni-north")) {
829823 primary = setup_uninorth(hose, &rsrc);
830824 disp_name = "UniNorth";
831
- } else if (strcmp(dev->name, "pci") == 0) {
825
+ } else if (of_node_name_eq(dev, "pci")) {
832826 /* XXX assume this is a mpc106 (grackle) */
833827 setup_grackle(hose);
834828 disp_name = "Grackle (MPC106)";
835
- } else if (strcmp(dev->name, "bandit") == 0) {
829
+ } else if (of_node_name_eq(dev, "bandit")) {
836830 setup_bandit(hose, &rsrc);
837831 disp_name = "Bandit";
838
- } else if (strcmp(dev->name, "chaos") == 0) {
832
+ } else if (of_node_name_eq(dev, "chaos")) {
839833 setup_chaos(hose, &rsrc);
840834 disp_name = "Chaos";
841835 primary = 0;
....@@ -914,16 +908,14 @@
914908 "of device tree\n");
915909 return;
916910 }
917
- for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) {
918
- if (np->name == NULL)
919
- continue;
920
- if (strcmp(np->name, "bandit") == 0
921
- || strcmp(np->name, "chaos") == 0
922
- || strcmp(np->name, "pci") == 0) {
911
+ for_each_child_of_node(root, np) {
912
+ if (of_node_name_eq(np, "bandit")
913
+ || of_node_name_eq(np, "chaos")
914
+ || of_node_name_eq(np, "pci")) {
923915 if (pmac_add_bridge(np) == 0)
924916 of_node_get(np);
925917 }
926
- if (strcmp(np->name, "ht") == 0) {
918
+ if (of_node_name_eq(np, "ht")) {
927919 of_node_get(np);
928920 ht = np;
929921 }
....@@ -983,7 +975,7 @@
983975 /* Firewire & GMAC were disabled after PCI probe, the driver is
984976 * claiming them, we must re-enable them now.
985977 */
986
- if (uninorth_child && !strcmp(node->name, "firewire") &&
978
+ if (uninorth_child && of_node_name_eq(node, "firewire") &&
987979 (of_device_is_compatible(node, "pci106b,18") ||
988980 of_device_is_compatible(node, "pci106b,30") ||
989981 of_device_is_compatible(node, "pci11c1,5811"))) {
....@@ -991,7 +983,7 @@
991983 pmac_call_feature(PMAC_FTR_1394_ENABLE, node, 0, 1);
992984 updatecfg = 1;
993985 }
994
- if (uninorth_child && !strcmp(node->name, "ethernet") &&
986
+ if (uninorth_child && of_node_name_eq(node, "ethernet") &&
995987 of_device_is_compatible(node, "gmac")) {
996988 pmac_call_feature(PMAC_FTR_GMAC_ENABLE, node, 0, 1);
997989 updatecfg = 1;
....@@ -1262,4 +1254,3 @@
12621254 .enable_device_hook = pmac_pci_enable_device_hook,
12631255 #endif
12641256 };
1265
-