[U-Boot] [PATCH 08/71] serial: Implement serial_initfunc() macro

Tom Rini trini at ti.com
Tue Sep 18 19:31:34 CEST 2012


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: <http://lists.denx.de/pipermail/u-boot/attachments/20120918/d614acba/attachment.pgp>


More information about the U-Boot mailing list