Skip to contentSkip to conversation

MTD: add physical address to point() api -- core changes

PATCH In review Jared Hulbert 2 participants 2 messages Nov 8, 2007 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 MTD: add physical address to point() api -- core changes

Adding the ability to get a physical address from point() in addition to virtual address. This physical address will be required for axfs and cramfs with XIP.

----

drivers/mtd/mtdpart.c +0 -0
index 6174a97..5f62018 100644
@@ -68,7 +68,7 @@ static int part_read (struct mtd_info *mtd, loff_t

from, size_t len,
}

static int part_point (struct mtd_info *mtd, loff_t from, size_t len,
- size_t *retlen, u_char **buf)
+ size_t *retlen, void **virt, resource_size_t *phys)
{
struct mtd_part *part = PART(mtd);
if (from >= mtd->size)
@@ -76,14 +76,14 @@ static int part_point (struct mtd_info *mtd, loff_t from, size_t len,
else if (from + len > mtd->size)
len = mtd->size - from;
return part->master->point (part->master, from + part->offset,
- len, retlen, buf);
+ len, retlen, virt, phys);
}

-static void part_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
+static void part_unpoint (struct mtd_info *mtd, loff_t from, size_t len)
{
struct mtd_part *part = PART(mtd);

- part->master->unpoint (part->master, addr, from + part->offset, len);
+ part->master->unpoint (part->master, from + part->offset, len);
}

static int part_read_oob(struct mtd_info *mtd, loff_t from,

include/linux/mtd/mtd.h +0 -1
index 783fc98..041ce23 100644
@@ -143,10 +143,12 @@ struct mtd_info {
 	int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
 
 	/* This stuff for eXecute-In-Place */
-	int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t

*retlen, u_char **mtdbuf);
+ /* phys is optional and may be set to NULL */
+ int (*point) (struct mtd_info *mtd, loff_t from, size_t len,
+ size_t *retlen, void **virt, resource_size_t *phys);

/* We probably shouldn't allow XIP if the unpoint isn't a NULL */
- void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from,
size_t len);
+ void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len);

int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t
*retlen, u_char *buf);

#1 lore raw
Quoted 4 lines · Jared Hulbert

Adding the ability to get a physical address from point() in addition to virtual address. This physical address will be required for axfs and cramfs with XIP.

In principle this patchset looks good. Three things I noticed:
- The hunk pointed out.
- Mails are word-wrapped. If you cannot fix gmail you can resend them with mutt on lazybastard.org.
- For merge patches should be combined to a single one. Git bisect would become unhappy otherwise. For review the split patchset is nice.

Jörn

Signature · 2 lines
Premature optimization is the root of all evil.
-- Donald Knuth