Skip to content
Snippets Groups Projects
Commit 6628bacc authored by Oleksii Kurochko's avatar Oleksii Kurochko Committed by Jan Beulich
Browse files

xen/bitops: put __ffs() into linux compatible header


The mentioned macros exist only because of Linux compatible purpose.

The patch defines __ffs() in terms of Xen bitops and it is safe
to define in this way ( as __ffs() - 1 ) as considering that __ffs()
was defined as __builtin_ctzl(x), which has undefined behavior when x=0,
so it is assumed that such cases are not encountered in the current code.

To not include <xen/linux-compat.h> to Xen library files __ffs() and __ffz()
were defined locally in find-next-bit.c.

Except __ffs() usage in find-next-bit.c only one usage of __ffs() leave
in smmu-v3.c. It seems that it __ffs can be changed to ffsl(x)-1 in
this file, but to keep smmu-v3.c looks close to linux it was deciced just
to define __ffs() in xen/linux-compat.h and include it in smmu-v3.c

Signed-off-by: default avatarOleksii Kurochko <oleksii.kurochko@gmail.com>
Acked-by: default avatarShawn Anastasio <sanastasio@raptorengineering.com>
Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
Acked-by: Michal Orzel's avatarMichal Orzel <michal.orzel@amd.com>
Acked-by: Rahul Singh's avatarRahul Singh <rahul.singh@arm.com>
parent d0c61140
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment