Re: linux-next: build warning after merge of the pci tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 10, 2012 at 08:03:21PM +1100, Stephen Rothwell wrote:
> Hi Bjorn,
> 
> After merging the pci tree, today's linux-next build (powerpc
> ppc44x_defconfig) produced this warning:
> 
> drivers/pci/rom.c: In function 'pci_map_rom':
> drivers/pci/rom.c:125:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> 
> Introduced by commit 84c1b80e3263 ("PCI: Add support for non-BAR ROMs").

I propose the following patch to fix this warning.  Any comments?  If
it looks OK, I'll add it this afternoon.

commit dbd3fc3345390a989a033427aa915a0dfb62149f
Author: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
Date:   Mon Dec 10 11:24:42 2012 -0700

    PCI: Use phys_addr_t for physical ROM address
    
    Use phys_addr_t rather than "void *" for physical memory address.
    This removes casts and fixes a "cast from pointer to integer of different
    size" warning on ppc44x_defconfig.
    
    Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>

diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index fddb9f6..d07f3bb 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -628,8 +628,8 @@ int pcibios_add_device(struct pci_dev *dev)
 			    (PCI_FUNC(dev->devfn) == rom->function) &&
 			    (dev->vendor == rom->vendor) &&
 			    (dev->device == rom->devid)) {
-				dev->rom = (void *)(unsigned long)(pa_data +
-				      offsetof(struct pci_setup_rom, romdata));
+				dev->rom = pa_data +
+				      offsetof(struct pci_setup_rom, romdata);
 				dev->romlen = rom->pcilen;
 			}
 		}
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 3a3828f..ab886b7 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -122,7 +122,7 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
 	 */
 	if (pdev->rom && pdev->romlen) {
 		*size = pdev->romlen;
-		return phys_to_virt((phys_addr_t)pdev->rom);
+		return phys_to_virt(pdev->rom);
 	/*
 	 * IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy
 	 * memory map if the VGA enable bit of the Bridge Control register is
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f116b2d..957563b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -333,7 +333,7 @@ struct pci_dev {
 	};
 	struct pci_ats	*ats;	/* Address Translation Service */
 #endif
-	void *rom; /* Physical pointer to ROM if it's not from the BAR */
+	phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */
 	size_t romlen; /* Length of ROM if it's not from the BAR */
 };
 
--
To unsubscribe from this list: send the line "unsubscribe linux-next" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux