xen/arm: Fix ARM build following c/s 11c397c
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 8 Feb 2017 19:10:15 +0000 (19:10 +0000)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 8 Feb 2017 23:36:19 +0000 (15:36 -0800)
c/s 11c397c broke the ARM build by introducing a common ACCESS_ONCE() which is
different to the definition in smmu.c

The SMMU code included a scalar typecheck, which is worth keeping in the
common case, given ACCESS_ONCE()'s restrictions.  However, express the
typecheck differently so as to avoid Coverity complaints about unused
variables.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Julien Grall <julien.grall@arm.com>
xen/drivers/passthrough/arm/smmu.c
xen/include/xen/lib.h

index cf8b8b81672490eab934ae7dc71fc163fd647a40..06c0a457382a276e0bd3f0615f236c3c90b2e831 100644 (file)
@@ -198,16 +198,6 @@ typedef paddr_t phys_addr_t;
 
 #define VA_BITS                0       /* Only used for configuring stage-1 input size */
 
-/* The macro ACCESS_ONCE start to be replaced in Linux in favor of
- * {READ, WRITE}_ONCE. Rather than introducing in the common code, keep a
- * version here. We will have to drop it when the SMMU code in Linux will
- * switch to {READ, WRITE}_ONCE.
- */
-#define __ACCESS_ONCE(x) ({ \
-        __maybe_unused typeof(x) __var = 0; \
-       (volatile typeof(x) *)&(x); })
-#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x))
-
 #define MODULE_DEVICE_TABLE(type, name)
 #define module_param_named(name, value, type, perm)
 #define MODULE_PARM_DESC(_parm, desc)
index 1976e4be8dcbe6547643b64d33c7c53e3257123b..995a85a7db2dbcdf9e3778c0376ea161e3e39917 100644 (file)
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]) + __must_be_array(x))
 
-#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+#define __ACCESS_ONCE(x) ({                             \
+            (void)(typeof(x))0; /* Scalar typecheck. */ \
+            (volatile typeof(x) *)&(x); })
+#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x))
 
 #define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
 #define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))