Commit cdbd3865acc2e98a349b41d130985e6f5f2dfc19
Committed by
Jeff Garzik
1 parent
83f34df4e7
Exists in
master
and in
7 other branches
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>
Showing 4 changed files with 5 additions and 5 deletions Side-by-side Diff
arch/powerpc/sysdev/dcr.c
... | ... | @@ -126,13 +126,13 @@ |
126 | 126 | } |
127 | 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 | 131 | dcr_host_t h = host; |
132 | 132 | |
133 | 133 | if (h.token == NULL) |
134 | 134 | return; |
135 | - h.token += dcr_n * h.stride; | |
135 | + h.token += host.base * h.stride; | |
136 | 136 | iounmap(h.token); |
137 | 137 | h.token = NULL; |
138 | 138 | } |
drivers/net/ibm_newemac/mal.c
include/asm-powerpc/dcr-mmio.h
... | ... | @@ -33,7 +33,7 @@ |
33 | 33 | |
34 | 34 | extern dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n, |
35 | 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 | 38 | static inline u32 dcr_read(dcr_host_t host, unsigned int dcr_n) |
39 | 39 | { |
include/asm-powerpc/dcr-native.h
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | #define DCR_MAP_OK(host) (1) |
30 | 30 | |
31 | 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 | 33 | #define dcr_read(host, dcr_n) mfdcr(dcr_n + host.base) |
34 | 34 | #define dcr_write(host, dcr_n, value) mtdcr(dcr_n + host.base, value) |
35 | 35 |