From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Tue, 18 Sep 2012 10:31:34 -0700 Subject: [U-Boot] [PATCH 08/71] serial: Implement serial_initfunc() macro In-Reply-To: <1347837696-3192-9-git-send-email-marex@denx.de> References: <1347837696-3192-1-git-send-email-marex@denx.de> <1347837696-3192-9-git-send-email-marex@denx.de> Message-ID: <20120918173134.GK14937@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, Sep 17, 2012 at 01:20:33AM +0200, Marek Vasut wrote: > This macro simplifies declaration of weak aliases for per-driver > functions, which register these drivers with the serial subsystem. > The idea here is to push serial_register() calls from serial.c into > the drivers. To avoid pile of ifdef construct as it is now, create > weak aliases to these functions, which in case the driver is not > present alias onto an empty function, which is in turn optimized out > altogether. So, did you consider and throw out the idea of something like: common/serial.c: void serial_initalize(void) { platform_serial_register(); serial_assign(default_serial_console()->name); } And then every serial driver, instead of having to add a new weak function to common/serial.c and a new function call just defines platform_serial_register. Or do you run into platforms that want two different serial drivers AND you couldn't solve that with a combination of weak functions and board-specific platform_serial_register? -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: