Skip to content

Commit e95e978

Browse files
dedekindDavid Woodhouse
authored andcommitted
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>
1 parent b66005c commit e95e978

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎drivers/mtd/mtdchar.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
852852
if (!mtd->is_locked)
853853
ret = -EOPNOTSUPP;
854854
else
855-
ret = mtd->is_locked(mtd, einfo.start, einfo.length);
855+
ret = mtd_is_locked(mtd, einfo.start, einfo.length);
856856
break;
857857
}
858858

‎drivers/mtd/mtdpart.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
295295
struct mtd_part *part = PART(mtd);
296296
if ((len + ofs) > mtd->size)
297297
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);
299299
}
300300

301301
static void part_sync(struct mtd_info *mtd)

‎include/linux/mtd/mtd.h‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,13 @@ struct mtd_info {
209209
void (*sync) (struct mtd_info *mtd);
210210
int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
211211
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);
212213

213214
/* Backing device capabilities for this device
214215
* - provides mmap capabilities
215216
*/
216217
struct backing_dev_info *backing_dev_info;
217218

218-
int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
219-
220219
/* Power Management functions */
221220
int (*suspend) (struct mtd_info *mtd);
222221
void (*resume) (struct mtd_info *mtd);
@@ -394,6 +393,11 @@ static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
394393
return mtd->unlock(mtd, ofs, len);
395394
}
396395

396+
static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
397+
{
398+
return mtd->is_locked(mtd, ofs, len);
399+
}
400+
397401
static inline struct mtd_info *dev_to_mtd(struct device *dev)
398402
{
399403
return dev ? dev_get_drvdata(dev) : NULL;

0 commit comments

Comments
 (0)