Skip to content
Snippets Groups Projects
Commit 2a333aeb authored by Marek Vasut's avatar Marek Vasut Committed by Tom Rini
Browse files

serial: Implement serial_initfunc() macro


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.

Signed-off-by: default avatarMarek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
parent bfb31279
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,14 @@ DECLARE_GLOBAL_DATA_PTR;
static struct serial_device *serial_devices;
static struct serial_device *serial_current;
static void serial_null(void)
{
}
#define serial_initfunc(name) \
void name(void) \
__attribute__((weak, alias("serial_null")));
void serial_register(struct serial_device *dev)
{
#ifdef CONFIG_NEEDS_MANUAL_RELOC
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment