[U-Boot-Users] [PATCH] Functions added to extern for stand	alone programs
    Håvard Skinnemoen 
    hskinnemoen at gmail.com
       
    Sat May 19 00:32:35 CEST 2007
    
    
  
On 5/10/07, Wolfgang Denk <wd at denx.de> wrote:
> +#if (CONFIG_COMMANDS & CFG_CMD_FLASH)
> +       gd->jt[XF_do_protect] = (void *) do_protect;
> +       gd->jt[XF_do_flerase] = (void *) do_flerase;
> +#endif
>  }
>
> This #ifdef maze is too much even for my  standards.  And  that  does
> mean something.
>
> Is there anybody out there with an idea how to avoid that?
The cond_syscall() macro in the Linux kernel might be worth stealing.
How about something like this?
#define cond_extern(name) asm(".weak\t" #name "\n\t.set\t" #name ",
unimpl_extern")
static int unimpl_extern(void)
{
        return -ENOSYS; /* or something more appropriate */
}
cond_extern(do_protect);
cond_extern(do_flerase);
Haavard
    
    
More information about the U-Boot
mailing list