mtd: introduce mtd_read_user_prot_reg interface
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Fri, 23 Dec 2011 16:47:59 +0000 (18:47 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 9 Jan 2012 18:25:30 +0000 (18:25 +0000)
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/mtdchar.c
drivers/mtd/mtdpart.c
include/linux/mtd/mtd.h

index 002a8b5428cc2631b44c5116acbeb72faead8b83..6aa3fb4a0292aa853d816dd86a125a2a26355bee 100644 (file)
@@ -217,7 +217,8 @@ static ssize_t mtdchar_read(struct file *file, char __user *buf, size_t count,
                                                     &retlen, kbuf);
                        break;
                case MTD_FILE_MODE_OTP_USER:
-                       ret = mtd->read_user_prot_reg(mtd, *ppos, len, &retlen, kbuf);
+                       ret = mtd_read_user_prot_reg(mtd, *ppos, len,
+                                                    &retlen, kbuf);
                        break;
                case MTD_FILE_MODE_RAW:
                {
index bf1ab56afb8ea54dbb3876bc660834e72c590201..f018373ef3b4fee1713034302cb2022bf37e12dc 100644 (file)
@@ -152,8 +152,7 @@ static int part_read_user_prot_reg(struct mtd_info *mtd, loff_t from,
                size_t len, size_t *retlen, u_char *buf)
 {
        struct mtd_part *part = PART(mtd);
-       return part->master->read_user_prot_reg(part->master, from,
-                                       len, retlen, buf);
+       return mtd_read_user_prot_reg(part->master, from, len, retlen, buf);
 }
 
 static int part_get_user_prot_info(struct mtd_info *mtd,
index ff0a3a18f397a20b1c582bc554fe0be3704f59b3..855fb7fab697a5f957f37d91ab69388a666ebc70 100644 (file)
@@ -198,13 +198,14 @@ struct mtd_info {
                                   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);
 
        /* Backing device capabilities for this device
         * - provides mmap capabilities
         */
        struct backing_dev_info *backing_dev_info;
 
-       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 from, size_t len, size_t *retlen, u_char *buf);
        int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len);
 
@@ -353,6 +354,13 @@ static inline int mtd_get_user_prot_info(struct mtd_info *mtd,
        return mtd->get_user_prot_info(mtd, buf, len);
 }
 
+static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from,
+                                        size_t len, size_t *retlen,
+                                        u_char *buf)
+{
+       return mtd->read_user_prot_reg(mtd, from, len, retlen, buf);
+}
+
 static inline struct mtd_info *dev_to_mtd(struct device *dev)
 {
        return dev ? dev_get_drvdata(dev) : NULL;