Commit 50b56394307f76afe5ed1fac885e6d792d432c58

Authored by Linus Walleij
Committed by Tom Rini
1 parent 437b23e67f

arm: semihosting: staticize internal functions

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>
Acked-by: Steve Rae <srae@broadcom.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Showing 2 changed files with 9 additions and 8 deletions Side-by-side Diff

arch/arm/include/asm/semihosting.h
... ... @@ -12,10 +12,6 @@
12 12 * code for more information.
13 13 */
14 14 int smh_load(const char *fname, void *memp, int avail, int verbose);
15   -int smh_read(int fd, void *memp, int len);
16   -int smh_open(const char *fname, char *modestr);
17   -int smh_close(int fd);
18   -int smh_len_fd(int fd);
19 15 int smh_len(const char *fname);
20 16  
21 17 #endif /* __SEMIHOSTING_H__ */
arch/arm/lib/semihosting.c
... ... @@ -23,6 +23,11 @@
23 23 #define MODE_READ 0x0
24 24 #define MODE_READBIN 0x1
25 25  
  26 +static int smh_read(int fd, void *memp, int len);
  27 +static int smh_open(const char *fname, char *modestr);
  28 +static int smh_close(int fd);
  29 +static int smh_len_fd(int fd);
  30 +
26 31 /*
27 32 * Call the handler
28 33 */
... ... @@ -96,7 +101,7 @@
96 101 /*
97 102 * Read 'len' bytes of file into 'memp'. Returns 0 on success, else failure
98 103 */
99   -int smh_read(int fd, void *memp, int len)
  104 +static int smh_read(int fd, void *memp, int len)
100 105 {
101 106 int ret;
102 107 struct smh_read_s {
... ... @@ -131,7 +136,7 @@
131 136 * Open a file on the host. Mode is "r" or "rb" currently. Returns a file
132 137 * descriptor or -1 on error.
133 138 */
134   -int smh_open(const char *fname, char *modestr)
  139 +static int smh_open(const char *fname, char *modestr)
135 140 {
136 141 int ret, fd, mode;
137 142 struct smh_open_s {
... ... @@ -171,7 +176,7 @@
171 176 /*
172 177 * Close the file using the file descriptor
173 178 */
174   -int smh_close(int fd)
  179 +static int smh_close(int fd)
175 180 {
176 181 int ret;
177 182 long fdlong;
... ... @@ -189,7 +194,7 @@
189 194 /*
190 195 * Get the file length from the file descriptor
191 196 */
192   -int smh_len_fd(int fd)
  197 +static int smh_len_fd(int fd)
193 198 {
194 199 int ret;
195 200 long fdlong;