Skip to content

Commit cdbd386

Browse files
mpeJeff Garzik
authored andcommitted
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>
1 parent 83f34df commit cdbd386

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎arch/powerpc/sysdev/dcr.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
126126
}
127127
EXPORT_SYMBOL_GPL(dcr_map);
128128

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)
130130
{
131131
dcr_host_t h = host;
132132

133133
if (h.token == NULL)
134134
return;
135-
h.token += dcr_n * h.stride;
135+
h.token += host.base * h.stride;
136136
iounmap(h.token);
137137
h.token = NULL;
138138
}

‎drivers/net/ibm_newemac/mal.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ static int __devinit mal_probe(struct of_device *ofdev,
627627
fail2:
628628
dma_free_coherent(&ofdev->dev, bd_size, mal->bd_virt, mal->bd_dma);
629629
fail_unmap:
630-
dcr_unmap(mal->dcr_host, dcr_base, 0x100);
630+
dcr_unmap(mal->dcr_host, 0x100);
631631
fail:
632632
kfree(mal);
633633

‎include/asm-powerpc/dcr-mmio.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ typedef struct {
3333

3434
extern dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
3535
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);
3737

3838
static inline u32 dcr_read(dcr_host_t host, unsigned int dcr_n)
3939
{

‎include/asm-powerpc/dcr-native.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ typedef struct {
2929
#define DCR_MAP_OK(host) (1)
3030

3131
#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)
3333
#define dcr_read(host, dcr_n) mfdcr(dcr_n + host.base)
3434
#define dcr_write(host, dcr_n, value) mtdcr(dcr_n + host.base, value)
3535

0 commit comments

Comments
 (0)