[PATCH 08/39] drm/amd/dal: improve compiler catching bug in REG_SET

Harry Wentland harry.wentland at amd.com
Thu Nov 24 02:02:37 UTC 2016


From: Tony Cheng <tony.cheng at amd.com>

- first field is explicitly passed instead of pass by VA_ARG to catch type mismatch
- fix REG_SET bug in dce_hwseq

Change-Id: I0f0b316e1d1ea1c42c0d3ffbc406db1b5e6cd3c3
Signed-off-by: Tony Cheng <tony.cheng at amd.com>
Acked-by: Harry Wentland <harry.wentland at amd.com>
---
 drivers/gpu/drm/amd/dal/dc/dc_helper.c   | 10 +++++++---
 drivers/gpu/drm/amd/dal/dc/dm_services.h |  3 ++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/dc_helper.c b/drivers/gpu/drm/amd/dal/dc/dc_helper.c
index b3f7d40673e8..96724ba17e4b 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc_helper.c
+++ b/drivers/gpu/drm/amd/dal/dc/dc_helper.c
@@ -8,13 +8,17 @@
 #include <stdarg.h>
 
 uint32_t generic_reg_update_ex(const struct dc_context *ctx,
-		uint32_t addr, uint32_t reg_val, int n, ...)
+		uint32_t addr, uint32_t reg_val, int n,
+		uint8_t shift1, uint32_t mask1, uint32_t field_value1,
+		...)
 {
 	uint32_t shift, mask, field_value;
-	int i = 0;
+	int i = 1;
 
 	va_list ap;
-	va_start(ap, n);
+	va_start(ap, field_value1);
+
+	reg_val = set_reg_field_value_ex(reg_val, field_value1, mask1, shift1);
 
 	while (i < n) {
 		shift = va_arg(ap, uint32_t);
diff --git a/drivers/gpu/drm/amd/dal/dc/dm_services.h b/drivers/gpu/drm/amd/dal/dc/dm_services.h
index 6385ed48ad36..289264403983 100644
--- a/drivers/gpu/drm/amd/dal/dc/dm_services.h
+++ b/drivers/gpu/drm/amd/dal/dc/dm_services.h
@@ -190,7 +190,8 @@ static inline uint32_t set_reg_field_value_ex(
 		reg_name ## __ ## reg_field ## __SHIFT)
 
 uint32_t generic_reg_update_ex(const struct dc_context *ctx,
-		uint32_t addr, uint32_t reg_val, int n, ...);
+		uint32_t addr, uint32_t reg_val, int n,
+		uint8_t shift1, uint32_t mask1, uint32_t field_value1, ...);
 
 #define FD(reg_field)	reg_field ## __SHIFT, \
 						reg_field ## _MASK
-- 
2.10.1



More information about the amd-gfx mailing list