
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?