diff options
author | Rob Herring <robh@kernel.org> | 2018-03-01 08:57:40 -0600 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2018-03-05 20:58:17 -0600 |
commit | a54b81ea242309a098162c3284ed964074bee72a (patch) | |
tree | c80649e8b803d52da63ceae47141d48f6123ce93 /arch/powerpc/boot/stdio.c | |
parent | fdfb69a72522e97f9105a6d39a5be0a465951ed8 (diff) | |
download | linux-stable-a54b81ea242309a098162c3284ed964074bee72a.tar.gz linux-stable-a54b81ea242309a098162c3284ed964074bee72a.tar.bz2 linux-stable-a54b81ea242309a098162c3284ed964074bee72a.zip |
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@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'arch/powerpc/boot/stdio.c')
-rw-r--r-- | arch/powerpc/boot/stdio.c | 10 |
1 files changed, 10 insertions, 0 deletions
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) ({ \ |