Commit 4403dbfb authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by David Woodhouse

mtd: introduce mtd_lock_user_prot_reg interface

Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 482b43ad
...@@ -960,7 +960,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) ...@@ -960,7 +960,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
return -EFAULT; return -EFAULT;
if (!mtd->lock_user_prot_reg) if (!mtd->lock_user_prot_reg)
return -EOPNOTSUPP; return -EOPNOTSUPP;
ret = mtd->lock_user_prot_reg(mtd, oinfo.start, oinfo.length); ret = mtd_lock_user_prot_reg(mtd, oinfo.start, oinfo.length);
break; break;
} }
#endif #endif
......
...@@ -229,7 +229,7 @@ static int part_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, ...@@ -229,7 +229,7 @@ static int part_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
size_t len) size_t len)
{ {
struct mtd_part *part = PART(mtd); struct mtd_part *part = PART(mtd);
return part->master->lock_user_prot_reg(part->master, from, len); return mtd_lock_user_prot_reg(part->master, from, len);
} }
static int part_writev(struct mtd_info *mtd, const struct kvec *vecs, static int part_writev(struct mtd_info *mtd, const struct kvec *vecs,
......
...@@ -202,14 +202,14 @@ struct mtd_info { ...@@ -202,14 +202,14 @@ struct mtd_info {
size_t len, size_t *retlen, u_char *buf); size_t len, size_t *retlen, u_char *buf);
int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len, int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, u_char *buf); size_t *retlen, u_char *buf);
int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from,
size_t len);
/* Backing device capabilities for this device /* Backing device capabilities for this device
* - provides mmap capabilities * - provides mmap capabilities
*/ */
struct backing_dev_info *backing_dev_info; struct backing_dev_info *backing_dev_info;
int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len);
/* kvec-based read/write methods. /* kvec-based read/write methods.
NB: The 'count' parameter is the number of _vectors_, each of NB: The 'count' parameter is the number of _vectors_, each of
which contains an (ofs, len) tuple. 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, ...@@ -369,6 +369,12 @@ static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to,
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)
{
return mtd->lock_user_prot_reg(mtd, from, len);
}
static inline struct mtd_info *dev_to_mtd(struct device *dev) static inline struct mtd_info *dev_to_mtd(struct device *dev)
{ {
return dev ? dev_get_drvdata(dev) : NULL; return dev ? dev_get_drvdata(dev) : NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment