Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx> --- arch/sandbox/board/hostfile.c | 14 ++------------ arch/sandbox/mach-sandbox/include/mach/hostfile.h | 2 +- arch/sandbox/os/common.c | 4 ++-- 3 files changed, 5 insertions(+), 15 deletions(-) create mode 100644 arch/sandbox/include/asm/io.h diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c index b049baa..f5452af 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 0000000..e69de29 diff --git a/arch/sandbox/mach-sandbox/include/mach/hostfile.h b/arch/sandbox/mach-sandbox/include/mach/hostfile.h index f7aca7c..7c4e67c 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 dcaf0c8..5074a06 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); } -- 1.7.5.4 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox