mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] environment: support env on at24 eeprom
Date: Fri, 27 Nov 2015 10:05:35 +0300	[thread overview]
Message-ID: <1448607935-25129-1-git-send-email-antonynpavlov@gmail.com> (raw)

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>
---
 common/environment.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/common/environment.c b/common/environment.c
index f6fd781..f412e62 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;
 	}
-- 
2.6.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2015-11-27  7:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27  7:05 Antony Pavlov [this message]
2015-12-01  8:59 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448607935-25129-1-git-send-email-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox