powerpc/pci: Make both ppc32 and ppc64 use sysdata for pci_controller
Currently, ppc32 uses sysdata for the pci_controller pointer, and ppc64 uses it to hold the device_node pointer. This patch moves the of_node pointer into (struct pci_bus*)->dev.of_node and (struct pci_dev*)->dev.of_node so that sysdata can be converted to always use the pci_controller pointer instead. It also fixes up the allocating of pci devices so that the of_node pointer gets assigned consistently and increments the ref count. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
parent
04bea68b2f
commit
b5d937de03
10 changed files with 24 additions and 42 deletions
|
@ -161,7 +161,7 @@ static void *is_devfn_node(struct device_node *dn, void *data)
|
|||
/*
|
||||
* This is the "slow" path for looking up a device_node from a
|
||||
* pci_dev. It will hunt for the device under its parent's
|
||||
* phb and then update sysdata for a future fastpath.
|
||||
* phb and then update of_node pointer.
|
||||
*
|
||||
* It may also do fixups on the actual device since this happens
|
||||
* on the first read/write.
|
||||
|
@ -170,16 +170,19 @@ static void *is_devfn_node(struct device_node *dn, void *data)
|
|||
* In this case it may probe for real hardware ("just in case")
|
||||
* and add a device_node to the device tree if necessary.
|
||||
*
|
||||
* Is this function necessary anymore now that dev->dev.of_node is
|
||||
* used to store the node pointer?
|
||||
*
|
||||
*/
|
||||
struct device_node *fetch_dev_dn(struct pci_dev *dev)
|
||||
{
|
||||
struct device_node *orig_dn = dev->sysdata;
|
||||
struct device_node *orig_dn = dev->dev.of_node;
|
||||
struct device_node *dn;
|
||||
unsigned long searchval = (dev->bus->number << 8) | dev->devfn;
|
||||
|
||||
dn = traverse_pci_devices(orig_dn, is_devfn_node, (void *)searchval);
|
||||
if (dn)
|
||||
dev->sysdata = dn;
|
||||
dev->dev.of_node = dn;
|
||||
return dn;
|
||||
}
|
||||
EXPORT_SYMBOL(fetch_dev_dn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue