From: Gaghik Khachatrian Date: Sun, 19 Apr 2026 20:55:50 +0000 (-0400) Subject: drm/amd/display: Do DML float narrowing explicit X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b20934b82424caba974a146a9d7308172c374524;p=thirdparty%2Fkernel%2Flinux.git drm/amd/display: Do DML float narrowing explicit [Why] Shared DML wrapper helpers in [dc/dml/dml_inline_defs.h](dc/dml/dml_inline_defs.h) pass double and int values to float-based dcn_bw_* helpers. Make these intentional narrowing boundaries explicit to reduce warning noise without changing behavior. [How] Add explicit C-style casts at the float API boundary in the shared DML inline wrappers used by the DCN DML paths. Reviewed-by: Dillon Varone Signed-off-by: Gaghik Khachatrian Signed-off-by: James Lin Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h index 6b2ab4ec2b5ff..be6ebf53d9a2b 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h +++ b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h @@ -31,7 +31,7 @@ static inline double dml_min(double a, double b) { - return (double) dcn_bw_min2(a, b); + return (double)dcn_bw_min2((float)a, (float)b); } static inline double dml_min3(double a, double b, double c) @@ -46,7 +46,7 @@ static inline double dml_min4(double a, double b, double c, double d) static inline double dml_max(double a, double b) { - return (double) dcn_bw_max2(a, b); + return (double)dcn_bw_max2((float)a, (float)b); } static inline double dml_max3(double a, double b, double c) @@ -68,14 +68,14 @@ static inline double dml_ceil(double a, double granularity) { if (granularity == 0) return 0; - return (double) dcn_bw_ceil2(a, granularity); + return (double)dcn_bw_ceil2((float)a, (float)granularity); } static inline double dml_floor(double a, double granularity) { if (granularity == 0) return 0; - return (double) dcn_bw_floor2(a, granularity); + return (double)dcn_bw_floor2((float)a, (float)granularity); } static inline double dml_round(double a) @@ -103,31 +103,31 @@ static inline int dml_log2(double x) static inline double dml_pow(double a, int exp) { - return (double) dcn_bw_pow(a, exp); + return (double)dcn_bw_pow((float)a, (float)exp); } static inline double dml_fmod(double f, int val) { - return (double) dcn_bw_mod(f, val); + return (double)dcn_bw_mod((float)f, (float)val); } static inline double dml_ceil_2(double f) { - return (double) dcn_bw_ceil2(f, 2); + return (double)dcn_bw_ceil2((float)f, 2.0f); } static inline double dml_ceil_ex(double x, double granularity) { if (granularity == 0) return 0; - return (double) dcn_bw_ceil2(x, granularity); + return (double)dcn_bw_ceil2((float)x, (float)granularity); } static inline double dml_floor_ex(double x, double granularity) { if (granularity == 0) return 0; - return (double) dcn_bw_floor2(x, granularity); + return (double)dcn_bw_floor2((float)x, (float)granularity); } static inline unsigned int dml_round_to_multiple(unsigned int num,