diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-01-30 14:58:32 +0200 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-03-27 00:20:01 +0100 |
commit | 3c3c10bba1e4ccb75b41442e45c1a072f6cded19 (patch) | |
tree | 5c929e46cd0b6fcf8a42db7637cf45dbf69fe126 /include/linux/mtd/mtd.h | |
parent | a6c22850d20273896e7c8ee996730ccf2ba60a22 (diff) |
mtd: add leading underscore to all mtd functions
This patch renames all MTD functions by adding a "_" prefix:
mtd->erase -> mtd->_erase
mtd->read_oob -> mtd->_read_oob
...
The reason is that we are re-working the MTD API and from now on it is
an error to use MTD function pointers directly - we have a corresponding
API call for every pointer. By adding a leading "_" we achieve the following:
1. Make sure we convert every direct pointer users
2. A leading "_" suggests that this interface is internal and it becomes
less likely that people will use them directly
3. Make sure all the out-of-tree modules stop compiling and the owners
spot the big API change and amend them.
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.h | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index d43dc25af82e..e2e545616b2a 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -174,52 +174,52 @@ struct mtd_info { * Do not call via these pointers, use corresponding mtd_*() * wrappers instead. */ - int (*erase) (struct mtd_info *mtd, struct erase_info *instr); - int (*point) (struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys); - void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); - unsigned long (*get_unmapped_area) (struct mtd_info *mtd, - unsigned long len, - unsigned long offset, - unsigned long flags); - int (*read) (struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, u_char *buf); - int (*write) (struct mtd_info *mtd, loff_t to, size_t len, - size_t *retlen, const u_char *buf); - int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, - size_t *retlen, const u_char *buf); - int (*read_oob) (struct mtd_info *mtd, loff_t from, - struct mtd_oob_ops *ops); - int (*write_oob) (struct mtd_info *mtd, loff_t to, + int (*_erase) (struct mtd_info *mtd, struct erase_info *instr); + int (*_point) (struct mtd_info *mtd, loff_t from, size_t len, + size_t *retlen, void **virt, resource_size_t *phys); + void (*_unpoint) (struct mtd_info *mtd, loff_t from, size_t len); + unsigned long (*_get_unmapped_area) (struct mtd_info *mtd, + unsigned long len, + unsigned long offset, + unsigned long flags); + int (*_read) (struct mtd_info *mtd, loff_t from, size_t len, + size_t *retlen, u_char *buf); + int (*_write) (struct mtd_info *mtd, loff_t to, size_t len, + size_t *retlen, const u_char *buf); + int (*_panic_write) (struct mtd_info *mtd, loff_t to, size_t len, + size_t *retlen, const u_char *buf); + int (*_read_oob) (struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops); - int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, - size_t len); - int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, - size_t len, size_t *retlen, u_char *buf); - int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, - size_t len); - int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, - size_t len, size_t *retlen, u_char *buf); - int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len, - size_t *retlen, u_char *buf); - int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, - size_t len); - int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, + int (*_write_oob) (struct mtd_info *mtd, loff_t to, + struct mtd_oob_ops *ops); + int (*_get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, + size_t len); + int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, + size_t len, size_t *retlen, u_char *buf); + int (*_get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, + size_t len); + int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from, + size_t len, size_t *retlen, u_char *buf); + int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to, + size_t len, size_t *retlen, u_char *buf); + int (*_lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, + size_t len); + int (*_writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen); - void (*sync) (struct mtd_info *mtd); - int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); - int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); - int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); - int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); - int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); - int (*suspend) (struct mtd_info *mtd); - void (*resume) (struct mtd_info *mtd); + void (*_sync) (struct mtd_info *mtd); + int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); + int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); + int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); + int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs); + int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); + int (*_suspend) (struct mtd_info *mtd); + void (*_resume) (struct mtd_info *mtd); /* * If the driver is something smart, like UBI, it may need to maintain * its own reference counting. The below functions are only for driver. */ - int (*get_device) (struct mtd_info *mtd); - void (*put_device) (struct mtd_info *mtd); + int (*_get_device) (struct mtd_info *mtd); + void (*_put_device) (struct mtd_info *mtd); /* Backing device capabilities for this device * - provides mmap capabilities @@ -249,7 +249,7 @@ struct mtd_info { */ static inline int mtd_erase(struct mtd_info *mtd, struct erase_info *instr) { - return mtd->erase(mtd, instr); + return mtd->_erase(mtd, instr); } /* @@ -259,15 +259,15 @@ static inline int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, void **virt, resource_size_t *phys) { *retlen = 0; - if (!mtd->point) + if (!mtd->_point) return -EOPNOTSUPP; - return mtd->point(mtd, from, len, retlen, virt, phys); + return mtd->_point(mtd, from, len, retlen, virt, phys); } /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len) { - return mtd->unpoint(mtd, from, len); + return mtd->_unpoint(mtd, from, len); } /* @@ -280,24 +280,24 @@ static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd, unsigned long offset, unsigned long flags) { - if (!mtd->get_unmapped_area) + if (!mtd->_get_unmapped_area) return -EOPNOTSUPP; - return mtd->get_unmapped_area(mtd, len, offset, flags); + return mtd->_get_unmapped_area(mtd, len, offset, flags); } static inline int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) { - return mtd->read(mtd, from, len, retlen, buf); + return mtd->_read(mtd, from, len, retlen, buf); } static inline int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) { *retlen = 0; - if (!mtd->write) + if (!mtd->_write) return -EROFS; - return mtd->write(mtd, to, len, retlen, buf); + return mtd->_write(mtd, to, len, retlen, buf); } /* @@ -311,27 +311,27 @@ static inline int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) { *retlen = 0; - if (!mtd->panic_write) + if (!mtd->_panic_write) return -EOPNOTSUPP; - return mtd->panic_write(mtd, to, len, retlen, buf); + return mtd->_panic_write(mtd, to, len, retlen, buf); } static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops) { ops->retlen = ops->oobretlen = 0; - if (!mtd->read_oob) + if (!mtd->_read_oob) return -EOPNOTSUPP; - return mtd->read_oob(mtd, from, ops); + return mtd->_read_oob(mtd, from, ops); } static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops) { ops->retlen = ops->oobretlen = 0; - if (!mtd->write_oob) + if (!mtd->_write_oob) return -EOPNOTSUPP; - return mtd->write_oob(mtd, to, ops); + return mtd->_write_oob(mtd, to, ops); } /* @@ -342,9 +342,9 @@ static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, 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) + if (!mtd->_get_fact_prot_info) return -EOPNOTSUPP; - return mtd->get_fact_prot_info(mtd, buf, len); + return mtd->_get_fact_prot_info(mtd, buf, len); } static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, @@ -352,18 +352,18 @@ static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, u_char *buf) { *retlen = 0; - if (!mtd->read_fact_prot_reg) + if (!mtd->_read_fact_prot_reg) return -EOPNOTSUPP; - return mtd->read_fact_prot_reg(mtd, from, len, retlen, buf); + 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) + if (!mtd->_get_user_prot_info) return -EOPNOTSUPP; - return mtd->get_user_prot_info(mtd, buf, len); + return mtd->_get_user_prot_info(mtd, buf, len); } static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, @@ -371,9 +371,9 @@ static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, u_char *buf) { *retlen = 0; - if (!mtd->read_user_prot_reg) + if (!mtd->_read_user_prot_reg) return -EOPNOTSUPP; - return mtd->read_user_prot_reg(mtd, from, len, retlen, buf); + 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, @@ -381,17 +381,17 @@ static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, u_char *buf) { *retlen = 0; - if (!mtd->write_user_prot_reg) + if (!mtd->_write_user_prot_reg) return -EOPNOTSUPP; - return mtd->write_user_prot_reg(mtd, to, len, retlen, buf); + 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) + if (!mtd->_lock_user_prot_reg) return -EOPNOTSUPP; - return mtd->lock_user_prot_reg(mtd, from, len); + return mtd->_lock_user_prot_reg(mtd, from, len); } int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, @@ -399,55 +399,55 @@ int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, static inline void mtd_sync(struct mtd_info *mtd) { - if (mtd->sync) - mtd->sync(mtd); + if (mtd->_sync) + mtd->_sync(mtd); } /* Chip-supported device locking */ static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) { - if (!mtd->lock) + if (!mtd->_lock) return -EOPNOTSUPP; - return mtd->lock(mtd, ofs, len); + return mtd->_lock(mtd, ofs, len); } static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) { - if (!mtd->unlock) + if (!mtd->_unlock) return -EOPNOTSUPP; - return mtd->unlock(mtd, ofs, len); + return mtd->_unlock(mtd, ofs, len); } static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) { - if (!mtd->is_locked) + if (!mtd->_is_locked) return -EOPNOTSUPP; - return mtd->is_locked(mtd, ofs, len); + return mtd->_is_locked(mtd, ofs, len); } static inline int mtd_suspend(struct mtd_info *mtd) { - return mtd->suspend ? mtd->suspend(mtd) : 0; + return mtd->_suspend ? mtd->_suspend(mtd) : 0; } static inline void mtd_resume(struct mtd_info *mtd) { - if (mtd->resume) - mtd->resume(mtd); + if (mtd->_resume) + mtd->_resume(mtd); } static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs) { - if (!mtd->block_isbad) + if (!mtd->_block_isbad) return 0; - return mtd->block_isbad(mtd, ofs); + return mtd->_block_isbad(mtd, ofs); } static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs) { - if (!mtd->block_markbad) + if (!mtd->_block_markbad) return -EOPNOTSUPP; - return mtd->block_markbad(mtd, ofs); + return mtd->_block_markbad(mtd, ofs); } static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) @@ -482,12 +482,12 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd) static inline int mtd_has_oob(const struct mtd_info *mtd) { - return mtd->read_oob && mtd->write_oob; + return mtd->_read_oob && mtd->_write_oob; } static inline int mtd_can_have_bb(const struct mtd_info *mtd) { - return !!mtd->block_isbad; + return !!mtd->_block_isbad; } /* Kernel-side ioctl definitions */ |