[POWERPC] Store the base address in dcr_host_t
authorMichael Ellerman <michael@ellerman.id.au>
Mon, 17 Sep 2007 06:05:00 +0000 (16:05 +1000)
committerPaul Mackerras <paulus@samba.org>
Wed, 3 Oct 2007 03:25:27 +0000 (13:25 +1000)
In its current form, dcr_map() doesn't remember the base address you passed
it, which means you need to store it somewhere else.  Rather than adding the
base to another struct it seems simpler to store it in the dcr_host_t.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/sysdev/dcr.c
include/asm-powerpc/dcr-mmio.h
include/asm-powerpc/dcr-native.h

index e82d54de8a8db06cee43fec4f67a73af8f6bea19..ab11c0b2902459a7434e0331f6741d7b82765c78 100644 (file)
@@ -104,7 +104,7 @@ u64 of_translate_dcr_address(struct device_node *dev,
 dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
                   unsigned int dcr_c)
 {
-       dcr_host_t ret = { .token = NULL, .stride = 0 };
+       dcr_host_t ret = { .token = NULL, .stride = 0, .base = dcr_n };
        u64 addr;
 
        pr_debug("dcr_map(%s, 0x%x, 0x%x)\n",
index 5dbfca8dde3661d7f779f39d3b87c56604aa7239..6b82c3ba495a37c14b0d9b3df4d426fc4b78e5b7 100644 (file)
 
 #include <asm/io.h>
 
-typedef struct { void __iomem *token; unsigned int stride; } dcr_host_t;
+typedef struct {
+       void __iomem *token;
+       unsigned int stride;
+       unsigned int base;
+} dcr_host_t;
 
 #define DCR_MAP_OK(host)       ((host).token != NULL)
 
index 05af081222f6ba7c0a1ac8f8cf90b4def3cbb487..f41058c0f6cb95ebc2d18db98ac7d5210b65b2c8 100644 (file)
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
-typedef struct {} dcr_host_t;
+typedef struct {
+       unsigned int base;
+} dcr_host_t;
 
 #define DCR_MAP_OK(host)       (1)
 
-#define dcr_map(dev, dcr_n, dcr_c)     ((dcr_host_t){})
+#define dcr_map(dev, dcr_n, dcr_c)     ((dcr_host_t){ .base = (dcr_n) })
 #define dcr_unmap(host, dcr_n, dcr_c)  do {} while (0)
 #define dcr_read(host, dcr_n)          mfdcr(dcr_n)
 #define dcr_write(host, dcr_n, value)  mtdcr(dcr_n, value)