On 06.11.2026 18:12, Andrew Cooper wrote:
> There's no need for an alternative.  Use the same technique as arch_ffs() by
> pre-loading the destination register using the caller chosen "zero case"
> instead of -1.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <[email protected]>
> ---
> CC: Jan Beulich <[email protected]>
> CC: Roger Pau MonnĂ© <[email protected]>
> CC: Teddy Astie <[email protected]>
> 
> Slightly RFC.  I don't particualrly like forward-declaring ffsl(), but I don't
> see another option while maintaining a non-tangled common/arch header split.

Forward-declaring isn't a problem by itself, just that imo that wants putting
in xen/bitops.h, not ...

> --- a/xen/arch/x86/include/asm/bitops.h
> +++ b/xen/arch/x86/include/asm/bitops.h
> @@ -320,18 +320,35 @@ extern unsigned int __find_first_zero_bit(
>  extern unsigned int __find_next_zero_bit(
>      const unsigned long *addr, unsigned int size, unsigned int offset);
>  
> +static attr_const unsigned int ffsl(unsigned long x);

... here. asm/bitops.h already isn't included at the very top of the file, so
putting the decl there looks clean enough to me.

(Another alternative would be to see about doing away with __scanbit().)

With the decl moved:
Reviewed-by: Jan Beulich <[email protected]>

Jan

Reply via email to