diff options
author | Antony Pavlov <antonynpavlov@gmail.com> | 2015-11-27 10:05:35 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-12-01 09:59:05 +0100 |
commit | cf0dd1196bf07942b55a120bed34e565e07be97a (patch) | |
tree | 5a619ab7158a55f9fbe0e0a75e5d61fdd56aeeaa /common | |
parent | 2803b258e6679e9d0079ec0699375c8998dc5d1a (diff) | |
download | barebox-cf0dd1196bf07942b55a120bed34e565e07be97a.tar.gz barebox-cf0dd1196bf07942b55a120bed34e565e07be97a.tar.xz |
environment: support env on at24 eeprom
unprotect(), erase() and protect() return EOPNOTSUPP errno code
for at24 I2C eeproms, so envfs_save() doesn't store data
to these eeproms without this patch.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/environment.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/common/environment.c b/common/environment.c index f6fd781a8a..f412e62258 100644 --- a/common/environment.c +++ b/common/environment.c @@ -324,16 +324,16 @@ int envfs_save(const char *filename, const char *dirname, unsigned flags) ret = protect(envfd, ~0, 0, 0); - /* ENOSYS is no error here, many devices do not need it */ - if (ret && errno != ENOSYS) { + /* ENOSYS and EOPNOTSUPP aren't errors here, many devices don't need it */ + if (ret && errno != ENOSYS && errno != EOPNOTSUPP) { printf("could not unprotect %s: %s\n", filename, errno_str()); goto out; } ret = erase(envfd, ~0, 0); - /* ENOSYS is no error here, many devices do not need it */ - if (ret && errno != ENOSYS) { + /* ENOSYS and EOPNOTSUPP aren't errors here, many devices don't need it */ + if (ret && errno != ENOSYS && errno != EOPNOTSUPP) { printf("could not erase %s: %s\n", filename, errno_str()); goto out; } @@ -355,8 +355,8 @@ int envfs_save(const char *filename, const char *dirname, unsigned flags) ret = protect(envfd, ~0, 0, 1); - /* ENOSYS is no error here, many devices do not need it */ - if (ret && errno != ENOSYS) { + /* ENOSYS and EOPNOTSUPP aren't errors here, many devices don't need it */ + if (ret && errno != ENOSYS && errno != EOPNOTSUPP) { printf("could not protect %s: %s\n", filename, errno_str()); goto out; } |