* [U-Boot] [PATCH 1/3] arm: semihosting: staticize internal functions
@ 2014-11-20 10:25 Linus Walleij
2014-12-12 17:55 ` Steve Rae
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2014-11-20 10:25 UTC (permalink / raw)
To: u-boot
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 <drambo@broadcom.com>
Cc: AKASHI Takahiro <takahiro.akashi@linaro.org>
Cc: Mark Hambleton <mark.hambleton@arm.com>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
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;
--
1.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* [U-Boot] [PATCH 1/3] arm: semihosting: staticize internal functions
2014-11-20 10:25 [U-Boot] [PATCH 1/3] arm: semihosting: staticize internal functions Linus Walleij
@ 2014-12-12 17:55 ` Steve Rae
0 siblings, 0 replies; 2+ messages in thread
From: Steve Rae @ 2014-12-12 17:55 UTC (permalink / raw)
To: u-boot
Acked-by: Steve Rae <srae@broadcom.com>
On 14-11-20 02:25 AM, Linus Walleij wrote:
> 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 <drambo@broadcom.com>
> Cc: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Cc: Mark Hambleton <mark.hambleton@arm.com>
> Cc: Tom Rini <trini@ti.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> 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;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-12 17:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20 10:25 [U-Boot] [PATCH 1/3] arm: semihosting: staticize internal functions Linus Walleij
2014-12-12 17:55 ` Steve Rae
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox