Skip to content

Commit 4403dbf

Browse files
dedekindDavid Woodhouse
authored andcommitted
mtd: introduce mtd_lock_user_prot_reg interface
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 482b43a commit 4403dbf

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎drivers/mtd/mtdchar.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
960960
return -EFAULT;
961961
if (!mtd->lock_user_prot_reg)
962962
return -EOPNOTSUPP;
963-
ret = mtd->lock_user_prot_reg(mtd, oinfo.start, oinfo.length);
963+
ret = mtd_lock_user_prot_reg(mtd, oinfo.start, oinfo.length);
964964
break;
965965
}
966966
#endif

‎drivers/mtd/mtdpart.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static int part_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
229229
size_t len)
230230
{
231231
struct mtd_part *part = PART(mtd);
232-
return part->master->lock_user_prot_reg(part->master, from, len);
232+
return mtd_lock_user_prot_reg(part->master, from, len);
233233
}
234234

235235
static int part_writev(struct mtd_info *mtd, const struct kvec *vecs,

‎include/linux/mtd/mtd.h‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,14 @@ struct mtd_info {
202202
size_t len, size_t *retlen, u_char *buf);
203203
int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len,
204204
size_t *retlen, u_char *buf);
205+
int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from,
206+
size_t len);
205207

206208
/* Backing device capabilities for this device
207209
* - provides mmap capabilities
208210
*/
209211
struct backing_dev_info *backing_dev_info;
210212

211-
int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len);
212-
213213
/* kvec-based read/write methods.
214214
NB: The 'count' parameter is the number of _vectors_, each of
215215
which contains an (ofs, len) tuple.
@@ -369,6 +369,12 @@ static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to,
369369
return mtd->write_user_prot_reg(mtd, to, len, retlen, buf);
370370
}
371371

372+
static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
373+
size_t len)
374+
{
375+
return mtd->lock_user_prot_reg(mtd, from, len);
376+
}
377+
372378
static inline struct mtd_info *dev_to_mtd(struct device *dev)
373379
{
374380
return dev ? dev_get_drvdata(dev) : NULL;

0 commit comments

Comments
 (0)