diff options
| author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2025-11-17 10:37:37 +0100 |
|---|---|---|
| committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2025-11-17 10:37:37 +0100 |
| commit | 82e71fe4368699341333e7e0d059ef7df139cf95 (patch) | |
| tree | 2301b1002cc906354e0a7847995a5b830cba4b7d /include/linux/string.h | |
| parent | b6d31cd41814a33c1a22b8c676131820440cc44e (diff) | |
| parent | e511d484cbe44fe48a1b9f621f6a947c72503f9e (diff) | |
Merge tag 'gpio/shared-gpios-for-v6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git into gpio/for-next
Immutable branch between the GPIO, ASoC and regulator trees for v6.19-rc1
Add better support for GPIOs shared by multiple consumers.
Diffstat (limited to 'include/linux/string.h')
| -rw-r--r-- | include/linux/string.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/string.h b/include/linux/string.h index fdd3442c6bcb..929d05d1247c 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -562,4 +562,22 @@ static inline bool strstarts(const char *str, const char *prefix) return strncmp(str, prefix, strlen(prefix)) == 0; } +/** + * strends - Check if a string ends with another string. + * @str - NULL-terminated string to check against @suffix + * @suffix - NULL-terminated string defining the suffix to look for in @str + * + * Returns: + * True if @str ends with @suffix. False in all other cases. + */ +static inline bool strends(const char *str, const char *suffix) +{ + unsigned int str_len = strlen(str), suffix_len = strlen(suffix); + + if (str_len < suffix_len) + return false; + + return !(strcmp(str + str_len - suffix_len, suffix)); +} + #endif /* _LINUX_STRING_H_ */ |
