Skip to content

Commit 0b94a1e

Browse files
mpepaulusmack
authored andcommitted
[POWERPC] Store the base address in dcr_host_t
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>
1 parent ca786f8 commit 0b94a1e

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎arch/powerpc/sysdev/dcr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ u64 of_translate_dcr_address(struct device_node *dev,
104104
dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
105105
unsigned int dcr_c)
106106
{
107-
dcr_host_t ret = { .token = NULL, .stride = 0 };
107+
dcr_host_t ret = { .token = NULL, .stride = 0, .base = dcr_n };
108108
u64 addr;
109109

110110
pr_debug("dcr_map(%s, 0x%x, 0x%x)\n",

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323

2424
#include <asm/io.h>
2525

26-
typedef struct { void __iomem *token; unsigned int stride; } dcr_host_t;
26+
typedef struct {
27+
void __iomem *token;
28+
unsigned int stride;
29+
unsigned int base;
30+
} dcr_host_t;
2731

2832
#define DCR_MAP_OK(host) ((host).token != NULL)
2933

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
#ifdef __KERNEL__
2323
#ifndef __ASSEMBLY__
2424

25-
typedef struct {} dcr_host_t;
25+
typedef struct {
26+
unsigned int base;
27+
} dcr_host_t;
2628

2729
#define DCR_MAP_OK(host) (1)
2830

29-
#define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){})
31+
#define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){ .base = (dcr_n) })
3032
#define dcr_unmap(host, dcr_n, dcr_c) do {} while (0)
3133
#define dcr_read(host, dcr_n) mfdcr(dcr_n)
3234
#define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value)

0 commit comments

Comments
 (0)