]> Git Repo - J-u-boot.git/commitdiff
serial: Implement serial_initfunc() macro
authorMarek Vasut <[email protected]>
Wed, 12 Sep 2012 15:49:58 +0000 (17:49 +0200)
committerTom Rini <[email protected]>
Mon, 15 Oct 2012 18:53:49 +0000 (11:53 -0700)
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: Marek Vasut <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Anatolij Gustschin <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Mike Frysinger <[email protected]>
common/serial.c

index c4b111c496cad5e671d2cc87c5764b52ef10a0c4..7423920b9316ca43b693a493361edef186ba9783 100644 (file)
@@ -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
This page took 0.035528 seconds and 4 git commands to generate.