diff options
-rw-r--r-- | drivers/mtd/mtdchar.c | 2 | ||||
-rw-r--r-- | drivers/mtd/mtdpart.c | 2 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 19 |
3 files changed, 15 insertions, 8 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 234e3d27143c..4b1772feeafc 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -925,7 +925,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) | |||
925 | switch (mfi->mode) { | 925 | switch (mfi->mode) { |
926 | case MTD_FILE_MODE_OTP_FACTORY: | 926 | case MTD_FILE_MODE_OTP_FACTORY: |
927 | if (mtd->get_fact_prot_info) | 927 | if (mtd->get_fact_prot_info) |
928 | ret = mtd->get_fact_prot_info(mtd, buf, 4096); | 928 | ret = mtd_get_fact_prot_info(mtd, buf, 4096); |
929 | break; | 929 | break; |
930 | case MTD_FILE_MODE_OTP_USER: | 930 | case MTD_FILE_MODE_OTP_USER: |
931 | if (mtd->get_user_prot_info) | 931 | if (mtd->get_user_prot_info) |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 8a46cd2bb78f..6bed8bb3b15d 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -175,7 +175,7 @@ static int part_get_fact_prot_info(struct mtd_info *mtd, struct otp_info *buf, | |||
175 | size_t len) | 175 | size_t len) |
176 | { | 176 | { |
177 | struct mtd_part *part = PART(mtd); | 177 | struct mtd_part *part = PART(mtd); |
178 | return part->master->get_fact_prot_info(part->master, buf, len); | 178 | return mtd_get_fact_prot_info(part->master, buf, len); |
179 | } | 179 | } |
180 | 180 | ||
181 | static int part_write(struct mtd_info *mtd, loff_t to, size_t len, | 181 | static int part_write(struct mtd_info *mtd, loff_t to, size_t len, |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index abbc96ad3b2c..9a7a7f2d2296 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -192,18 +192,14 @@ struct mtd_info { | |||
192 | struct mtd_oob_ops *ops); | 192 | struct mtd_oob_ops *ops); |
193 | int (*write_oob) (struct mtd_info *mtd, loff_t to, | 193 | int (*write_oob) (struct mtd_info *mtd, loff_t to, |
194 | struct mtd_oob_ops *ops); | 194 | struct mtd_oob_ops *ops); |
195 | int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, | ||
196 | size_t len); | ||
195 | 197 | ||
196 | /* Backing device capabilities for this device | 198 | /* Backing device capabilities for this device |
197 | * - provides mmap capabilities | 199 | * - provides mmap capabilities |
198 | */ | 200 | */ |
199 | struct backing_dev_info *backing_dev_info; | 201 | struct backing_dev_info *backing_dev_info; |
200 | 202 | ||
201 | /* | ||
202 | * Methods to access the protection register area, present in some | ||
203 | * flash devices. The user data is one time programmable but the | ||
204 | * factory data is read only. | ||
205 | */ | ||
206 | int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); | ||
207 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 203 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
208 | int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); | 204 | int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); |
209 | int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 205 | int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
@@ -330,6 +326,17 @@ static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, | |||
330 | return mtd->write_oob(mtd, to, ops); | 326 | return mtd->write_oob(mtd, to, ops); |
331 | } | 327 | } |
332 | 328 | ||
329 | /* | ||
330 | * Method to access the protection register area, present in some flash | ||
331 | * devices. The user data is one time programmable but the factory data is read | ||
332 | * only. | ||
333 | */ | ||
334 | static inline int mtd_get_fact_prot_info(struct mtd_info *mtd, | ||
335 | struct otp_info *buf, size_t len) | ||
336 | { | ||
337 | return mtd->get_fact_prot_info(mtd, buf, len); | ||
338 | } | ||
339 | |||
333 | static inline struct mtd_info *dev_to_mtd(struct device *dev) | 340 | static inline struct mtd_info *dev_to_mtd(struct device *dev) |
334 | { | 341 | { |
335 | return dev ? dev_get_drvdata(dev) : NULL; | 342 | return dev ? dev_get_drvdata(dev) : NULL; |