From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean-Christophe PLAGNIOL-VILLARD Date: Thu, 23 Jul 2009 23:53:10 +0200 Subject: [U-Boot] [RFC] arm/board.c: avoid ifdef using weak default functions In-Reply-To: <20090722171910.GA4914@mail.gnudd.com> References: <20090722171910.GA4914@mail.gnudd.com> Message-ID: <20090723215310.GF9480@game.jcrosoft.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 19:19 Wed 22 Jul , Alessandro Rubini wrote: > From: Alessandro Rubini > > While it's a matter of personal taste, I prefer to avoid ifdef when > possible. For example, I don't like to add BOARD_LATE_INIT in the > config file just to have my board_late_init() function called. > > This patch (not meant to be applied mainstram, jsut for discussion) > tries to simplify and make more readable the code in lib_arm/board.c. > If this is considered useful it can be done more seriously to all > platforms, and allow over time to remove defines in the class of > BOARD_LATE_INIT. > > A serious reordering will definitely need more time, and this is just > a quick hack to show the idea; some things are suboptimal like the > arm_pci_init() thing which has to remain an ifdef and should be fixed > in a different way (I think all init function should return int > and print their own messages, to simplify this factoring out, but again > it's a matter of personal taste). > > About the use of weak, I first converted .a to .o, but then found it > works nonetheless, and led functions are already weak ones in this file. > > Is the idea worth pursuing? Or does it conflich with other work in > progress? I've already send an RFC about initcall I'm not in favor a weak function as it will increase the size of U-Boot and will not be easy to use as we seen a lots of time due to compiler issue so I think the initcall mecansim will be more generic, more easier to use and smaller than the current implementation (already tested) Best Regards, J.