From: Dave Airlie Date: Fri, 29 Sep 2017 17:13:31 +1000 Subject: amdgpu/dc: inline dml_round_to_multiple Git-commit: 299f27fd370f34cb6e22e2ffb84b61e91dd6a4c1 Patch-mainline: v4.15-rc1 References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166 turns out to be a win to inline this. Signed-off-by: Dave Airlie Reviewed-by: Harry Wentland Signed-off-by: Alex Deucher Acked-by: Petr Tesarik --- drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c | 19 ------------------- drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h | 2 -- drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 21 deletions(-) --- a/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c @@ -40,23 +40,4 @@ double dml_round(double a) return floor; } -unsigned int dml_round_to_multiple( - unsigned int num, - unsigned int multiple, - bool up) -{ - unsigned int remainder; - if (multiple == 0) - return num; - - remainder = num % multiple; - - if (remainder == 0) - return num; - - if (up) - return (num + multiple - remainder); - else - return (num - remainder); -} --- a/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h +++ b/drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h @@ -35,7 +35,5 @@ #define DTRACE(str, ...) {dm_logger_write(mode_lib->logger, LOG_DML, str, ##__VA_ARGS__); } double dml_round(double a); -unsigned int dml_round_to_multiple( - unsigned int num, unsigned int multiple, bool up); #endif /* __DC_COMMON_DEFS_H__ */ --- a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h +++ b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h @@ -99,4 +99,23 @@ static inline double dml_log(double x, d return (double) dcn_bw_log(x, base); } +static inline unsigned int dml_round_to_multiple(unsigned int num, + unsigned int multiple, + bool up) +{ + unsigned int remainder; + + if (multiple == 0) + return num; + + remainder = num % multiple; + + if (remainder == 0) + return num; + + if (up) + return (num + multiple - remainder); + else + return (num - remainder); +} #endif