]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
arm/bitops: encapsulate violation of MISRA C:2012 Rule 10.1
authorNicola Vetrini <nicola.vetrini@bugseng.com>
Wed, 29 Nov 2023 09:32:39 +0000 (10:32 +0100)
committerJulien Grall <julien@xen.org>
Wed, 29 Nov 2023 17:21:58 +0000 (18:21 +0100)
The definitions of ffs{l}? violate Rule 10.1, by using the well-known
pattern (x & -x); its usage is wrapped by the ISOLATE_LSB macro.

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/include/asm/bitops.h

index 71ae14cab355b157ac4f660cb1b09800e71a20e1..ab030b6cb032308f42821caae4765f8105c7ad54 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef _ARM_BITOPS_H
 #define _ARM_BITOPS_H
 
+#include <xen/macros.h>
+
 #include <asm/asm_defns.h>
 
 /*
@@ -155,8 +157,8 @@ static inline int fls(unsigned int x)
 }
 
 
-#define ffs(x) ({ unsigned int __t = (x); fls(__t & -__t); })
-#define ffsl(x) ({ unsigned long __t = (x); flsl(__t & -__t); })
+#define ffs(x) ({ unsigned int __t = (x); fls(ISOLATE_LSB(__t)); })
+#define ffsl(x) ({ unsigned long __t = (x); flsl(ISOLATE_LSB(__t)); })
 
 /**
  * find_first_set_bit - find the first set bit in @word