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: 41225 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A348A23588 for ; Thu, 20 Nov 2014 10:25:30 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf1835128wib.2 for ; Thu, 20 Nov 2014 02:25:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:cc:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=MSPvav18FWRMBtYkSqm2D8FyVsAOyfcsxbRofIvnlMY=; b=eJHMfa5fXPR34Lrsj9A2k+5mrAlTzFd319Sz4vafJQSU0sNqCBHJgRCJF5gNEGNrUL u/zSGJEo2o9i9B5ND2UwTElDP8Xef/M27mbdYH/laGyiaJvMqKuVnMOdXjHixxvKax8a th+9WXjtOGO6B5h8oHsqCEpRTnXyZFwfDNbDySOIJAM3OyDrUGn/8iLIrV+Lf3/+j0WU ifcnp65gKOMyoqcQti4GDJCPkX7aWzNY8jjBXA6w4QEhlYw6tSwZX1uX1Pt1mi9mO0so cgDPe6S/lsqvE+8bxLHyaVtyM9z02jD3uEM4CaspJz2EwCNOJkBBWe/P9cKOyMHJ9jBz lZOA== X-Gm-Message-State: ALoCoQlIirgThPghA96KEc0Lp4dbOLefffQKnAgwsIfIezbPEMSZ+642Vxk1nK90DkFQGvypEyl9 X-Received: by 10.181.13.147 with SMTP id ey19mr7052594wid.2.1416479129955; Thu, 20 Nov 2014 02:25:29 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.9 with SMTP id ls9ls43475lac.44.gmail; Thu, 20 Nov 2014 02:25:29 -0800 (PST) X-Received: by 10.152.10.67 with SMTP id g3mr10643940lab.59.1416479129327; Thu, 20 Nov 2014 02:25:29 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id kw3si1799266lbc.61.2014.11.20.02.25.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Nov 2014 02:25:29 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id hz20so2128151lab.6 for ; Thu, 20 Nov 2014 02:25:29 -0800 (PST) X-Received: by 10.112.14.69 with SMTP id n5mr10570313lbc.34.1416479129218; Thu, 20 Nov 2014 02:25:29 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp237009lbc; Thu, 20 Nov 2014 02:25:28 -0800 (PST) X-Received: by 10.180.8.34 with SMTP id o2mr13789339wia.23.1416479128577; Thu, 20 Nov 2014 02:25:28 -0800 (PST) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id y8si2681516wjx.160.2014.11.20.02.25.27 for ; Thu, 20 Nov 2014 02:25:28 -0800 (PST) Received-SPF: none (google.com: u-boot-bounces@lists.denx.de does not designate permitted sender hosts) client-ip=85.214.87.163; 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-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: 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 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 --- 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;