From patchwork Sun Sep 16 23:20:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 184191 X-Patchwork-Delegate: trini@ti.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 29ABC2C007E for ; Mon, 17 Sep 2012 09:23:23 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2221C282AE; Mon, 17 Sep 2012 01:23:21 +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 9NRIJDIn7dKt; Mon, 17 Sep 2012 01:23:20 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2298A282C3; Mon, 17 Sep 2012 01:22:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ADE3B282B5 for ; Mon, 17 Sep 2012 01:21:48 +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 PG+9SUQfEirX for ; Mon, 17 Sep 2012 01:21:46 +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 033A02825F for ; Mon, 17 Sep 2012 01:21:43 +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 3XKmgq2Xy8z3hhk3; Mon, 17 Sep 2012 01:21:43 +0200 (CEST) X-Auth-Info: eS6KfJG5mVF5BG8XEo1mCxO6f8IzYjWvxl0nPuU3EDw= Received: from mashiro.lan (unknown [195.140.253.167]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 3XKmgq0d6Nzbbcc; Mon, 17 Sep 2012 01:21:43 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Date: Mon, 17 Sep 2012 01:20:33 +0200 Message-Id: <1347837696-3192-9-git-send-email-marex@denx.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1347837696-3192-1-git-send-email-marex@denx.de> References: <1347837696-3192-1-git-send-email-marex@denx.de> Cc: Marek Vasut , Stefan Roese , Tom Rini Subject: [U-Boot] [PATCH 08/71] 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