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

Submitted by Harry Wentland on Nov. 24, 2016, 2:02 a.m.

Details

Message ID 20161124020308.28124-9-harry.wentland@amd.com
State New
Headers show
Series "dal patches for nov 23, 2016" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Harry Wentland Nov. 24, 2016, 2:02 a.m.
From: Tony Cheng <tony.cheng@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@amd.com>
Acked-by: Harry Wentland <harry.wentland@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(-)

Patch hide | download patch | download mbox

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