9
0
Fork 0

sandbox: switch to resource

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2011-07-29 15:16:45 +08:00
parent b1be292352
commit 005b35a13b
4 changed files with 5 additions and 15 deletions

View File

@ -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);
}

View File

View File

@ -4,7 +4,7 @@
struct hf_platform_data {
int fd;
size_t size;
unsigned long map_base;
unsigned long base;
char *filename;
char *name;
};

View File

@ -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);
}