aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd/mtd.h
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-02-03 06:20:43 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-03-26 19:27:19 -0400
commit5e4e6e3fdf48c1b012e2b6e80ed1d7e99d4fa6d1 (patch)
treedade127061f6c466f4146152572cc17c05d44761 /include/linux/mtd/mtd.h
parente2414f4c20bd4dc62186fbfd7bdec50bce6d2ead (diff)
mtd: return error code from mtd_unpoint
The 'mtd_unpoint()' API function should be able to return an error code because it may fail if you specify incorrect offset. This patch changes this MTD API function and amends all the drivers correspondingly. Also return '-EOPNOTSUPP' from 'mtd_unpoint()' when the '->unpoint()' method is undefined. We do not really need this currently, but this just makes sense to be consistent with 'mtd_point()'. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux/mtd/mtd.h')
-rw-r--r--include/linux/mtd/mtd.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index e2e545616b2a..8c243117c087 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -177,7 +177,7 @@ 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 void (*_unpoint) (struct mtd_info *mtd, loff_t from, size_t len); 180 int (*_unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
181 unsigned long (*_get_unmapped_area) (struct mtd_info *mtd, 181 unsigned long (*_get_unmapped_area) (struct mtd_info *mtd,
182 unsigned long len, 182 unsigned long len,
183 unsigned long offset, 183 unsigned long offset,
@@ -265,8 +265,10 @@ static inline int mtd_point(struct mtd_info *mtd, loff_t from, size_t len,
265} 265}
266 266
267/* We probably shouldn't allow XIP if the unpoint isn't a NULL */ 267/* We probably shouldn't allow XIP if the unpoint isn't a NULL */
268static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len) 268static inline int mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
269{ 269{
270 if (!mtd->_point)
271 return -EOPNOTSUPP;
270 return mtd->_unpoint(mtd, from, len); 272 return mtd->_unpoint(mtd, from, len);
271} 273}
272 274