diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2007-10-15 05:34:37 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-15 14:29:49 -0400 |
commit | cdbd3865acc2e98a349b41d130985e6f5f2dfc19 (patch) | |
tree | 8df0ce10364d82c205ed6ec7d8ab9af9a2fe2989 | |
parent | 83f34df4e7c8794a5a81ede663fe184f4201308a (diff) |
Use dcr_host_t.base in dcr_unmap()
With the base stored in dcr_host_t, there's no need for callers to pass
the dcr_n into dcr_unmap(). In fact this removes the possibility of them
passing the incorrect value, which would then be iounmap()'ed.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | arch/powerpc/sysdev/dcr.c | 4 | ||||
-rw-r--r-- | drivers/net/ibm_newemac/mal.c | 2 | ||||
-rw-r--r-- | include/asm-powerpc/dcr-mmio.h | 2 | ||||
-rw-r--r-- | include/asm-powerpc/dcr-native.h | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c index ab11c0b29024..427027c7ea0f 100644 --- a/arch/powerpc/sysdev/dcr.c +++ b/arch/powerpc/sysdev/dcr.c | |||
@@ -126,13 +126,13 @@ dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n, | |||
126 | } | 126 | } |
127 | EXPORT_SYMBOL_GPL(dcr_map); | 127 | EXPORT_SYMBOL_GPL(dcr_map); |
128 | 128 | ||
129 | void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c) | 129 | void dcr_unmap(dcr_host_t host, unsigned int dcr_c) |
130 | { | 130 | { |
131 | dcr_host_t h = host; | 131 | dcr_host_t h = host; |
132 | 132 | ||
133 | if (h.token == NULL) | 133 | if (h.token == NULL) |
134 | return; | 134 | return; |
135 | h.token += dcr_n * h.stride; | 135 | h.token += host.base * h.stride; |
136 | iounmap(h.token); | 136 | iounmap(h.token); |
137 | h.token = NULL; | 137 | h.token = NULL; |
138 | } | 138 | } |
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c index 748a86969d73..39f4cb6b0cf3 100644 --- a/drivers/net/ibm_newemac/mal.c +++ b/drivers/net/ibm_newemac/mal.c | |||
@@ -627,7 +627,7 @@ static int __devinit mal_probe(struct of_device *ofdev, | |||
627 | fail2: | 627 | fail2: |
628 | dma_free_coherent(&ofdev->dev, bd_size, mal->bd_virt, mal->bd_dma); | 628 | dma_free_coherent(&ofdev->dev, bd_size, mal->bd_virt, mal->bd_dma); |
629 | fail_unmap: | 629 | fail_unmap: |
630 | dcr_unmap(mal->dcr_host, dcr_base, 0x100); | 630 | dcr_unmap(mal->dcr_host, 0x100); |
631 | fail: | 631 | fail: |
632 | kfree(mal); | 632 | kfree(mal); |
633 | 633 | ||
diff --git a/include/asm-powerpc/dcr-mmio.h b/include/asm-powerpc/dcr-mmio.h index a7d9eaf22702..08532ff1899c 100644 --- a/include/asm-powerpc/dcr-mmio.h +++ b/include/asm-powerpc/dcr-mmio.h | |||
@@ -33,7 +33,7 @@ typedef struct { | |||
33 | 33 | ||
34 | extern dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n, | 34 | extern dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n, |
35 | unsigned int dcr_c); | 35 | unsigned int dcr_c); |
36 | extern void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c); | 36 | extern void dcr_unmap(dcr_host_t host, unsigned int dcr_c); |
37 | 37 | ||
38 | static inline u32 dcr_read(dcr_host_t host, unsigned int dcr_n) | 38 | static inline u32 dcr_read(dcr_host_t host, unsigned int dcr_n) |
39 | { | 39 | { |
diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h index 3bc780f6513a..8dbb1ab0aa04 100644 --- a/include/asm-powerpc/dcr-native.h +++ b/include/asm-powerpc/dcr-native.h | |||
@@ -29,7 +29,7 @@ typedef struct { | |||
29 | #define DCR_MAP_OK(host) (1) | 29 | #define DCR_MAP_OK(host) (1) |
30 | 30 | ||
31 | #define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){ .base = (dcr_n) }) | 31 | #define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){ .base = (dcr_n) }) |
32 | #define dcr_unmap(host, dcr_n, dcr_c) do {} while (0) | 32 | #define dcr_unmap(host, dcr_c) do {} while (0) |
33 | #define dcr_read(host, dcr_n) mfdcr(dcr_n + host.base) | 33 | #define dcr_read(host, dcr_n) mfdcr(dcr_n + host.base) |
34 | #define dcr_write(host, dcr_n, value) mtdcr(dcr_n + host.base, value) | 34 | #define dcr_write(host, dcr_n, value) mtdcr(dcr_n + host.base, value) |
35 | 35 | ||