amdgpu/dc: inline dml_round_to_multiple
authorDave Airlie <airlied@redhat.com>
Fri, 29 Sep 2017 07:13:31 +0000 (17:13 +1000)
committerAlex Deucher <alexander.deucher@amd.com>
Sat, 21 Oct 2017 20:53:03 +0000 (16:53 -0400)
turns out to be a win to inline this.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.c
drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.h
drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h

index 1683514ed0e37557b059ae06b4e0985c8965a914..b953b02a151214b5adcb945c38dcd911944109ad 100644 (file)
@@ -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);
-}
index e11d123ab8d9ce232c613c7e31c12c0feabfdbbb..b2847bc469fedfd892c3e17823000c8a709ce78e 100644 (file)
@@ -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__ */
index 105c6721f9011f536555ae6d2dffd7b23c447c9d..e68086b8a22fe3561204181dda8affaf394acf6d 100644 (file)
@@ -99,4 +99,23 @@ static inline double dml_log(double x, double base)
        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