.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Support for PCI bridges found on Power Macintoshes. |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2003-2005 Benjamin Herrenschmuidt (benh@kernel.crashing.org) |
---|
5 | 6 | * 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. |
---|
11 | 7 | */ |
---|
12 | 8 | |
---|
13 | 9 | #include <linux/kernel.h> |
---|
.. | .. |
---|
501 | 497 | /* XXX it would be better here to identify the specific |
---|
502 | 498 | PCI-PCI bridge chip we have. */ |
---|
503 | 499 | 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")) |
---|
507 | 501 | goto done; |
---|
508 | 502 | if (pci_device_from_OF_node(p2pbridge, &bus, &devfn) < 0) { |
---|
509 | 503 | DBG("Can't find PCI infos for PCI<->PCI bridge\n"); |
---|
.. | .. |
---|
828 | 822 | if (of_device_is_compatible(dev, "uni-north")) { |
---|
829 | 823 | primary = setup_uninorth(hose, &rsrc); |
---|
830 | 824 | disp_name = "UniNorth"; |
---|
831 | | - } else if (strcmp(dev->name, "pci") == 0) { |
---|
| 825 | + } else if (of_node_name_eq(dev, "pci")) { |
---|
832 | 826 | /* XXX assume this is a mpc106 (grackle) */ |
---|
833 | 827 | setup_grackle(hose); |
---|
834 | 828 | disp_name = "Grackle (MPC106)"; |
---|
835 | | - } else if (strcmp(dev->name, "bandit") == 0) { |
---|
| 829 | + } else if (of_node_name_eq(dev, "bandit")) { |
---|
836 | 830 | setup_bandit(hose, &rsrc); |
---|
837 | 831 | disp_name = "Bandit"; |
---|
838 | | - } else if (strcmp(dev->name, "chaos") == 0) { |
---|
| 832 | + } else if (of_node_name_eq(dev, "chaos")) { |
---|
839 | 833 | setup_chaos(hose, &rsrc); |
---|
840 | 834 | disp_name = "Chaos"; |
---|
841 | 835 | primary = 0; |
---|
.. | .. |
---|
914 | 908 | "of device tree\n"); |
---|
915 | 909 | return; |
---|
916 | 910 | } |
---|
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")) { |
---|
923 | 915 | if (pmac_add_bridge(np) == 0) |
---|
924 | 916 | of_node_get(np); |
---|
925 | 917 | } |
---|
926 | | - if (strcmp(np->name, "ht") == 0) { |
---|
| 918 | + if (of_node_name_eq(np, "ht")) { |
---|
927 | 919 | of_node_get(np); |
---|
928 | 920 | ht = np; |
---|
929 | 921 | } |
---|
.. | .. |
---|
983 | 975 | /* Firewire & GMAC were disabled after PCI probe, the driver is |
---|
984 | 976 | * claiming them, we must re-enable them now. |
---|
985 | 977 | */ |
---|
986 | | - if (uninorth_child && !strcmp(node->name, "firewire") && |
---|
| 978 | + if (uninorth_child && of_node_name_eq(node, "firewire") && |
---|
987 | 979 | (of_device_is_compatible(node, "pci106b,18") || |
---|
988 | 980 | of_device_is_compatible(node, "pci106b,30") || |
---|
989 | 981 | of_device_is_compatible(node, "pci11c1,5811"))) { |
---|
.. | .. |
---|
991 | 983 | pmac_call_feature(PMAC_FTR_1394_ENABLE, node, 0, 1); |
---|
992 | 984 | updatecfg = 1; |
---|
993 | 985 | } |
---|
994 | | - if (uninorth_child && !strcmp(node->name, "ethernet") && |
---|
| 986 | + if (uninorth_child && of_node_name_eq(node, "ethernet") && |
---|
995 | 987 | of_device_is_compatible(node, "gmac")) { |
---|
996 | 988 | pmac_call_feature(PMAC_FTR_GMAC_ENABLE, node, 0, 1); |
---|
997 | 989 | updatecfg = 1; |
---|
.. | .. |
---|
1262 | 1254 | .enable_device_hook = pmac_pci_enable_device_hook, |
---|
1263 | 1255 | #endif |
---|
1264 | 1256 | }; |
---|
1265 | | - |
---|