Skip to content

Commit 04c601b

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

5 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎drivers/mtd/mtdchar.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file,
11351135
if (offset > mtd->size - len)
11361136
return (unsigned long) -EINVAL;
11371137

1138-
return mtd->get_unmapped_area(mtd, len, offset, flags);
1138+
return mtd_get_unmapped_area(mtd, len, offset, flags);
11391139
}
11401140

11411141
/* can't map directly */

‎drivers/mtd/mtdconcat.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,8 +726,8 @@ static unsigned long concat_get_unmapped_area(struct mtd_info *mtd,
726726
return (unsigned long) -EINVAL;
727727

728728
if (subdev->get_unmapped_area)
729-
return subdev->get_unmapped_area(subdev, len, offset,
730-
flags);
729+
return mtd_get_unmapped_area(subdev, len, offset,
730+
flags);
731731

732732
break;
733733
}

‎drivers/mtd/mtdpart.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ static unsigned long part_get_unmapped_area(struct mtd_info *mtd,
108108
struct mtd_part *part = PART(mtd);
109109

110110
offset += part->offset;
111-
return part->master->get_unmapped_area(part->master, len, offset,
112-
flags);
111+
return mtd_get_unmapped_area(part->master, len, offset, flags);
113112
}
114113

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

‎fs/romfs/mmap-nommu.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static unsigned long romfs_get_unmapped_area(struct file *file,
5353
if (offset > mtd->size - len)
5454
return (unsigned long) -EINVAL;
5555

56-
return mtd->get_unmapped_area(mtd, len, offset, flags);
56+
return mtd_get_unmapped_area(mtd, len, offset, flags);
5757
}
5858

5959
cant_map_directly:

‎include/linux/mtd/mtd.h‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,6 @@ struct mtd_info {
178178
int (*point) (struct mtd_info *mtd, loff_t from, size_t len,
179179
size_t *retlen, void **virt, resource_size_t *phys);
180180
void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
181-
182-
/* Allow NOMMU mmap() to directly map the device (if not NULL)
183-
* - return the address to which the offset maps
184-
* - return -ENOSYS to indicate refusal to do the mapping
185-
*/
186181
unsigned long (*get_unmapped_area) (struct mtd_info *mtd,
187182
unsigned long len,
188183
unsigned long offset,
@@ -293,6 +288,19 @@ static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
293288
return mtd->unpoint(mtd, from, len);
294289
}
295290

291+
/*
292+
* Allow NOMMU mmap() to directly map the device (if not NULL)
293+
* - return the address to which the offset maps
294+
* - return -ENOSYS to indicate refusal to do the mapping
295+
*/
296+
static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd,
297+
unsigned long len,
298+
unsigned long offset,
299+
unsigned long flags)
300+
{
301+
return mtd->get_unmapped_area(mtd, len, offset, flags);
302+
}
303+
296304
static inline struct mtd_info *dev_to_mtd(struct device *dev)
297305
{
298306
return dev ? dev_get_drvdata(dev) : NULL;

0 commit comments

Comments
 (0)