[U-Boot] [RFC][PATCH] INIT_FUNC - List madness

Wolfgang Denk wd at denx.de
Thu Apr 12 15:28:02 CEST 2012


Dear Graeme Russ,

In message <4F86CDF0.2030208 at gmail.com> you wrote:
> 
> This patch is a little heads-up for my upcomming INIT_FUNC patch series
> 
> This is the INIT_FUNC 'engine' - It processes a file which consists of
> entries created by the following macros:
> 
> #define INIT_FUNC(fn, init_name, man_reqs, pre_reqs, post_reqs) \
> 	static const char __init_func_ ## fn[] __used \
> 	__attribute__((__section__(".initfuncs"))) = \
> 	"(f:" #fn ":" #init_name ":" #man_reqs " | " #pre_reqs " | " #post_reqs ")\n";
> 
> #define SKIP_INIT(init_name) \
> 	static const char __skip_init_ ## req[] __used \
> 	__attribute__((__section__(".initfuncs"))) = \
> 	"(s:" #init_name ")\n";
> 
> #define REPLACE_INIT(old_func, new_func) \
> 	static const char __replace_init_ ## old_func[] __used \
> 	__attribute__((__section__(".initfuncs"))) = \
> 	"(r:" #old_func ":" #new_func ")\n";
> 
> So an 'function' entry will look like
> (f:function_name:init_step:mandatory_req_1 mandatory_req_2 | optional_req_1 optional_req_2 | post_req_1 post_req_2)

Looks OK so far...

> So far this seems to work - It creates a list of functions with each
> having a list of dependent functions (steps are expanded so the dependency
> lists only have functions in them)
> 
> Now I just need to write the code that will order the function list
> 
> I think this single patch will more than double the use of struct list_head
> in U-Boot. It took a while to get used to it's sematics, but the Linux
> kernel list data structure is incredible

Umm... why are you writing such code in C yourself?  Don't we have
sufficient tools to perform such sorting?  Detlev already recommended
"tsort" when we discussed this befopre, and now again.  This should
allow you to avoid most of this code.

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
Success in marriage is not so much finding the right person as it  is
being the right person.


More information about the U-Boot mailing list