summaryrefslogtreecommitdiffstats
path: root/include/linux/mtd/mtd.h
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-02-08 16:37:14 +0200
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-03-27 00:32:29 +0100
commitde3cac9357b5aa9f9f02520e5f2567b06f3f75a7 (patch)
tree4775c9b137c10bdd9b9ed51651e8ff281987f727 /include/linux/mtd/mtd.h
parentbcb1d238716d138c9e16347fc32b3c1ae006339e (diff)
downloadblackbird-op-linux-de3cac9357b5aa9f9f02520e5f2567b06f3f75a7.tar.gz
blackbird-op-linux-de3cac9357b5aa9f9f02520e5f2567b06f3f75a7.zip
mtd: check for zero length in OTP functions
This patch changes all the OTP functions like 'mtd_get_fact_prot_info()' and makes them return zero immediately if the input 'len' parameter is 0. This is not really needed currently, but most of the other functions do this, and it is just consistent to do the same in the OTP functions. This patch also moves the OTP functions from the header file to mtdcore.c because they become a bit too big for being inlined. 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.h70
1 files changed, 11 insertions, 59 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index fa20a8f0463a..726c2d1b2589 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -273,65 +273,17 @@ static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
return mtd->_write_oob(mtd, to, ops);
}
-/*
- * Method to access the protection register area, present in some flash
- * devices. The user data is one time programmable but the factory data is read
- * only.
- */
-static inline int mtd_get_fact_prot_info(struct mtd_info *mtd,
- struct otp_info *buf, size_t len)
-{
- if (!mtd->_get_fact_prot_info)
- return -EOPNOTSUPP;
- return mtd->_get_fact_prot_info(mtd, buf, len);
-}
-
-static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from,
- size_t len, size_t *retlen,
- u_char *buf)
-{
- *retlen = 0;
- if (!mtd->_read_fact_prot_reg)
- return -EOPNOTSUPP;
- return mtd->_read_fact_prot_reg(mtd, from, len, retlen, buf);
-}
-
-static inline int mtd_get_user_prot_info(struct mtd_info *mtd,
- struct otp_info *buf,
- size_t len)
-{
- if (!mtd->_get_user_prot_info)
- return -EOPNOTSUPP;
- return mtd->_get_user_prot_info(mtd, buf, len);
-}
-
-static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from,
- size_t len, size_t *retlen,
- u_char *buf)
-{
- *retlen = 0;
- if (!mtd->_read_user_prot_reg)
- return -EOPNOTSUPP;
- return mtd->_read_user_prot_reg(mtd, from, len, retlen, buf);
-}
-
-static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to,
- size_t len, size_t *retlen,
- u_char *buf)
-{
- *retlen = 0;
- if (!mtd->_write_user_prot_reg)
- return -EOPNOTSUPP;
- return mtd->_write_user_prot_reg(mtd, to, len, retlen, buf);
-}
-
-static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
- size_t len)
-{
- if (!mtd->_lock_user_prot_reg)
- return -EOPNOTSUPP;
- return mtd->_lock_user_prot_reg(mtd, from, len);
-}
+int mtd_get_fact_prot_info(struct mtd_info *mtd, struct otp_info *buf,
+ size_t len);
+int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len,
+ size_t *retlen, u_char *buf);
+int mtd_get_user_prot_info(struct mtd_info *mtd, struct otp_info *buf,
+ size_t len);
+int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len,
+ size_t *retlen, u_char *buf);
+int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len,
+ size_t *retlen, u_char *buf);
+int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len);
int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
unsigned long count, loff_t to, size_t *retlen);
OpenPOWER on IntegriCloud