mtdchar.c (fc002e3c320602d0e206f607aca0460540d7637a) mtdchar.c (cd621274b0ec747db8dedbf857624c067f481976)
1/*
2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 1110 unchanged lines hidden (view full) ---

1119static unsigned long mtdchar_get_unmapped_area(struct file *file,
1120 unsigned long addr,
1121 unsigned long len,
1122 unsigned long pgoff,
1123 unsigned long flags)
1124{
1125 struct mtd_file_info *mfi = file->private_data;
1126 struct mtd_info *mtd = mfi->mtd;
1/*
2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 1110 unchanged lines hidden (view full) ---

1119static unsigned long mtdchar_get_unmapped_area(struct file *file,
1120 unsigned long addr,
1121 unsigned long len,
1122 unsigned long pgoff,
1123 unsigned long flags)
1124{
1125 struct mtd_file_info *mfi = file->private_data;
1126 struct mtd_info *mtd = mfi->mtd;
1127 unsigned long offset;
1128 int ret;
1127
1129
1128 if (mtd->get_unmapped_area) {
1129 unsigned long offset;
1130 if (addr != 0)
1131 return (unsigned long) -EINVAL;
1130
1132
1131 if (addr != 0)
1132 return (unsigned long) -EINVAL;
1133 if (len > mtd->size || pgoff >= (mtd->size >> PAGE_SHIFT))
1134 return (unsigned long) -EINVAL;
1133
1135
1134 if (len > mtd->size || pgoff >= (mtd->size >> PAGE_SHIFT))
1135 return (unsigned long) -EINVAL;
1136 offset = pgoff << PAGE_SHIFT;
1137 if (offset > mtd->size - len)
1138 return (unsigned long) -EINVAL;
1136
1139
1137 offset = pgoff << PAGE_SHIFT;
1138 if (offset > mtd->size - len)
1139 return (unsigned long) -EINVAL;
1140
1141 return mtd_get_unmapped_area(mtd, len, offset, flags);
1142 }
1143
1144 /* can't map directly */
1145 return (unsigned long) -ENOSYS;
1140 ret = mtd_get_unmapped_area(mtd, len, offset, flags);
1141 return ret == -EOPNOTSUPP ? -ENOSYS : ret;
1146}
1147#endif
1148
1149/*
1150 * set up a mapping for shared memory segments
1151 */
1152static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma)
1153{

--- 138 unchanged lines hidden ---
1142}
1143#endif
1144
1145/*
1146 * set up a mapping for shared memory segments
1147 */
1148static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma)
1149{

--- 138 unchanged lines hidden ---