Re: [PATCH 1/5] pci/of: Match PCI devices to OF nodes dynamically

From: David Miller
Date: Thu Apr 07 2011 - 18:27:48 EST


From: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 7 Apr 2011 13:26:32 +1000

> powerpc has two different ways of matching PCI devices to their
> corresponding OF node (if any) for historical reasons. The ppc64 one
> does a scan looking for matching bus/dev/fn, while the ppc32 one does a
> scan looking only for matching dev/fn on each level in order to be
> agnostic to busses being renumbered (which Linux does on some
> platforms).
>
> This removes both and instead moves the matching code to the PCI core
> itself. It's the most logical place to do it: when a pci_dev is created,
> we know the parent and thus can do a single level scan for the matching
> device_node (if any).
>
> The benefit is that all archs now get the matching for free. There's one
> hook the arch might want to provide to match a PHB bus to its device
> node. A default weak implementation is provided that looks for the
> parent device device node, but it's not entirely reliable on powerpc for
> various reasons so powerpc provides its own.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>

This patch breaks the build on sparc:

> diff --git a/drivers/pci/of.c b/drivers/pci/of.c
> new file mode 100644
> index 0000000..c94d37e
> --- /dev/null
> +++ b/drivers/pci/of.c

This gets compiled in on all CONFIG_OF platforms, and:

> +void pci_set_of_node(struct pci_dev *dev)
> +{
> + if (!dev->bus->dev.of_node)
> + return;
> + dev->dev.of_node = of_pci_find_child_device(dev->bus->dev.of_node,
> + dev->devfn);
> +}

it references of_pci_find_child_device().

However, of_pci_find_child_device() lives in drivers/of/of_pci.c which is not
built into the tree because you haven't provided the necessary changes to
drivers/of/Makefile in this patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/