1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2048fa2dfSCatalin Marinas #ifndef _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
3048fa2dfSCatalin Marinas #define _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
4048fa2dfSCatalin Marinas 
5048fa2dfSCatalin Marinas /**
6048fa2dfSCatalin Marinas  * __ffs - find first bit in word.
7048fa2dfSCatalin Marinas  * @word: The word to search
8048fa2dfSCatalin Marinas  *
9048fa2dfSCatalin Marinas  * Undefined if no bit exists, so code should check against 0 first.
10048fa2dfSCatalin Marinas  */
__ffs(unsigned long word)11048fa2dfSCatalin Marinas static __always_inline unsigned long __ffs(unsigned long word)
12048fa2dfSCatalin Marinas {
13048fa2dfSCatalin Marinas 	return __builtin_ctzl(word);
14048fa2dfSCatalin Marinas }
15048fa2dfSCatalin Marinas 
16048fa2dfSCatalin Marinas #endif
17