[PATCH] powerpc: minor cleanup of void ptr deref

linas linas at austin.ibm.com
Tue Dec 6 12:37:35 EST 2005


Paul,
Please apply.
--linas


Minor: use macro to perform void pointer deref; this may someday help 
avoid pointer typecasting errors.

Signed-off-by: Linas Vepstas <linas at austin.ibm.com>

--
Index: linux-2.6.15-rc3-mm1/arch/powerpc/platforms/powermac/pci.c
===================================================================
--- linux-2.6.15-rc3-mm1.orig/arch/powerpc/platforms/powermac/pci.c	2005-12-01 15:14:41.000000000 -0600
+++ linux-2.6.15-rc3-mm1/arch/powerpc/platforms/powermac/pci.c	2005-12-05 13:52:03.207941067 -0600
@@ -326,7 +326,7 @@
 	else
 		busdn = hose->arch_data;
 	for (dn = busdn->child; dn; dn = dn->sibling)
-		if (dn->data && PCI_DN(dn)->devfn == devfn)
+		if (PCI_DN(dn) && PCI_DN(dn)->devfn == devfn)
 			break;
 	if (dn == NULL)
 		return -1;
Index: linux-2.6.15-rc3-mm1/arch/powerpc/platforms/pseries/iommu.c
===================================================================
--- linux-2.6.15-rc3-mm1.orig/arch/powerpc/platforms/pseries/iommu.c	2005-12-01 15:14:41.000000000 -0600
+++ linux-2.6.15-rc3-mm1/arch/powerpc/platforms/pseries/iommu.c	2005-12-05 13:52:03.207941067 -0600
@@ -433,7 +433,7 @@
 		return;
 	}
 
-	ppci = pdn->data;
+	ppci = PCI_DN(pdn);
 	if (!ppci->iommu_table) {
 		/* Bussubno hasn't been copied yet.
 		 * Do it now because iommu_table_setparms_lpar needs it.
@@ -480,10 +480,10 @@
 	 * an already allocated iommu table is found and use that.
 	 */
 
-	while (dn && dn->data && PCI_DN(dn)->iommu_table == NULL)
+	while (dn && PCI_DN(dn) && PCI_DN(dn)->iommu_table == NULL)
 		dn = dn->parent;
 
-	if (dn && dn->data) {
+	if (dn && PCI_DN(dn)) {
 		PCI_DN(mydn)->iommu_table = PCI_DN(dn)->iommu_table;
 	} else {
 		DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, pci_name(dev));
@@ -494,7 +494,7 @@
 {
 	int err = NOTIFY_OK;
 	struct device_node *np = node;
-	struct pci_dn *pci = np->data;
+	struct pci_dn *pci = PCI_DN(np);
 
 	switch (action) {
 	case PSERIES_RECONFIG_REMOVE:
@@ -530,7 +530,7 @@
 	 */
 	dn = pci_device_to_OF_node(dev);
 
-	for (pdn = dn; pdn && pdn->data && !PCI_DN(pdn)->iommu_table;
+	for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table;
 	     pdn = pdn->parent) {
 		dma_window = (unsigned int *)
 			get_property(pdn, "ibm,dma-window", NULL);
@@ -549,7 +549,7 @@
 		DBG("Found DMA window, allocating table\n");
 	}
 
-	pci = pdn->data;
+	pci = PCI_DN(pdn);
 	if (!pci->iommu_table) {
 		/* iommu_table_setparms_lpar needs bussubno. */
 		pci->bussubno = pci->phb->bus->number;



More information about the Linuxppc64-dev mailing list