Commit e92ae95f authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: Use pci_device_to_OF_node

PCI_GET_DN() doesnt check to see if ->sysdata has been initialised
correctly - we should instead use pci_device_to_OF_node.  Leave
PCI_GET_DN() in the one performance critical case (iommu table lookup in
pci DMA functions).  In this case ->sysdata is guaranteed to have been
initialised by the iommu setup code.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4a5ae525
......@@ -290,7 +290,11 @@ static void iommu_buses_init_lpar(struct list_head *bus_list)
for (ln=bus_list->next; ln != bus_list; ln=ln->next) {
bus = pci_bus_b(ln);
busdn = PCI_GET_DN(bus);
if (bus->self)
busdn = pci_device_to_OF_node(bus->self);
else
busdn = bus->sysdata; /* must be a phb */
dma_window = (unsigned int *)get_property(busdn, "ibm,dma-window", NULL);
if (dma_window) {
......@@ -427,7 +431,7 @@ void iommu_setup_pSeries(void)
* up the device tree to find it.
*/
for_each_pci_dev(dev) {
mydn = dn = PCI_GET_DN(dev);
mydn = dn = pci_device_to_OF_node(dev);
while (dn && dn->iommu_table == NULL)
dn = dn->parent;
......
......@@ -43,6 +43,13 @@
#include <asm/iSeries/iSeries_pci.h>
#endif /* CONFIG_PPC_ISERIES */
/*
* We can use ->sysdata directly and avoid the extra work in
* pci_device_to_OF_node since ->sysdata will have been initialised
* in the iommu init code for all devices.
*/
#define PCI_GET_DN(dev) ((struct device_node *)((dev)->sysdata))
static inline struct iommu_table *devnode_table(struct pci_dev *dev)
{
if (!dev)
......
......@@ -94,11 +94,6 @@ extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
extern int pcibios_remove_root_bus(struct pci_controller *phb);
/* Use this macro after the PCI bus walk for max performance when it
* is known that sysdata is correct.
*/
#define PCI_GET_DN(dev) ((struct device_node *)((dev)->sysdata))
extern void phbs_remap_io(void);
static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment