Skip to content

Commit eec013b

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/string: use generic strrchr
Use generic strrchr instead of an optimized architecture specific variant. Performance of strrchr is not relevant for real life workloads, since the only user which may call this more frequently would be kbasename(). Suggested-by: Linus Torvalds <[email protected]> Link: https://lore.kernel.org/lkml/CAHk-=whoe211F8ND-9hZvfnib0UA4gga8DZJ+YaBZNbE4fubdg@mail.gmail.com/ Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 132c1e7 commit eec013b

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

arch/s390/include/asm/string.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ void *memmove(void *dest, const void *src, size_t n);
3636
#define __HAVE_ARCH_STRNCAT /* arch function */
3737
#define __HAVE_ARCH_STRNCPY /* arch function */
3838
#define __HAVE_ARCH_STRNLEN /* inline & arch function */
39-
#define __HAVE_ARCH_STRRCHR /* arch function */
4039
#define __HAVE_ARCH_STRSTR /* arch function */
4140

4241
/* Prototypes for non-inlined arch strings functions. */
@@ -46,7 +45,6 @@ size_t strlcat(char *dest, const char *src, size_t n);
4645
size_t strlcpy(char *dest, const char *src, size_t size);
4746
char *strncat(char *dest, const char *src, size_t n);
4847
char *strncpy(char *dest, const char *src, size_t n);
49-
char *strrchr(const char *s, int c);
5048
char *strstr(const char *s1, const char *s2);
5149
#endif /* !CONFIG_KASAN */
5250

arch/s390/lib/string.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -251,25 +251,6 @@ int strcmp(const char *s1, const char *s2)
251251
EXPORT_SYMBOL(strcmp);
252252
#endif
253253

254-
/**
255-
* strrchr - Find the last occurrence of a character in a string
256-
* @s: The string to be searched
257-
* @c: The character to search for
258-
*/
259-
#ifdef __HAVE_ARCH_STRRCHR
260-
char *strrchr(const char *s, int c)
261-
{
262-
ssize_t len = __strend(s) - s;
263-
264-
do {
265-
if (s[len] == (char)c)
266-
return (char *)s + len;
267-
} while (--len >= 0);
268-
return NULL;
269-
}
270-
EXPORT_SYMBOL(strrchr);
271-
#endif
272-
273254
static inline int clcle(const char *s1, unsigned long l1,
274255
const char *s2, unsigned long l2)
275256
{

0 commit comments

Comments
 (0)