mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/6] firmware: semihosting: don't return error code from writec/write0
Date: Tue, 11 Jun 2024 08:59:20 +0200	[thread overview]
Message-ID: <20240611065923.2900168-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240611065923.2900168-1-a.fatoum@pengutronix.de>

As described in the "ARM Compiler toolchain Developing Software
for ARM Processors Version 5.0" document[1], SYS_WRITE0 and SYS_WRITEC
corrupt the R0 register, unlike the other calls that return negative
error codes. Therefore change the return type to void.

[1]: https://developer.arm.com/documentation/dui0471/i/semihosting/sys-write0--0x04-?lang=en

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/firmware/semihosting.c    | 8 ++++----
 include/asm-generic/semihosting.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/firmware/semihosting.c b/drivers/firmware/semihosting.c
index a037a95a1077..1dfbdf219727 100644
--- a/drivers/firmware/semihosting.c
+++ b/drivers/firmware/semihosting.c
@@ -91,15 +91,15 @@ int semihosting_close(int fd)
 }
 EXPORT_SYMBOL(semihosting_close);
 
-int semihosting_writec(char c)
+void semihosting_writec(char c)
 {
-	return semihosting_trap(SEMIHOSTING_SYS_WRITEC, &c);
+	(void)semihosting_trap(SEMIHOSTING_SYS_WRITEC, &c);
 }
 EXPORT_SYMBOL(semihosting_writec);
 
-int semihosting_write0(const char *str)
+void semihosting_write0(const char *str)
 {
-	return semihosting_trap(SEMIHOSTING_SYS_WRITE0, (void *)str);
+	(void)semihosting_trap(SEMIHOSTING_SYS_WRITE0, (void *)str);
 }
 EXPORT_SYMBOL(semihosting_write0);
 
diff --git a/include/asm-generic/semihosting.h b/include/asm-generic/semihosting.h
index b745f8831977..67031c331b97 100644
--- a/include/asm-generic/semihosting.h
+++ b/include/asm-generic/semihosting.h
@@ -7,8 +7,8 @@
 
 int semihosting_open(const char *fname, int flags);
 int semihosting_close(int fd);
-int semihosting_writec(char c);
-int semihosting_write0(const char *str);
+void semihosting_writec(char c);
+void semihosting_write0(const char *str);
 ssize_t semihosting_write(int fd, const void *buf, size_t count);
 ssize_t semihosting_read(int fd, void *buf, size_t count);
 int semihosting_readc(void);
-- 
2.39.2




  parent reply	other threads:[~2024-06-11  7:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11  6:59 [PATCH 0/6] semihosting: extend support for ARM64, console Ahmad Fatoum
2024-06-11  6:59 ` [PATCH 1/6] ARM: lib32: semihosting: prepare for more general use Ahmad Fatoum
2024-06-11  6:59 ` [PATCH 2/6] firmware: semihosting: add ARMv8-A semihosting support Ahmad Fatoum
2024-06-11  6:59 ` Ahmad Fatoum [this message]
2024-06-11  6:59 ` [PATCH 4/6] firmware: semihosting: translate return values in wrappers Ahmad Fatoum
2024-06-11  6:59 ` [PATCH 5/6] ARM: semihosting: add DEBUG_LL implementation Ahmad Fatoum
2024-06-11  6:59 ` [PATCH 6/6] serial: add semihosting console Ahmad Fatoum
2024-06-13  7:18 ` [PATCH 0/6] semihosting: extend support for ARM64, console Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240611065923.2900168-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox