Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55100cfa authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Richard Weinberger
Browse files

mtd: chips/map_rom.c: implement point and unpoint methods



This will allow for the removal of the get_unmapped_area method later.

Signed-off-by: default avatarNicolas Pitre <nico@linaro.org>
Acked-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: default avatarChris Brandt <chris.brandt@renesas.com>
[rw: fixed build]
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 2caaf2d8
Loading
Loading
Loading
Loading
+25 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,10 @@ static struct mtd_info *map_rom_probe(struct map_info *map);
static int maprom_erase (struct mtd_info *mtd, struct erase_info *info);
static int maprom_erase (struct mtd_info *mtd, struct erase_info *info);
static unsigned long maprom_unmapped_area(struct mtd_info *, unsigned long,
static unsigned long maprom_unmapped_area(struct mtd_info *, unsigned long,
					  unsigned long, unsigned long);
					  unsigned long, unsigned long);
static int maprom_point (struct mtd_info *mtd, loff_t from, size_t len,
			 size_t *retlen, void **virt, resource_size_t *phys);
static int maprom_unpoint(struct mtd_info *mtd, loff_t from, size_t len);



static struct mtd_chip_driver maprom_chipdrv = {
static struct mtd_chip_driver maprom_chipdrv = {
	.probe	= map_rom_probe,
	.probe	= map_rom_probe,
@@ -52,6 +56,8 @@ static struct mtd_info *map_rom_probe(struct map_info *map)
	mtd->type = MTD_ROM;
	mtd->type = MTD_ROM;
	mtd->size = map->size;
	mtd->size = map->size;
	mtd->_get_unmapped_area = maprom_unmapped_area;
	mtd->_get_unmapped_area = maprom_unmapped_area;
	mtd->_point = maprom_point;
	mtd->_unpoint = maprom_unpoint;
	mtd->_read = maprom_read;
	mtd->_read = maprom_read;
	mtd->_write = maprom_write;
	mtd->_write = maprom_write;
	mtd->_sync = maprom_nop;
	mtd->_sync = maprom_nop;
@@ -80,6 +86,25 @@ static unsigned long maprom_unmapped_area(struct mtd_info *mtd,
	return (unsigned long) map->virt + offset;
	return (unsigned long) map->virt + offset;
}
}


static int maprom_point(struct mtd_info *mtd, loff_t from, size_t len,
			size_t *retlen, void **virt, resource_size_t *phys)
{
	struct map_info *map = mtd->priv;

	if (!map->virt)
		return -EINVAL;
	*virt = map->virt + from;
	if (phys)
		*phys = map->phys + from;
	*retlen = len;
	return 0;
}

static int maprom_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
{
	return 0;
}

static int maprom_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
static int maprom_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
{
{
	struct map_info *map = mtd->priv;
	struct map_info *map = mtd->priv;