Skip to content

Commit

Permalink
mtd: mtd->write_user_prot_reg directly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Artem Bityutskiy authored and David Woodhouse committed Jan 9, 2012
1 parent b6de3d6 commit 27c151a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 0 additions & 4 deletions drivers/mtd/mtdchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,6 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c
ret = -EROFS;
break;
case MTD_FILE_MODE_OTP_USER:
if (!mtd->write_user_prot_reg) {
ret = -EOPNOTSUPP;
break;
}
ret = mtd_write_user_prot_reg(mtd, *ppos, len,
&retlen, kbuf);
break;
Expand Down
2 changes: 2 additions & 0 deletions include/linux/mtd/mtd.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to,
u_char *buf)
{
*retlen = 0;
if (!mtd->write_user_prot_reg)
return -EOPNOTSUPP;
return mtd->write_user_prot_reg(mtd, to, len, retlen, buf);
}

Expand Down

0 comments on commit 27c151a

Please sign in to comment.