]> git.karo-electronics.de Git - linux-beck.git/commitdiff
MIPS: BCM47XX: use common error codes in nvram reads
authorHauke Mehrtens <hauke@hauke-m.de>
Wed, 26 Dec 2012 19:51:09 +0000 (19:51 +0000)
committerJohn Crispin <blogic@openwrt.org>
Fri, 15 Feb 2013 18:01:56 +0000 (19:01 +0100)
Instead of using our own error codes use some common codes.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Patchwork: http://patchwork.linux-mips.org/patch/4739/
Signed-off-by: John Crispin <blogic@openwrt.org>
arch/mips/bcm47xx/nvram.c
arch/mips/bcm47xx/sprom.c
arch/mips/include/asm/mach-bcm47xx/nvram.h

index 64613678ce84973779c82120010b868b4a7f1cfe..e19fc2600b767b40e860b467c0c328986ddcc9bd 100644 (file)
@@ -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);
index 289cc0a386380e9cfa6c49eb86b1b89c0f917352..66b71c363300618e5af2d26dfb6c4b86e4e7c96d 100644 (file)
@@ -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);
        }
index 69ef3efe06e7ab40f5a168a5ec766031177df2d6..550a7fc932c9f6e3f00cc06c88f92851811dc1bb 100644 (file)
@@ -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])