Commit b70d3a2c authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

iomap: fix 64 bits resources on 32 bits

Almost all implementations of pci_iomap() in the kernel, including the generic
lib/iomap.c one, copies the content of a struct resource into unsigned long's
which will break on 32 bits platforms with 64 bits resources.

This fixes all definitions of pci_iomap() to use resource_size_t.  I also
"fixed" the 64bits arch for consistency.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 626adeb6
...@@ -514,8 +514,8 @@ sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn) ...@@ -514,8 +514,8 @@ sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{ {
unsigned long start = pci_resource_start(dev, bar); resource_size_t start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar); resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar); unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start) if (!len || !start)
......
...@@ -26,8 +26,8 @@ EXPORT_SYMBOL(ioport_unmap); ...@@ -26,8 +26,8 @@ EXPORT_SYMBOL(ioport_unmap);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{ {
unsigned long start = pci_resource_start(dev, bar); resource_size_t start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar); resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar); unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start) if (!len || !start)
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{ {
unsigned long start = pci_resource_start(dev, bar); resource_size_t start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar); resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar); unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start) if (!len || !start)
......
...@@ -45,8 +45,8 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev, ...@@ -45,8 +45,8 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev,
*/ */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{ {
unsigned long start = pci_resource_start(dev, bar); resource_size_t start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar); resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar); unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start) if (!len || !start)
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
*/ */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{ {
unsigned long start = pci_resource_start(dev, bar); resource_size_t start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar); resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar); unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start) if (!len || !start)
......
...@@ -438,8 +438,8 @@ void ioport_unmap(void __iomem *addr) ...@@ -438,8 +438,8 @@ void ioport_unmap(void __iomem *addr)
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{ {
unsigned long start = pci_resource_start(dev, bar); resource_size_t start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar); resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar); unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start) if (!len || !start)
......
...@@ -1121,8 +1121,8 @@ void __init pci_init_resource(struct resource *res, resource_size_t start, ...@@ -1121,8 +1121,8 @@ void __init pci_init_resource(struct resource *res, resource_size_t start,
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
{ {
unsigned long start = pci_resource_start(dev, bar); resource_size_t start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar); resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar); unsigned long flags = pci_resource_flags(dev, bar);
if (!len) if (!len)
......
...@@ -191,8 +191,8 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq) ...@@ -191,8 +191,8 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq)
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{ {
unsigned long start = pci_resource_start(dev, bar); resource_size_t start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar); resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar); unsigned long flags = pci_resource_flags(dev, bar);
if (unlikely(!len || !start)) if (unlikely(!len || !start))
......
...@@ -21,8 +21,8 @@ EXPORT_SYMBOL(ioport_unmap); ...@@ -21,8 +21,8 @@ EXPORT_SYMBOL(ioport_unmap);
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{ {
unsigned long start = pci_resource_start(dev, bar); resource_size_t start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar); resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar); unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start) if (!len || !start)
......
...@@ -21,8 +21,8 @@ EXPORT_SYMBOL(ioport_unmap); ...@@ -21,8 +21,8 @@ EXPORT_SYMBOL(ioport_unmap);
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{ {
unsigned long start = pci_resource_start(dev, bar); resource_size_t start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar); resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar); unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start) if (!len || !start)
......
...@@ -790,8 +790,8 @@ pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr, ...@@ -790,8 +790,8 @@ pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr,
void __iomem *pci_iomap (struct pci_dev *dev, int bar, unsigned long max) void __iomem *pci_iomap (struct pci_dev *dev, int bar, unsigned long max)
{ {
unsigned long start = pci_resource_start (dev, bar); resource_size_t start = pci_resource_start (dev, bar);
unsigned long len = pci_resource_len (dev, bar); resource_size_t len = pci_resource_len (dev, bar);
if (!start || len == 0) if (!start || len == 0)
return 0; return 0;
......
...@@ -257,7 +257,7 @@ EXPORT_SYMBOL(ioport_unmap); ...@@ -257,7 +257,7 @@ EXPORT_SYMBOL(ioport_unmap);
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{ {
resource_size_t start = pci_resource_start(dev, bar); resource_size_t start = pci_resource_start(dev, bar);
unsigned long len = pci_resource_len(dev, bar); resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar); unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start) if (!len || !start)
......
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