[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180301152654.29275-1-robh@kernel.org>
Date: Thu, 1 Mar 2018 09:26:54 -0600
From: Rob Herring <robh@...nel.org>
To: Michael Ellerman <mpe@...erman.id.au>
Cc: linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>
Subject: [PATCH] powerpc: boot: add strrchr function
libfdt gained a new dependency on strrchr, so copy the implementation
from lib/string.c. Most of the string functions are in assembly, but
stdio.c already has strnlen, so add strrchr there.
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Michael Ellerman <mpe@...erman.id.au>
Signed-off-by: Rob Herring <robh@...nel.org>
---
Please ack. This is a dependency for dtc/libfdt sync with upstream.
arch/powerpc/boot/stdio.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/powerpc/boot/stdio.c b/arch/powerpc/boot/stdio.c
index a701261b1781..98042eff7b26 100644
--- a/arch/powerpc/boot/stdio.c
+++ b/arch/powerpc/boot/stdio.c
@@ -21,6 +21,16 @@ size_t strnlen(const char * s, size_t count)
return sc - s;
}
+char *strrchr(const char *s, int c)
+{
+ const char *last = NULL;
+ do {
+ if (*s == (char)c)
+ last = s;
+ } while (*s++);
+ return (char *)last;
+}
+
#ifdef __powerpc64__
# define do_div(n, base) ({ \
--
2.14.1
Powered by blists - more mailing lists