From patchwork Sat Sep 29 00:30:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 187926 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3F0202C00B6 for ; Sat, 29 Sep 2012 10:33:53 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A289C28179; Sat, 29 Sep 2012 02:33:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3J+N5scjdD5q; Sat, 29 Sep 2012 02:33:34 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8BB002817F; Sat, 29 Sep 2012 02:32:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 278D228102 for ; Sat, 29 Sep 2012 02:31:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2T1cGjQ004eH for ; Sat, 29 Sep 2012 02:31:42 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by theia.denx.de (Postfix) with ESMTPS id 1C40E28103 for ; Sat, 29 Sep 2012 02:31:37 +0200 (CEST) Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3XT9fx3ZTwz3hhps; Sat, 29 Sep 2012 02:31:37 +0200 (CEST) X-Auth-Info: MZyHLl+GKnURKSFJZQwrGBe92q+bUNunZ0+HTKbHaIQ= Received: from mashiro.lan (unknown [195.140.253.167]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 3XT9fx1gqbzbbh2; Sat, 29 Sep 2012 02:31:37 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Date: Sat, 29 Sep 2012 02:30:25 +0200 Message-Id: <1348878687-14194-9-git-send-email-marex@denx.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1348878687-14194-1-git-send-email-marex@denx.de> References: <1347837696-3192-1-git-send-email-marex@denx.de> <1348878687-14194-1-git-send-email-marex@denx.de> Cc: Marek Vasut , Stefan Roese , Tom Rini Subject: [U-Boot] [PATCH 08/70] serial: Implement serial_initfunc() macro X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 Cc: Marek Vasut Cc: Tom Rini Cc: Anatolij Gustschin Cc: Stefan Roese Cc: Mike Frysinger --- common/serial.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/serial.c b/common/serial.c index 5740d4f..84dbe50 100644 --- a/common/serial.c +++ b/common/serial.c @@ -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