[PATCH] powerpc: make ioport_map() handle already mapped ranges

Olof Johansson olof at lixom.net
Sun May 13 00:32:22 EST 2007


Make ioport_map() handle already mapped port range without trying
to add _IO_BASE to them.


Signed-off-by: Olof Johansson <olof at lixom.net>

Index: 2.6.21/arch/powerpc/kernel/iomap.c
===================================================================
--- 2.6.21.orig/arch/powerpc/kernel/iomap.c
+++ 2.6.21/arch/powerpc/kernel/iomap.c
@@ -106,7 +106,13 @@ EXPORT_SYMBOL(iowrite32_rep);
 
 void __iomem *ioport_map(unsigned long port, unsigned int len)
 {
-	return (void __iomem *) (port + _IO_BASE);
+	/* Do nothing if we're being asked to map an already
+	 * ioremapped() address
+	 */
+	if (port >= IMALLOC_BASE && (port+len) < IMALLOC_END)
+		return (void __iomem *) port;
+	else
+		return (void __iomem *) (port + _IO_BASE);
 }
 
 void ioport_unmap(void __iomem *addr)



More information about the Linuxppc-dev mailing list