[Skiboot] [RFC PATCH 04/12] core/console: Move inmem_read()

Oliver O'Halloran oohall at gmail.com
Tue May 19 15:46:25 AEST 2020


This is just to clean up the diffs in the following patches.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 core/console.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/core/console.c b/core/console.c
index 8724c71113a6..a1ec687cb67e 100644
--- a/core/console.c
+++ b/core/console.c
@@ -200,21 +200,6 @@ static void inmem_write(char c)
 	memcons.out_pos = cpu_to_be32(opos);
 }
 
-static size_t inmem_read(char *buf, size_t req)
-{
-	size_t read = 0;
-	char *ibuf = (char *)be64_to_cpu(memcons.ibuf_phys);
-
-	while (req && be32_to_cpu(memcons.in_prod) != be32_to_cpu(memcons.in_cons)) {
-		*(buf++) = ibuf[be32_to_cpu(memcons.in_cons)];
-		lwsync();
-		memcons.in_cons = cpu_to_be32((be32_to_cpu(memcons.in_cons) + 1) % INMEM_CON_IN_LEN);
-		req--;
-		read++;
-	}
-	return read;
-}
-
 static void write_char(char c)
 {
 	inmem_write(c);
@@ -252,6 +237,21 @@ ssize_t write(int fd __unused, const void *buf, size_t count)
 	return console_write(true, buf, count);
 }
 
+static size_t inmem_read(char *buf, size_t req)
+{
+	size_t read = 0;
+	char *ibuf = (char *)be64_to_cpu(memcons.ibuf_phys);
+
+	while (req && be32_to_cpu(memcons.in_prod) != be32_to_cpu(memcons.in_cons)) {
+		*(buf++) = ibuf[be32_to_cpu(memcons.in_cons)];
+		lwsync();
+		memcons.in_cons = cpu_to_be32((be32_to_cpu(memcons.in_cons) + 1) % INMEM_CON_IN_LEN);
+		req--;
+		read++;
+	}
+	return read;
+}
+
 ssize_t read(int fd __unused, void *buf, size_t req_count)
 {
 	bool need_unlock = lock_recursive(&con_lock);
-- 
2.26.2



More information about the Skiboot mailing list