brcm47xx: refresh patches with kernel 2.6.37-rc7
[openwrt.git] / target / linux / brcm47xx / patches-2.6.34 / 015-MIPS-BCM47xx-nvram_getenv-fix-return-value.patch
1 From ff7295cc37b1e4b31aed9f071374f43aa128329b Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Fri, 30 Jul 2010 17:45:20 +0200
4 Subject: [PATCH 5/6] MIPS: BCM47xx: nvram_getenv fix return value.
5
6 nvram_getenv should behave like cfe_getenv. For now it is used like
7 cfe_getenv. cfe_getenv returns 0 on success and -1 in case of an error.
8 Change nvram_getenv to do the same.
9
10 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
11 ---
12  arch/mips/bcm47xx/nvram.c                  |    4 ++--
13  arch/mips/include/asm/mach-bcm47xx/nvram.h |    3 +++
14  2 files changed, 5 insertions(+), 2 deletions(-)
15
16 --- a/arch/mips/bcm47xx/nvram.c
17 +++ b/arch/mips/bcm47xx/nvram.c
18 @@ -69,7 +69,7 @@ int nvram_getenv(char *name, char *val,
19         char *var, *value, *end, *eq;
20  
21         if (!name)
22 -               return 1;
23 +               return NVRAM_ERR_INV_PARAM;
24  
25         if (!nvram_buf[0])
26                 early_nvram_init();
27 @@ -89,6 +89,6 @@ int nvram_getenv(char *name, char *val,
28                         return 0;
29                 }
30         }
31 -       return 1;
32 +       return NVRAM_ERR_ENVNOTFOUND;
33  }
34  EXPORT_SYMBOL(nvram_getenv);
35 --- a/arch/mips/include/asm/mach-bcm47xx/nvram.h
36 +++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h
37 @@ -31,6 +31,10 @@ struct nvram_header {
38  #define NVRAM_MAX_VALUE_LEN 255
39  #define NVRAM_MAX_PARAM_LEN 64
40  
41 +// TODO: replace by old values. This chaueses that the system will not try to look into the cfe.
42 +#define NVRAM_ERR_INV_PARAM    1 // -8
43 +#define NVRAM_ERR_ENVNOTFOUND  1 // -9
44 +
45  extern int nvram_getenv(char *name, char *val, size_t val_len);
46  
47  #endif