diff options
| author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2011-12-29 03:39:20 -0500 |
|---|---|---|
| committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:26:17 -0500 |
| commit | 27c151a5e52efaa46d0938984f2ef591bdcb6d5b (patch) | |
| tree | 67866c01422a4f0c99192b0bc2db8f1968cd1f5b | |
| parent | b6de3d6cb63427178c4f1df88b81d1ceee637e6f (diff) | |
mtd: mtd->write_user_prot_reg directly
Instead, just call 'mtd_write_user_prot_reg()' and check the '-EOPNOTSUPP' return
code.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
| -rw-r--r-- | drivers/mtd/mtdchar.c | 4 | ||||
| -rw-r--r-- | include/linux/mtd/mtd.h | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 4e8e5fbc1e1..25bbbc3aa66 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
| @@ -310,10 +310,6 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c | |||
| 310 | ret = -EROFS; | 310 | ret = -EROFS; |
| 311 | break; | 311 | break; |
| 312 | case MTD_FILE_MODE_OTP_USER: | 312 | case MTD_FILE_MODE_OTP_USER: |
| 313 | if (!mtd->write_user_prot_reg) { | ||
| 314 | ret = -EOPNOTSUPP; | ||
| 315 | break; | ||
| 316 | } | ||
| 317 | ret = mtd_write_user_prot_reg(mtd, *ppos, len, | 313 | ret = mtd_write_user_prot_reg(mtd, *ppos, len, |
| 318 | &retlen, kbuf); | 314 | &retlen, kbuf); |
| 319 | break; | 315 | break; |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index e488cf91091..7cd56d2b941 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -381,6 +381,8 @@ static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, | |||
| 381 | u_char *buf) | 381 | u_char *buf) |
| 382 | { | 382 | { |
| 383 | *retlen = 0; | 383 | *retlen = 0; |
| 384 | if (!mtd->write_user_prot_reg) | ||
| 385 | return -EOPNOTSUPP; | ||
| 384 | return mtd->write_user_prot_reg(mtd, to, len, retlen, buf); | 386 | return mtd->write_user_prot_reg(mtd, to, len, retlen, buf); |
| 385 | } | 387 | } |
| 386 | 388 | ||
