diff mbox series

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

Message ID 20200519054633.113238-5-oohall@gmail.com
State RFC
Headers show
Series [RFC,01/12] platform/mambo: Add a mambo OPAL console driver | expand

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (0f1937ef40fca0c3212a9dff1010b832a24fb063)

Commit Message

Oliver O'Halloran May 19, 2020, 5:46 a.m. UTC
This is just to clean up the diffs in the following patches.

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

Patch

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);