Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 374710
b: refs/heads/master
c: 5dc63fa
h: refs/heads/master
v: v3
  • Loading branch information
Uwe Kleine-König authored and David Woodhouse committed Apr 5, 2013
1 parent b6ac840 commit 272d1d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6b75152bbfce9bed30de44189d6032099c74c855
refs/heads/master: 5dc63fa2c2e149dd3e8128e54c9ca251d0558ea0
24 changes: 13 additions & 11 deletions trunk/drivers/mtd/mtdchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,28 +370,30 @@ static int otp_select_filemode(struct mtd_file_info *mfi, int mode)
{
struct mtd_info *mtd = mfi->mtd;
size_t retlen;
int ret = 0;

/*
* Make a fake call to mtd_read_fact_prot_reg() to check if OTP
* operations are supported.
*/
if (mtd_read_fact_prot_reg(mtd, -1, 0, &retlen, NULL) == -EOPNOTSUPP)
return -EOPNOTSUPP;

switch (mode) {
case MTD_OTP_FACTORY:
if (mtd_read_fact_prot_reg(mtd, -1, 0, &retlen, NULL) ==
-EOPNOTSUPP)
return -EOPNOTSUPP;

mfi->mode = MTD_FILE_MODE_OTP_FACTORY;
break;
case MTD_OTP_USER:
if (mtd_read_user_prot_reg(mtd, -1, 0, &retlen, NULL) ==
-EOPNOTSUPP)
return -EOPNOTSUPP;

mfi->mode = MTD_FILE_MODE_OTP_USER;
break;
default:
ret = -EINVAL;
case MTD_OTP_OFF:
mfi->mode = MTD_FILE_MODE_NORMAL;
break;
default:
return -EINVAL;
}
return ret;

return 0;
}
#else
# define otp_select_filemode(f,m) -EOPNOTSUPP
Expand Down

0 comments on commit 272d1d6

Please sign in to comment.