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
@@ -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;
|
||||
|
Reference in New Issue
Block a user