aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2011-12-28 10:50:34 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-01-09 13:26:14 -0500
commitdac2639f9833e858139d7e07f6ee45fb2191a9f2 (patch)
tree8927b0959d8415e419f321a8b43974ed8834b680 /include/linux/mtd
parent016c1291ce70a22f15f666441a4fd2f0b450375b (diff)
mtd: do not use mtd->read_oob directly
Instead of checking whether 'mtd->read_oob' is defined, just call 'mtd_read_oob()' and handle the '-EOPNOTSUPP' error which will be returned if the function is undefined. Additionally, make 'mtd_write_oob()' return '-EOPNOTSUPP' if the function is undefined. 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')
-rw-r--r--include/linux/mtd/mtd.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index b72964049cdc..721a63ffeb96 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -320,6 +320,8 @@ static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from,
320 struct mtd_oob_ops *ops) 320 struct mtd_oob_ops *ops)
321{ 321{
322 ops->retlen = ops->oobretlen = 0; 322 ops->retlen = ops->oobretlen = 0;
323 if (!mtd->read_oob)
324 return -EOPNOTSUPP;
323 return mtd->read_oob(mtd, from, ops); 325 return mtd->read_oob(mtd, from, ops);
324} 326}
325 327
@@ -327,6 +329,8 @@ static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
327 struct mtd_oob_ops *ops) 329 struct mtd_oob_ops *ops)
328{ 330{
329 ops->retlen = ops->oobretlen = 0; 331 ops->retlen = ops->oobretlen = 0;
332 if (!mtd->write_oob)
333 return -EOPNOTSUPP;
330 return mtd->write_oob(mtd, to, ops); 334 return mtd->write_oob(mtd, to, ops);
331} 335}
332 336