linux-mips
[Top] [All Lists]

[PATCH 1/6] MIPS: BCM47XX: use common error codes in nvram reads

To: john@phrozen.org, ralf@linux-mips.org
Subject: [PATCH 1/6] MIPS: BCM47XX: use common error codes in nvram reads
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Wed, 26 Dec 2012 21:51:09 +0100
Cc: linux-mips@linux-mips.org, zajec5@gmail.com, Hauke Mehrtens <hauke@hauke-m.de>
In-reply-to: <1356555074-1230-1-git-send-email-hauke@hauke-m.de>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
References: <1356555074-1230-1-git-send-email-hauke@hauke-m.de>
Sender: linux-mips-bounce@linux-mips.org
Instead of using our own error codes use some common codes.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 arch/mips/bcm47xx/nvram.c                  |    4 ++--
 arch/mips/bcm47xx/sprom.c                  |    2 +-
 arch/mips/include/asm/mach-bcm47xx/nvram.h |    3 ---
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index 6461367..e19fc26 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -124,7 +124,7 @@ int nvram_getenv(char *name, char *val, size_t val_len)
        char *var, *value, *end, *eq;
 
        if (!name)
-               return NVRAM_ERR_INV_PARAM;
+               return -EINVAL;
 
        if (!nvram_buf[0])
                early_nvram_init();
@@ -143,6 +143,6 @@ int nvram_getenv(char *name, char *val, size_t val_len)
                        return snprintf(val, val_len, "%s", value);
                }
        }
-       return NVRAM_ERR_ENVNOTFOUND;
+       return -ENOENT;
 }
 EXPORT_SYMBOL(nvram_getenv);
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
index 289cc0a..66b71c3 100644
--- a/arch/mips/bcm47xx/sprom.c
+++ b/arch/mips/bcm47xx/sprom.c
@@ -51,7 +51,7 @@ static int get_nvram_var(const char *prefix, const char 
*postfix,
        create_key(prefix, postfix, name, key, sizeof(key));
 
        err = nvram_getenv(key, buf, len);
-       if (fallback && err == NVRAM_ERR_ENVNOTFOUND && prefix) {
+       if (fallback && err == -ENOENT && prefix) {
                create_key(NULL, postfix, name, key, sizeof(key));
                err = nvram_getenv(key, buf, len);
        }
diff --git a/arch/mips/include/asm/mach-bcm47xx/nvram.h 
b/arch/mips/include/asm/mach-bcm47xx/nvram.h
index 69ef3ef..550a7fc 100644
--- a/arch/mips/include/asm/mach-bcm47xx/nvram.h
+++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h
@@ -32,9 +32,6 @@ struct nvram_header {
 #define NVRAM_MAX_VALUE_LEN 255
 #define NVRAM_MAX_PARAM_LEN 64
 
-#define NVRAM_ERR_INV_PARAM    -8
-#define NVRAM_ERR_ENVNOTFOUND  -9
-
 extern int nvram_getenv(char *name, char *val, size_t val_len);
 
 static inline void nvram_parse_macaddr(char *buf, u8 macaddr[6])
-- 
1.7.10.4


<Prev in Thread] Current Thread [Next in Thread>