[U-Boot] [PATCH] mtdparts: Call nand_init() during mtdparts_init().

Wolfgang Denk wd at denx.de
Fri Oct 15 23:39:52 CEST 2010


Dear Mike Frysinger,

In message <201010151608.30637.vapier at gentoo.org> you wrote:
>
> > > @@ -1711,6 +1707,7 @@ int mtdparts_init(void)
> > >  		memset(last_ids, 0, MTDIDS_MAXLEN);
> > >  		memset(last_parts, 0, MTDPARTS_MAXLEN);
> > >  		memset(last_partition, 0, PARTITION_MAXLEN);
> > > 
> > > +		nand_init();
> > >  		initialized = 1;
> > >  	}
> > 
> > I don't like this either.  I don't want to see a nand_init() for
> > systems that have no NAND at all (not even an empty one).
>
> i disagree ... sprinkling #ifdef's throughout the code makes it a lot harder 
> to read, maintain, and validate across multiple configurations.  you're 
> suggesting we do:
> #ifdef CONFIG_CMD_NAND
> 		nand_init();
> #endif

No, I'm not. I did not suggest anything like that.

> it makes more sense to me to hide this in the header (which Scott has done)>  
> and let the compiler/code optimize dead crap away.

Why do we need an explicit call to nand_init() at all?

Why cannot the NAND routines check internally if they have been
initialized yet, and run nand_init() if and when needed?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The use of COBOL cripples the mind; its teaching  should,  therefore,
be regarded as a criminal offense.                   - E. W. Dijkstra


More information about the U-Boot mailing list