Commit d7b41b1f authored by Kumar Gala's avatar Kumar Gala Committed by Benjamin Herrenschmidt
Browse files

powerpc/pci: clean up direct access to sysdata by iseries platform



We shouldn't directly access sysdata to get the device node.  We should
be calling pci_device_to_OF_node().

Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
Tested-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Acked-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 80947e7c
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -177,7 +177,7 @@ static struct iommu_table *iommu_table_find(struct iommu_table * tbl)
static void pci_dma_dev_setup_iseries(struct pci_dev *pdev)
static void pci_dma_dev_setup_iseries(struct pci_dev *pdev)
{
{
	struct iommu_table *tbl;
	struct iommu_table *tbl;
	struct device_node *dn = pdev->sysdata;
	struct device_node *dn = pci_device_to_OF_node(pdev);
	struct pci_dn *pdn = PCI_DN(dn);
	struct pci_dn *pdn = PCI_DN(dn);
	const u32 *lsn = of_get_property(dn, "linux,logical-slot-number", NULL);
	const u32 *lsn = of_get_property(dn, "linux,logical-slot-number", NULL);


+4 −4
Original line number Original line Diff line number Diff line
@@ -318,6 +318,7 @@ static void __init iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
{
{
	struct resource *bar_res = &dev->resource[bar_num];
	struct resource *bar_res = &dev->resource[bar_num];
	long bar_size = pci_resource_len(dev, bar_num);
	long bar_size = pci_resource_len(dev, bar_num);
	struct device_node *dn = pci_device_to_OF_node(dev);


	/*
	/*
	 * No space to allocate, quick exit, skip Allocation.
	 * No space to allocate, quick exit, skip Allocation.
@@ -335,9 +336,9 @@ static void __init iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
	 * Allocate the number of table entries needed for BAR.
	 * Allocate the number of table entries needed for BAR.
	 */
	 */
	while (bar_size > 0 ) {
	while (bar_size > 0 ) {
		iomm_table[current_iomm_table_entry] = dev->sysdata;
		iomm_table[current_iomm_table_entry] = dn;
		ds_addr_table[current_iomm_table_entry] =
		ds_addr_table[current_iomm_table_entry] =
			iseries_ds_addr(dev->sysdata) | (bar_num << 24);
			iseries_ds_addr(dn) | (bar_num << 24);
		bar_size -= IOMM_TABLE_ENTRY_SIZE;
		bar_size -= IOMM_TABLE_ENTRY_SIZE;
		++current_iomm_table_entry;
		++current_iomm_table_entry;
	}
	}
@@ -410,7 +411,7 @@ void __init iSeries_pcibios_fixup_resources(struct pci_dev *pdev)
	struct device_node *node;
	struct device_node *node;
	int i;
	int i;


	node = find_device_node(bus, pdev->devfn);
	node = pci_device_to_OF_node(pdev);
	pr_debug("PCI: iSeries %s, pdev %p, node %p\n",
	pr_debug("PCI: iSeries %s, pdev %p, node %p\n",
		 pci_name(pdev), pdev, node);
		 pci_name(pdev), pdev, node);
	if (!node) {
	if (!node) {
@@ -441,7 +442,6 @@ void __init iSeries_pcibios_fixup_resources(struct pci_dev *pdev)
		}
		}
	}
	}


	pdev->sysdata = node;
	allocate_device_bars(pdev);
	allocate_device_bars(pdev);
	iseries_device_information(pdev, bus, *sub_bus);
	iseries_device_information(pdev, bus, *sub_bus);
}
}