[PATCH next 04/14] media: atomisp: Use static_assert() for sanity check

david.laight.linux@gmail.com posted 14 patches 2 weeks, 3 days ago
[PATCH next 04/14] media: atomisp: Use static_assert() for sanity check
Posted by david.laight.linux@gmail.com 2 weeks, 3 days ago
From: David Laight <david.laight.linux@gmail.com>

Compile-time tests being added to BIT() make it an 'integer constant
expression' rather than a pre-processor expression for W=1 builds.

Change the FRAC_ACC != BDS_UNIT test to use static_assert() so the code
compiles.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
---
 .../kernels/fixedbds/fixedbds_1.0/ia_css_fixedbds_param.h    | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/fixedbds/fixedbds_1.0/ia_css_fixedbds_param.h b/drivers/staging/media/atomisp/pci/isp/kernels/fixedbds/fixedbds_1.0/ia_css_fixedbds_param.h
index f7e5669d5125..31bce7b2650e 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/fixedbds/fixedbds_1.0/ia_css_fixedbds_param.h
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/fixedbds/fixedbds_1.0/ia_css_fixedbds_param.h
@@ -13,9 +13,8 @@
 #define BDS_UNIT 8
 #define FRAC_LOG 3
 #define FRAC_ACC BIT(FRAC_LOG)
-#if FRAC_ACC != BDS_UNIT
-#error "FRAC_ACC and BDS_UNIT need to be merged into one define"
-#endif
+static_assert(FRAC_ACC == BDS_UNIT,
+	"FRAC_ACC and BDS_UNIT need to be merged into one define");
 
 struct sh_css_isp_bds_params {
 	int baf_strength;
-- 
2.39.5