From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: linux-mtd@lists.infradead.org
Subject: [PATCH 3/5] MTD: chips/map_rom.c: implement point and unpoint methods
Date: Tue, 10 Oct 2017 23:26:19 -0400 [thread overview]
Message-ID: <20171011032621.26979-4-nicolas.pitre@linaro.org> (raw)
In-Reply-To: <20171011032621.26979-1-nicolas.pitre@linaro.org>
Signed-off-by: Nicolas Pitre <nico@linaro.org>
---
drivers/mtd/chips/map_rom.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/mtd/chips/map_rom.c b/drivers/mtd/chips/map_rom.c
index e67f73ab44..722afb1cf4 100644
--- a/drivers/mtd/chips/map_rom.c
+++ b/drivers/mtd/chips/map_rom.c
@@ -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 unsigned long maprom_unmapped_area(struct mtd_info *, 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 = {
.probe = map_rom_probe,
@@ -52,6 +56,8 @@ static struct mtd_info *map_rom_probe(struct map_info *map)
mtd->type = MTD_ROM;
mtd->size = map->size;
mtd->_get_unmapped_area = maprom_unmapped_area;
+ mtd->_point = maprom_point;
+ mtd->_unpoint = maprom_unpoint;
mtd->_read = maprom_read;
mtd->_write = maprom_write;
mtd->_sync = maprom_nop;
@@ -78,6 +84,24 @@ static unsigned long maprom_unmapped_area(struct mtd_info *mtd,
{
struct map_info *map = mtd->priv;
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)
--
2.9.5
next prev parent reply other threads:[~2017-10-11 3:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 3:26 [PATCH 0/5] unconfuse get_unmapped_area and point/unpoint driver methods Nicolas Pitre
2017-10-11 3:26 ` [PATCH 1/5] MTD: mtdram: properly handle the phys argument in the point method Nicolas Pitre
2017-10-11 20:47 ` Richard Weinberger
2017-10-11 21:32 ` Nicolas Pitre
2017-10-11 21:40 ` Richard Weinberger
2017-10-11 21:53 ` Nicolas Pitre
2017-10-11 3:26 ` [PATCH 2/5] MTD: chips/map_ram.c: implement point and unpoint methods Nicolas Pitre
2017-10-11 20:48 ` Richard Weinberger
2017-10-11 3:26 ` Nicolas Pitre [this message]
2017-10-11 20:49 ` [PATCH 3/5] MTD: chips/map_rom.c: " Richard Weinberger
2017-10-11 20:56 ` Nicolas Pitre
2017-10-11 3:26 ` [PATCH 4/5] MTD: implement mtd_get_unmapped_area() using the point method Nicolas Pitre
2017-10-11 20:51 ` Richard Weinberger
2017-10-11 3:26 ` [PATCH 5/5] MTD: remove the get_unmapped_area method Nicolas Pitre
2017-10-11 21:02 ` Richard Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171011032621.26979-4-nicolas.pitre@linaro.org \
--to=nicolas.pitre@linaro.org \
--cc=boris.brezillon@free-electrons.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).