mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] environment: support env on at24 eeprom
@ 2015-11-27  7:05 Antony Pavlov
  2015-12-01  8:59 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Antony Pavlov @ 2015-11-27  7:05 UTC (permalink / raw)
  To: barebox

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] environment: support env on at24 eeprom
  2015-11-27  7:05 [PATCH] environment: support env on at24 eeprom Antony Pavlov
@ 2015-12-01  8:59 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2015-12-01  8:59 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Fri, Nov 27, 2015 at 10:05:35AM +0300, Antony Pavlov wrote:
> 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(-)

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-01  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-27  7:05 [PATCH] environment: support env on at24 eeprom Antony Pavlov
2015-12-01  8:59 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox