powerpc: Use device_type helpers to access the node type
Remove directly accessing device_node.type pointer and use the accessors instead. This will eventually allow removing the type pointer. Replace the open coded iterating over child nodes with for_each_child_of_node() while we're here. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
5b8d6be7b8
commit
e5480bdcc4
@@ -428,7 +428,7 @@ static void link_cache_lists(struct cache *smaller, struct cache *bigger)
|
||||
static void do_subsidiary_caches_debugcheck(struct cache *cache)
|
||||
{
|
||||
WARN_ON_ONCE(cache->level != 1);
|
||||
WARN_ON_ONCE(strcmp(cache->ofnode->type, "cpu"));
|
||||
WARN_ON_ONCE(!of_node_is_type(cache->ofnode, "cpu"));
|
||||
}
|
||||
|
||||
static void do_subsidiary_caches(struct cache *cache)
|
||||
|
@@ -327,8 +327,7 @@ static int isa_bridge_notify(struct notifier_block *nb, unsigned long action,
|
||||
/* Check if we have no ISA device, and this happens to be one,
|
||||
* register it as such if it has an OF device
|
||||
*/
|
||||
if (!isa_bridge_devnode && devnode && devnode->type &&
|
||||
!strcmp(devnode->type, "isa"))
|
||||
if (!isa_bridge_devnode && of_node_is_type(devnode, "isa"))
|
||||
isa_bridge_find_late(pdev, devnode);
|
||||
|
||||
return 0;
|
||||
|
@@ -192,7 +192,7 @@ static int __init add_legacy_soc_port(struct device_node *np,
|
||||
/* Add port, irq will be dealt with later. We passed a translated
|
||||
* IO port value. It will be fixed up later along with the irq
|
||||
*/
|
||||
if (tsi && !strcmp(tsi->type, "tsi-bridge"))
|
||||
if (of_node_is_type(tsi, "tsi-bridge"))
|
||||
return add_legacy_port(np, -1, UPIO_TSI, addr, addr,
|
||||
0, legacy_port_flags, 0);
|
||||
else
|
||||
@@ -417,7 +417,8 @@ void __init find_legacy_serial_ports(void)
|
||||
of_node_put(parent);
|
||||
continue;
|
||||
}
|
||||
if (strcmp(np->name, "serial") && strcmp(np->type, "serial")) {
|
||||
if (strcmp(np->name, "serial") &&
|
||||
!of_node_is_type(np, "serial")) {
|
||||
of_node_put(parent);
|
||||
continue;
|
||||
}
|
||||
|
@@ -125,16 +125,13 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
|
||||
struct pci_bus *bus, int devfn)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
const char *type;
|
||||
|
||||
dev = pci_alloc_dev(bus);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
type = of_get_property(node, "device_type", NULL);
|
||||
if (type == NULL)
|
||||
type = "";
|
||||
|
||||
pr_debug(" create device, devfn: %x, type: %s\n", devfn, type);
|
||||
pr_debug(" create device, devfn: %x, type: %s\n", devfn,
|
||||
of_node_get_device_type(node));
|
||||
|
||||
dev->dev.of_node = of_node_get(node);
|
||||
dev->dev.parent = bus->bridge;
|
||||
@@ -167,12 +164,12 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
|
||||
/* Early fixups, before probing the BARs */
|
||||
pci_fixup_device(pci_fixup_early, dev);
|
||||
|
||||
if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
|
||||
if (of_node_is_type(node, "pci") || of_node_is_type(node, "pciex")) {
|
||||
/* a PCI-PCI bridge */
|
||||
dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
|
||||
dev->rom_base_reg = PCI_ROM_ADDRESS1;
|
||||
set_pcie_hotplug_bridge(dev);
|
||||
} else if (!strcmp(type, "cardbus")) {
|
||||
} else if (of_node_is_type(node, "cardbus")) {
|
||||
dev->hdr_type = PCI_HEADER_TYPE_CARDBUS;
|
||||
} else {
|
||||
dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
|
||||
|
@@ -687,7 +687,7 @@ int check_legacy_ioport(unsigned long base_port)
|
||||
return ret;
|
||||
parent = of_get_parent(np);
|
||||
if (parent) {
|
||||
if (strcmp(parent->type, "isa") == 0)
|
||||
if (of_node_is_type(parent, "isa"))
|
||||
ret = 0;
|
||||
of_node_put(parent);
|
||||
}
|
||||
|
Reference in New Issue
Block a user