From patchwork Sat Jul 12 13:07:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeroen Hofstee X-Patchwork-Id: 369305 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 4D62D1400B2 for ; Sat, 12 Jul 2014 23:07:52 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 41FAEAB590; Sat, 12 Jul 2014 15:07:47 +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 JWbuEVkv8dQB; Sat, 12 Jul 2014 15:07:46 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 48CE4AB632; Sat, 12 Jul 2014 15:07:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 464ACA74F2 for ; Sat, 12 Jul 2014 15:07: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 YdAdSG4001W2 for ; Sat, 12 Jul 2014 15:07:32 +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 orange.myspectrum.nl (orange.myspectrum.nl [149.210.134.247]) by theia.denx.de (Postfix) with ESMTP id 45D8CA7C8F for ; Sat, 12 Jul 2014 15:07:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by orange.myspectrum.nl (Postfix) with ESMTP id 0C13D8DCDF; Sat, 12 Jul 2014 15:07:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at myspectrum.nl Received: from orange.myspectrum.nl ([127.0.0.1]) by localhost (orange.myspectrum.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Sda1kphtK7pX; Sat, 12 Jul 2014 15:07:29 +0200 (CEST) Received: from yellow (ip136-5-208-87.adsl2.static.versatel.nl [87.208.5.136]) (Authenticated sender: jeroen@myspectrum.nl) by orange.myspectrum.nl (Postfix) with ESMTPSA id 545E08DCDB; Sat, 12 Jul 2014 15:07:29 +0200 (CEST) Received: by yellow (Postfix, from userid 1000) id 13BB0743672; Sat, 12 Jul 2014 15:07:30 +0200 (CEST) From: Jeroen Hofstee To: u-boot@lists.denx.de Date: Sat, 12 Jul 2014 15:07:19 +0200 Message-Id: <1405170439-2872-3-git-send-email-jeroen@myspectrum.nl> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1405170439-2872-1-git-send-email-jeroen@myspectrum.nl> References: <1405170439-2872-1-git-send-email-jeroen@myspectrum.nl> Cc: Jeroen Hofstee Subject: [U-Boot] [PATCH 2/2] common: cmd_ide: use __weak and add prototypes 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 clang chokes about the concept of having an alias to an always_inlined function. gcc likely just ignores the always inlined since binary sizes are equal before and after this patch. Convert the aliases to weak functions and provide missing prototypes. cc: Pavel Herrmann Signed-off-by: Jeroen Hofstee --- common/cmd_ide.c | 51 +++++++++++++-------------------------------------- include/ide.h | 4 ++++ 2 files changed, 17 insertions(+), 38 deletions(-) diff --git a/common/cmd_ide.c b/common/cmd_ide.c index f3c0425..04a6d9b 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -253,7 +253,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) /* ------------------------------------------------------------------------- */ -void __ide_led(uchar led, uchar status) +__weak void ide_led(uchar led, uchar status) { #if defined(CONFIG_IDE_LED) && defined(PER8_BASE) /* required by LED_PORT */ static uchar led_buffer; /* Buffer for current LED status */ @@ -269,9 +269,6 @@ void __ide_led(uchar led, uchar status) #endif } -void ide_led(uchar led, uchar status) - __attribute__ ((weak, alias("__ide_led"))); - #ifndef CONFIG_IDE_LED /* define LED macros, they are not used anyways */ # define DEVICE_LED(x) 0 # define LED_IDE1 1 @@ -280,7 +277,7 @@ void ide_led(uchar led, uchar status) /* ------------------------------------------------------------------------- */ -inline void __ide_outb(int dev, int port, unsigned char val) +__weak void ide_outb(int dev, int port, unsigned char val) { debug("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n", dev, port, val, @@ -299,10 +296,7 @@ inline void __ide_outb(int dev, int port, unsigned char val) #endif } -void ide_outb(int dev, int port, unsigned char val) - __attribute__ ((weak, alias("__ide_outb"))); - -inline unsigned char __ide_inb(int dev, int port) +__weak unsigned char ide_inb(int dev, int port) { uchar val; @@ -318,9 +312,6 @@ inline unsigned char __ide_inb(int dev, int port) return val; } -unsigned char ide_inb(int dev, int port) - __attribute__ ((weak, alias("__ide_inb"))); - void ide_init(void) { unsigned char c; @@ -461,23 +452,14 @@ block_dev_desc_t *ide_get_dev(int dev) /* ------------------------------------------------------------------------- */ -void ide_input_swap_data(int dev, ulong *sect_buf, int words) - __attribute__ ((weak, alias("__ide_input_swap_data"))); - -void ide_input_data(int dev, ulong *sect_buf, int words) - __attribute__ ((weak, alias("__ide_input_data"))); - -void ide_output_data(int dev, const ulong *sect_buf, int words) - __attribute__ ((weak, alias("__ide_output_data"))); - /* We only need to swap data if we are running on a big endian cpu. */ #if defined(__LITTLE_ENDIAN) -void __ide_input_swap_data(int dev, ulong *sect_buf, int words) +__weak void ide_input_swap_data(int dev, ulong *sect_buf, int words) { ide_input_data(dev, sect_buf, words); } #else -void __ide_input_swap_data(int dev, ulong *sect_buf, int words) +__weak void ide_input_swap_data(int dev, ulong *sect_buf, int words) { volatile ushort *pbuf = (ushort *) (ATA_CURR_BASE(dev) + ATA_DATA_REG); @@ -500,7 +482,7 @@ void __ide_input_swap_data(int dev, ulong *sect_buf, int words) #if defined(CONFIG_IDE_SWAP_IO) -void __ide_output_data(int dev, const ulong *sect_buf, int words) +__weak void ide_output_data(int dev, const ulong *sect_buf, int words) { ushort *dbuf; volatile ushort *pbuf; @@ -515,7 +497,7 @@ void __ide_output_data(int dev, const ulong *sect_buf, int words) } } #else /* ! CONFIG_IDE_SWAP_IO */ -void __ide_output_data(int dev, const ulong *sect_buf, int words) +__weak void ide_output_data(int dev, const ulong *sect_buf, int words) { #if defined(CONFIG_IDE_AHB) ide_write_data(dev, sect_buf, words); @@ -526,7 +508,7 @@ void __ide_output_data(int dev, const ulong *sect_buf, int words) #endif /* CONFIG_IDE_SWAP_IO */ #if defined(CONFIG_IDE_SWAP_IO) -void __ide_input_data(int dev, ulong *sect_buf, int words) +__weak void ide_input_data(int dev, ulong *sect_buf, int words) { ushort *dbuf; volatile ushort *pbuf; @@ -544,7 +526,7 @@ void __ide_input_data(int dev, ulong *sect_buf, int words) } } #else /* ! CONFIG_IDE_SWAP_IO */ -void __ide_input_data(int dev, ulong *sect_buf, int words) +__weak void ide_input_data(int dev, ulong *sect_buf, int words) { #if defined(CONFIG_IDE_AHB) ide_read_data(dev, sect_buf, words); @@ -1038,17 +1020,10 @@ int ide_device_present(int dev) * ATAPI Support */ -void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts) - __attribute__ ((weak, alias("__ide_input_data_shorts"))); - -void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts) - __attribute__ ((weak, alias("__ide_output_data_shorts"))); - - #if defined(CONFIG_IDE_SWAP_IO) /* since ATAPI may use commands with not 4 bytes alligned length * we have our own transfer functions, 2 bytes alligned */ -void __ide_output_data_shorts(int dev, ushort *sect_buf, int shorts) +__weak void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts) { ushort *dbuf; volatile ushort *pbuf; @@ -1065,7 +1040,7 @@ void __ide_output_data_shorts(int dev, ushort *sect_buf, int shorts) } } -void __ide_input_data_shorts(int dev, ushort *sect_buf, int shorts) +__weak void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts) { ushort *dbuf; volatile ushort *pbuf; @@ -1083,12 +1058,12 @@ void __ide_input_data_shorts(int dev, ushort *sect_buf, int shorts) } #else /* ! CONFIG_IDE_SWAP_IO */ -void __ide_output_data_shorts(int dev, ushort *sect_buf, int shorts) +__weak void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts) { outsw(ATA_CURR_BASE(dev) + ATA_DATA_REG, sect_buf, shorts); } -void __ide_input_data_shorts(int dev, ushort *sect_buf, int shorts) +__weak void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts) { insw(ATA_CURR_BASE(dev) + ATA_DATA_REG, sect_buf, shorts); } diff --git a/include/ide.h b/include/ide.h index 0424d04..c2a48e0 100644 --- a/include/ide.h +++ b/include/ide.h @@ -66,12 +66,16 @@ void ide_write_data(int dev, const ulong *sect_buf, int words); /* * I/O function overrides */ +unsigned char ide_inb(int dev, int port); +void ide_outb(int dev, int port, unsigned char val); void ide_input_swap_data(int dev, ulong *sect_buf, int words); void ide_input_data(int dev, ulong *sect_buf, int words); void ide_output_data(int dev, const ulong *sect_buf, int words); void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts); void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts); +void ide_led(uchar led, uchar status); + /** * board_start_ide() - Start up the board IDE interfac *