Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: introduce mtd_is_locked interface

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Artem Bityutskiy and committed by
David Woodhouse
e95e9786 b66005cd

+8 -4
+1 -1
drivers/mtd/mtdchar.c
··· 852 852 if (!mtd->is_locked) 853 853 ret = -EOPNOTSUPP; 854 854 else 855 - ret = mtd->is_locked(mtd, einfo.start, einfo.length); 855 + ret = mtd_is_locked(mtd, einfo.start, einfo.length); 856 856 break; 857 857 } 858 858
+1 -1
drivers/mtd/mtdpart.c
··· 295 295 struct mtd_part *part = PART(mtd); 296 296 if ((len + ofs) > mtd->size) 297 297 return -EINVAL; 298 - return part->master->is_locked(part->master, ofs + part->offset, len); 298 + return mtd_is_locked(part->master, ofs + part->offset, len); 299 299 } 300 300 301 301 static void part_sync(struct mtd_info *mtd)
+6 -2
include/linux/mtd/mtd.h
··· 209 209 void (*sync) (struct mtd_info *mtd); 210 210 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 211 211 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 212 + int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 212 213 213 214 /* Backing device capabilities for this device 214 215 * - provides mmap capabilities 215 216 */ 216 217 struct backing_dev_info *backing_dev_info; 217 - 218 - int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 219 218 220 219 /* Power Management functions */ 221 220 int (*suspend) (struct mtd_info *mtd); ··· 391 392 static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) 392 393 { 393 394 return mtd->unlock(mtd, ofs, len); 395 + } 396 + 397 + static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) 398 + { 399 + return mtd->is_locked(mtd, ofs, len); 394 400 } 395 401 396 402 static inline struct mtd_info *dev_to_mtd(struct device *dev)