Skip to content

Commit 7219778

Browse files
dedekindDavid Woodhouse
authored andcommitted
mtd: introduce mtd_unpoint interface
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent d35ea20 commit 7219778

5 files changed

Lines changed: 14 additions & 10 deletions

File tree

‎drivers/mtd/mtdpart.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static void part_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
9797
{
9898
struct mtd_part *part = PART(mtd);
9999

100-
part->master->unpoint(part->master, from + part->offset, len);
100+
mtd_unpoint(part->master, from + part->offset, len);
101101
}
102102

103103
static unsigned long part_get_unmapped_area(struct mtd_info *mtd,

‎fs/jffs2/erase.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
349349
if (retlen < c->sector_size) {
350350
/* Don't muck about if it won't let us point to the whole erase sector */
351351
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);
353353
goto do_flash_read;
354354
}
355355
wordebuf = ebuf-sizeof(*wordebuf);
@@ -358,7 +358,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
358358
if (*++wordebuf != ~0)
359359
break;
360360
} while(--retlen);
361-
c->mtd->unpoint(c->mtd, jeb->offset, c->sector_size);
361+
mtd_unpoint(c->mtd, jeb->offset, c->sector_size);
362362
if (retlen) {
363363
printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n",
364364
*wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf));

‎fs/jffs2/readinode.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
6767
NULL);
6868
if (!err && retlen < len) {
6969
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);
7171
} else if (err)
7272
JFFS2_WARNING("MTD point failed: error code %d.\n", err);
7373
else
@@ -101,7 +101,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
101101
kfree(buffer);
102102
#ifndef __ECOS
103103
else
104-
c->mtd->unpoint(c->mtd, ofs, len);
104+
mtd_unpoint(c->mtd, ofs, len);
105105
#endif
106106

107107
if (crc != tn->data_crc) {
@@ -137,7 +137,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
137137
kfree(buffer);
138138
#ifndef __ECOS
139139
else
140-
c->mtd->unpoint(c->mtd, ofs, len);
140+
mtd_unpoint(c->mtd, ofs, len);
141141
#endif
142142
return err;
143143
}

‎fs/jffs2/scan.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
102102
if (!ret && pointlen < c->mtd->size) {
103103
/* Don't muck about if it won't let us point to the whole flash */
104104
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);
106106
flashbuf = NULL;
107107
}
108108
if (ret)
@@ -273,7 +273,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
273273
kfree(flashbuf);
274274
#ifndef __ECOS
275275
else
276-
c->mtd->unpoint(c->mtd, 0, c->mtd->size);
276+
mtd_unpoint(c->mtd, 0, c->mtd->size);
277277
#endif
278278
kfree(s);
279279
return ret;

‎include/linux/mtd/mtd.h‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ struct mtd_info {
177177
int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
178178
int (*point) (struct mtd_info *mtd, loff_t from, size_t len,
179179
size_t *retlen, void **virt, resource_size_t *phys);
180-
181-
/* We probably shouldn't allow XIP if the unpoint isn't a NULL */
182180
void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
183181

184182
/* 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,
289287
return mtd->point(mtd, from, len, retlen, virt, phys);
290288
}
291289

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+
292296
static inline struct mtd_info *dev_to_mtd(struct device *dev)
293297
{
294298
return dev ? dev_get_drvdata(dev) : NULL;

0 commit comments

Comments
 (0)