From patchwork Mon Dec 15 10:05:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 42220 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DB3592456A for ; Mon, 15 Dec 2014 10:06:05 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id hs14sf7039529lab.1 for ; Mon, 15 Dec 2014 02:06:04 -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=YkSylbL3T5Tuj3ixRO8sBafSe3xOpIWDLxx1b48AsPE=; b=StBiUDoAJOodunWpcGPvGkNmNcD2DlzFhBsROYBGdZRGn/Wjnio3EhPOivbqAx9fY9 uH4G7WHVJvtIPTRwZWd8Eqj9je3PR10QR1luXGd30KXKwxU+GwpalZbzO8608gR2Egto 6rrjkDVQWvkHYCpa2CeUO13EXoJCIQiuyqWYjob9JMinzF7YqG2aF+rAvEcZyOqOVvnl ujYM3fB85burvaRpfyWgPeA/KkqZBn1GtVWnaEx6QNZjuDDuBGG+W6Vb6v1YP35DtkTg ZTTdc3Of01VAH3sgFAVkeMJACTc6fsnNmMA5Mp5fFBqcE2LtlHzyP2hNWqUixPVvcFwU qTeA== X-Gm-Message-State: ALoCoQnmOOSbgdxwTei4o7LIQlUJSwjkFzg7eXirbqjfq3yNffsVQAsAroYucSHz4bnQibWttBUe X-Received: by 10.112.142.36 with SMTP id rt4mr4539235lbb.3.1418637964901; Mon, 15 Dec 2014 02:06:04 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.100 with SMTP id i4ls534294laa.106.gmail; Mon, 15 Dec 2014 02:06:04 -0800 (PST) X-Received: by 10.112.35.234 with SMTP id l10mr29516258lbj.12.1418637964683; Mon, 15 Dec 2014 02:06:04 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id q2si9668907lbb.130.2014.12.15.02.06.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Dec 2014 02:06:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id z12so8757218lbi.32 for ; Mon, 15 Dec 2014 02:06:04 -0800 (PST) X-Received: by 10.152.27.8 with SMTP id p8mr12580387lag.69.1418637964582; Mon, 15 Dec 2014 02:06:04 -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.142.69 with SMTP id ru5csp665724lbb; Mon, 15 Dec 2014 02:06:04 -0800 (PST) X-Received: by 10.194.176.100 with SMTP id ch4mr51281647wjc.101.1418637963703; Mon, 15 Dec 2014 02:06:03 -0800 (PST) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id w7si16198432wiz.10.2014.12.15.02.06.02 for ; Mon, 15 Dec 2014 02:06:03 -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 ED5594B97A; Mon, 15 Dec 2014 11:06:01 +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 BoGo9+gRH2aO; Mon, 15 Dec 2014 11:06:01 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B67544B961; Mon, 15 Dec 2014 11:06:00 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D99C44B961 for ; Mon, 15 Dec 2014 11:05:55 +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 px1p2auk7rzw for ; Mon, 15 Dec 2014 11:05:55 +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-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by theia.denx.de (Postfix) with ESMTPS id 8FB544B95E for ; Mon, 15 Dec 2014 11:05:52 +0100 (CET) Received: by mail-wi0-f175.google.com with SMTP id l15so8271109wiw.14 for ; Mon, 15 Dec 2014 02:05:51 -0800 (PST) X-Received: by 10.181.8.66 with SMTP id di2mr29262857wid.49.1418637951702; Mon, 15 Dec 2014 02:05:51 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id d2sm12397724wjs.32.2014.12.15.02.05.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Dec 2014 02:05:50 -0800 (PST) From: Linus Walleij To: u-boot@lists.denx.de, Albert Aribaud , Steve Rae Date: Mon, 15 Dec 2014 11:05:43 +0100 Message-Id: <1418637943-23477-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 v2] 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.217.173 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 Acked-by: Steve Rae Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Added Steve's ACK. --- 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;