diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2011-12-23 10:05:52 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:25:17 -0500 |
commit | 7219778ad9c18cc2c05c7fca0abe026afbc19dfb (patch) | |
tree | 509a11bf7f7ebeef9a4236901adf53e507d1455b | |
parent | d35ea200c0fb5315f16fb2599a4bafd9c1a7b386 (diff) |
mtd: introduce mtd_unpoint interface
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r-- | drivers/mtd/mtdpart.c | 2 | ||||
-rw-r--r-- | fs/jffs2/erase.c | 4 | ||||
-rw-r--r-- | fs/jffs2/readinode.c | 6 | ||||
-rw-r--r-- | fs/jffs2/scan.c | 4 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 8 |
5 files changed, 14 insertions, 10 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 5b664722e5b0..b09624a5497c 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -97,7 +97,7 @@ static void part_unpoint(struct mtd_info *mtd, loff_t from, size_t len) | |||
97 | { | 97 | { |
98 | struct mtd_part *part = PART(mtd); | 98 | struct mtd_part *part = PART(mtd); |
99 | 99 | ||
100 | part->master->unpoint(part->master, from + part->offset, len); | 100 | mtd_unpoint(part->master, from + part->offset, len); |
101 | } | 101 | } |
102 | 102 | ||
103 | static unsigned long part_get_unmapped_area(struct mtd_info *mtd, | 103 | static unsigned long part_get_unmapped_area(struct mtd_info *mtd, |
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index 53f8794fda6a..ffdf4fca9c54 100644 --- a/fs/jffs2/erase.c +++ b/fs/jffs2/erase.c | |||
@@ -349,7 +349,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl | |||
349 | if (retlen < c->sector_size) { | 349 | if (retlen < c->sector_size) { |
350 | /* Don't muck about if it won't let us point to the whole erase sector */ | 350 | /* Don't muck about if it won't let us point to the whole erase sector */ |
351 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", retlen)); | 351 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", retlen)); |
352 | c->mtd->unpoint(c->mtd, jeb->offset, retlen); | 352 | mtd_unpoint(c->mtd, jeb->offset, retlen); |
353 | goto do_flash_read; | 353 | goto do_flash_read; |
354 | } | 354 | } |
355 | wordebuf = ebuf-sizeof(*wordebuf); | 355 | wordebuf = ebuf-sizeof(*wordebuf); |
@@ -358,7 +358,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl | |||
358 | if (*++wordebuf != ~0) | 358 | if (*++wordebuf != ~0) |
359 | break; | 359 | break; |
360 | } while(--retlen); | 360 | } while(--retlen); |
361 | c->mtd->unpoint(c->mtd, jeb->offset, c->sector_size); | 361 | mtd_unpoint(c->mtd, jeb->offset, c->sector_size); |
362 | if (retlen) { | 362 | if (retlen) { |
363 | printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n", | 363 | printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n", |
364 | *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf)); | 364 | *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf)); |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index dde61effeda2..fca2f84e1add 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
@@ -67,7 +67,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info | |||
67 | NULL); | 67 | NULL); |
68 | if (!err && retlen < len) { | 68 | if (!err && retlen < len) { |
69 | JFFS2_WARNING("MTD point returned len too short: %zu instead of %u.\n", retlen, tn->csize); | 69 | JFFS2_WARNING("MTD point returned len too short: %zu instead of %u.\n", retlen, tn->csize); |
70 | c->mtd->unpoint(c->mtd, ofs, retlen); | 70 | mtd_unpoint(c->mtd, ofs, retlen); |
71 | } else if (err) | 71 | } else if (err) |
72 | JFFS2_WARNING("MTD point failed: error code %d.\n", err); | 72 | JFFS2_WARNING("MTD point failed: error code %d.\n", err); |
73 | else | 73 | else |
@@ -101,7 +101,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info | |||
101 | kfree(buffer); | 101 | kfree(buffer); |
102 | #ifndef __ECOS | 102 | #ifndef __ECOS |
103 | else | 103 | else |
104 | c->mtd->unpoint(c->mtd, ofs, len); | 104 | mtd_unpoint(c->mtd, ofs, len); |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | if (crc != tn->data_crc) { | 107 | if (crc != tn->data_crc) { |
@@ -137,7 +137,7 @@ free_out: | |||
137 | kfree(buffer); | 137 | kfree(buffer); |
138 | #ifndef __ECOS | 138 | #ifndef __ECOS |
139 | else | 139 | else |
140 | c->mtd->unpoint(c->mtd, ofs, len); | 140 | mtd_unpoint(c->mtd, ofs, len); |
141 | #endif | 141 | #endif |
142 | return err; | 142 | return err; |
143 | } | 143 | } |
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 53e05c8e5b69..72f3960f44a9 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
@@ -102,7 +102,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
102 | if (!ret && pointlen < c->mtd->size) { | 102 | if (!ret && pointlen < c->mtd->size) { |
103 | /* Don't muck about if it won't let us point to the whole flash */ | 103 | /* Don't muck about if it won't let us point to the whole flash */ |
104 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", pointlen)); | 104 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", pointlen)); |
105 | c->mtd->unpoint(c->mtd, 0, pointlen); | 105 | mtd_unpoint(c->mtd, 0, pointlen); |
106 | flashbuf = NULL; | 106 | flashbuf = NULL; |
107 | } | 107 | } |
108 | if (ret) | 108 | if (ret) |
@@ -273,7 +273,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
273 | kfree(flashbuf); | 273 | kfree(flashbuf); |
274 | #ifndef __ECOS | 274 | #ifndef __ECOS |
275 | else | 275 | else |
276 | c->mtd->unpoint(c->mtd, 0, c->mtd->size); | 276 | mtd_unpoint(c->mtd, 0, c->mtd->size); |
277 | #endif | 277 | #endif |
278 | kfree(s); | 278 | kfree(s); |
279 | return ret; | 279 | return ret; |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index ca7bfdaf7a6f..a7d22b7fcb4c 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -177,8 +177,6 @@ struct mtd_info { | |||
177 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); | 177 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); |
178 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, | 178 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, |
179 | size_t *retlen, void **virt, resource_size_t *phys); | 179 | size_t *retlen, void **virt, resource_size_t *phys); |
180 | |||
181 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ | ||
182 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); | 180 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); |
183 | 181 | ||
184 | /* Allow NOMMU mmap() to directly map the device (if not NULL) | 182 | /* Allow NOMMU mmap() to directly map the device (if not NULL) |
@@ -289,6 +287,12 @@ static inline int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, | |||
289 | return mtd->point(mtd, from, len, retlen, virt, phys); | 287 | return mtd->point(mtd, from, len, retlen, virt, phys); |
290 | } | 288 | } |
291 | 289 | ||
290 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ | ||
291 | static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len) | ||
292 | { | ||
293 | return mtd->unpoint(mtd, from, len); | ||
294 | } | ||
295 | |||
292 | static inline struct mtd_info *dev_to_mtd(struct device *dev) | 296 | static inline struct mtd_info *dev_to_mtd(struct device *dev) |
293 | { | 297 | { |
294 | return dev ? dev_get_drvdata(dev) : NULL; | 298 | return dev ? dev_get_drvdata(dev) : NULL; |