source: trunk/target/linux/brcm47xx/patches-2.6.34/015-MIPS-BCM47xx-nvram_getenv-fix-return-value.patch @ 22663

Last change on this file since 22663 was 22663, checked in by hauke, 6 years ago

brcm47xx: do not read out cfe

Reading the CFE properties causes system hangs on some devices. With
this patch nvram read will be successful very time so cfe will no be
read out. This code is not really correct but it will work around some
problems for some people.

Related ticket: #7693

File size: 1.5 KB
  • arch/mips/bcm47xx/nvram.c

    From ff7295cc37b1e4b31aed9f071374f43aa128329b Mon Sep 17 00:00:00 2001
    From: Hauke Mehrtens <hauke@hauke-m.de>
    Date: Fri, 30 Jul 2010 17:45:20 +0200
    Subject: [PATCH 5/6] MIPS: BCM47xx: nvram_getenv fix return value.
    
    nvram_getenv should behave like cfe_getenv. For now it is used like
    cfe_getenv. cfe_getenv returns 0 on success and -1 in case of an error.
    Change nvram_getenv to do the same.
    
    Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
    ---
     arch/mips/bcm47xx/nvram.c                  |    4 ++--
     arch/mips/include/asm/mach-bcm47xx/nvram.h |    3 +++
     2 files changed, 5 insertions(+), 2 deletions(-)
    
    a b int nvram_getenv(char *name, char *val,  
    6969        char *var, *value, *end, *eq; 
    7070 
    7171        if (!name) 
    72                 return 1; 
     72                return NVRAM_ERR_INV_PARAM; 
    7373 
    7474        if (!nvram_buf[0]) 
    7575                early_nvram_init(); 
    int nvram_getenv(char *name, char *val,  
    8989                        return 0; 
    9090                } 
    9191        } 
    92         return 1; 
     92        return NVRAM_ERR_ENVNOTFOUND; 
    9393} 
    9494EXPORT_SYMBOL(nvram_getenv); 
  • arch/mips/include/asm/mach-bcm47xx/nvram.h

    a b struct nvram_header { 
    3131#define NVRAM_MAX_VALUE_LEN 255 
    3232#define NVRAM_MAX_PARAM_LEN 64 
    3333 
     34// TODO: replace by old values. This chaueses that the system will not try to look into the cfe. 
     35#define NVRAM_ERR_INV_PARAM     1 // -8 
     36#define NVRAM_ERR_ENVNOTFOUND   1 // -9 
     37 
    3438extern int nvram_getenv(char *name, char *val, size_t val_len); 
    3539 
    3640#endif 
Note: See TracBrowser for help on using the repository browser.