diff options
-rw-r--r-- | arch/sandbox/board/hostfile.c | 14 | ||||
-rw-r--r-- | arch/sandbox/include/asm/io.h | 0 | ||||
-rw-r--r-- | arch/sandbox/mach-sandbox/include/mach/hostfile.h | 2 | ||||
-rw-r--r-- | arch/sandbox/os/common.c | 4 |
4 files changed, 5 insertions, 15 deletions
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c index b049baa0a1..f5452afac9 100644 --- a/arch/sandbox/board/hostfile.c +++ b/arch/sandbox/board/hostfile.c @@ -102,17 +102,7 @@ device_initcall(hf_init); int barebox_register_filedev(struct hf_platform_data *hf) { - struct device_d *dev; - - dev = xzalloc(sizeof(struct device_d)); - - dev->platform_data = hf; - - strcpy(dev->name, "hostfile"); - dev->size = hf->size; - dev->id = -1; - dev->map_base = hf->map_base; - - return register_device(dev); + return !add_generic_device("hostfile", -1, NULL, hf->base, hf->size, + IORESOURCE_MEM, hf); } diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/arch/sandbox/include/asm/io.h diff --git a/arch/sandbox/mach-sandbox/include/mach/hostfile.h b/arch/sandbox/mach-sandbox/include/mach/hostfile.h index f7aca7c0c9..7c4e67cf68 100644 --- a/arch/sandbox/mach-sandbox/include/mach/hostfile.h +++ b/arch/sandbox/mach-sandbox/include/mach/hostfile.h @@ -4,7 +4,7 @@ struct hf_platform_data { int fd; size_t size; - unsigned long map_base; + unsigned long base; char *filename; char *name; }; diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c index dcaf0c837e..5074a06c80 100644 --- a/arch/sandbox/os/common.c +++ b/arch/sandbox/os/common.c @@ -236,10 +236,10 @@ static int add_image(char *str, char *name) hf->name = strdup(name); if (map) { - hf->map_base = (unsigned long)mmap(NULL, hf->size, + hf->base = (unsigned long)mmap(NULL, hf->size, PROT_READ | (readonly ? 0 : PROT_WRITE), MAP_SHARED, fd, 0); - if ((void *)hf->map_base == MAP_FAILED) + if ((void *)hf->base == MAP_FAILED) printf("warning: mmapping %s failed\n", file); } |