sandbox: switch to resource
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
parent
b1be292352
commit
005b35a13b
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
struct hf_platform_data {
|
||||
int fd;
|
||||
size_t size;
|
||||
unsigned long map_base;
|
||||
unsigned long base;
|
||||
char *filename;
|
||||
char *name;
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue