From patchwork Thu Nov 20 10:25:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 412628 X-Patchwork-Delegate: albert.aribaud@free.fr 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 6DA5814014D for ; Thu, 20 Nov 2014 21:25:30 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B28684B6A1; Thu, 20 Nov 2014 11:25:27 +0100 (CET) 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 B9wM5QOTLWpc; Thu, 20 Nov 2014 11:25:27 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 451784B698; Thu, 20 Nov 2014 11:25:27 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6EBD04B698 for ; Thu, 20 Nov 2014 11:25:22 +0100 (CET) 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 uRl-EdmEpt9y for ; Thu, 20 Nov 2014 11:25:22 +0100 (CET) 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-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by theia.denx.de (Postfix) with ESMTPS id 40E114B696 for ; Thu, 20 Nov 2014 11:25:19 +0100 (CET) Received: by mail-wi0-f173.google.com with SMTP id r20so8152365wiv.12 for ; Thu, 20 Nov 2014 02:25:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ymuFHWaLSzJDH1z4LFaZCAtxXalZG2gozL6WbrRvnDM=; b=l3yL5hZKX5b7dGQQFohV3JSrL8vOfE7grAD+Jxa0BvbibzGOhzDSHGOFkUYj7cBhAQ o0vnTOiU+OVvhn5alIj62eea7jrcm+2xBi02Tsl7YT14zPDnN8RuOSe9F4VITQpwEmfM nGZrB8FBUXujNvbHXlCos91FlF5TlotUcpwDCPFuuaWNs4UNsLCeoU630CarZZE6GpBE lAk0fOJ5dD/RKCxigHHMj3xh2QparAMh1tteaQ8G9wMhN+dgh8I1NxEtezksUHeCtUvZ KsDMYuxjxcnHjGyXulZ4wiHvERwYQOwDy+9prSYklQZEBy3/CN9vHnQeNhPWmuzqMA4h 1AnQ== X-Gm-Message-State: ALoCoQmTtpFrmXNzbFBzzszUEHPXs+4wk35QMmhFHdr7DZbZxLrctTtFl4zxu949cOKtSpH4R8mR X-Received: by 10.194.87.131 with SMTP id ay3mr68047422wjb.66.1416479118779; Thu, 20 Nov 2014 02:25:18 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id f7sm3426335wiz.13.2014.11.20.02.25.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Nov 2014 02:25:17 -0800 (PST) From: Linus Walleij To: u-boot@lists.denx.de, Albert Aribaud Date: Thu, 20 Nov 2014 11:25:13 +0100 Message-Id: <1416479113-27772-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 Cc: u-boot-review@google.com, Mark Hambleton , Tom Rini , Darwin Rambo Subject: [U-Boot] [PATCH 1/3] arm: semihosting: staticize internal functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 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 The semihosting code exposes internal file handle handling functions to read(), open(), close() and get the length of a certain file handle. However the code using it is only interested in either reading and entire named file into memory or getting the file length of a file referred by name. No file handles are used. Thus make the file handle code internal to this file by removing these functions from the semihosting header file and staticize them. This gives us some freedom to rearrange the semihosting code without affecting the external interface. Cc: Darwin Rambo Cc: AKASHI Takahiro Cc: Mark Hambleton Cc: Tom Rini Signed-off-by: Linus Walleij Acked-by: Steve Rae --- arch/arm/include/asm/semihosting.h | 4 ---- arch/arm/lib/semihosting.c | 13 +++++++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/arm/include/asm/semihosting.h b/arch/arm/include/asm/semihosting.h index 74111dc359d1..e59b44ed6068 100644 --- a/arch/arm/include/asm/semihosting.h +++ b/arch/arm/include/asm/semihosting.h @@ -12,10 +12,6 @@ * code for more information. */ int smh_load(const char *fname, void *memp, int avail, int verbose); -int smh_read(int fd, void *memp, int len); -int smh_open(const char *fname, char *modestr); -int smh_close(int fd); -int smh_len_fd(int fd); int smh_len(const char *fname); #endif /* __SEMIHOSTING_H__ */ diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c index cb5dc26ac3fa..92bbabe158fe 100644 --- a/arch/arm/lib/semihosting.c +++ b/arch/arm/lib/semihosting.c @@ -23,6 +23,11 @@ #define MODE_READ 0x0 #define MODE_READBIN 0x1 +static int smh_read(int fd, void *memp, int len); +static int smh_open(const char *fname, char *modestr); +static int smh_close(int fd); +static int smh_len_fd(int fd); + /* * Call the handler */ @@ -96,7 +101,7 @@ int smh_load(const char *fname, void *memp, int avail, int verbose) /* * Read 'len' bytes of file into 'memp'. Returns 0 on success, else failure */ -int smh_read(int fd, void *memp, int len) +static int smh_read(int fd, void *memp, int len) { int ret; struct smh_read_s { @@ -131,7 +136,7 @@ int smh_read(int fd, void *memp, int len) * Open a file on the host. Mode is "r" or "rb" currently. Returns a file * descriptor or -1 on error. */ -int smh_open(const char *fname, char *modestr) +static int smh_open(const char *fname, char *modestr) { int ret, fd, mode; struct smh_open_s { @@ -171,7 +176,7 @@ int smh_open(const char *fname, char *modestr) /* * Close the file using the file descriptor */ -int smh_close(int fd) +static int smh_close(int fd) { int ret; long fdlong; @@ -189,7 +194,7 @@ int smh_close(int fd) /* * Get the file length from the file descriptor */ -int smh_len_fd(int fd) +static int smh_len_fd(int fd) { int ret; long fdlong;