drm/amdgpu: Use max macro in *get_sleep_divider_id_from_clock
authorNils Wallménius <nils.wallmenius@gmail.com>
Thu, 5 May 2016 07:07:46 +0000 (09:07 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 11 May 2016 16:31:23 +0000 (12:31 -0400)
Signed-off-by: Nils Wallménius <nils.wallmenius@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/ci_dpm.c
drivers/gpu/drm/amd/amdgpu/kv_dpm.c
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c

index 2f247975fdd6c462c4b7298a4fd4c4272aec7123..4d50c43c0939904f2155a1fed9a4f45aec745e4a 100644 (file)
@@ -2554,8 +2554,7 @@ static u8 ci_get_sleep_divider_id_from_clock(struct amdgpu_device *adev,
 {
        u32 i;
        u32 tmp;
-       u32 min = (min_sclk_in_sr > CISLAND_MINIMUM_ENGINE_CLOCK) ?
-               min_sclk_in_sr : CISLAND_MINIMUM_ENGINE_CLOCK;
+       u32 min = max(min_sclk_in_sr, (u32)CISLAND_MINIMUM_ENGINE_CLOCK);
 
        if (sclk < min)
                return 0;
index 4bd1e551cccd8eea70bc389f58a9f92fa519f513..4bc107a4546e6e50fa35c9588c75831a47af6e59 100644 (file)
@@ -2176,8 +2176,7 @@ static u8 kv_get_sleep_divider_id_from_clock(struct amdgpu_device *adev,
        struct kv_power_info *pi = kv_get_pi(adev);
        u32 i;
        u32 temp;
-       u32 min = (min_sclk_in_sr > KV_MINIMUM_ENGINE_CLOCK) ?
-               min_sclk_in_sr : KV_MINIMUM_ENGINE_CLOCK;
+       u32 min = max(min_sclk_in_sr, (u32)KV_MINIMUM_ENGINE_CLOCK);
 
        if (sclk < min)
                return 0;
index c574afd5e12b14be833a0c98bda89db554a7a423..9847e20860bc49984d3a335cb69af01fa63d3732 100644 (file)
@@ -1903,8 +1903,7 @@ static uint8_t fiji_get_sleep_divider_id_from_clock(struct pp_hwmgr *hwmgr,
 {
        uint8_t i;
        uint32_t temp;
-       uint32_t min = clock_insr > FIJI_MINIMUM_ENGINE_CLOCK ?
-                       clock_insr : FIJI_MINIMUM_ENGINE_CLOCK;
+       uint32_t min = max(clock_insr, (uint32_t)FIJI_MINIMUM_ENGINE_CLOCK);
 
        PP_ASSERT_WITH_CODE((clock >= min), "Engine clock can't satisfy stutter requirement!", return 0);
        for (i = FIJI_MAX_DEEPSLEEP_DIVIDER_ID;  ; i--) {
index d79af48ca9a5d53053333c45edd547d646db188d..8969f1ef1de5687b5e48f651ca7acf527874f001 100644 (file)
@@ -2420,8 +2420,7 @@ static uint8_t tonga_get_sleep_divider_id_from_clock(struct pp_hwmgr *hwmgr,
                uint32_t engine_clock, uint32_t min_engine_clock_in_sr)
 {
        uint32_t i, temp;
-       uint32_t min = (min_engine_clock_in_sr > TONGA_MINIMUM_ENGINE_CLOCK) ?
-                       min_engine_clock_in_sr : TONGA_MINIMUM_ENGINE_CLOCK;
+       uint32_t min = max(min_engine_clock_in_sr, (uint32_t)TONGA_MINIMUM_ENGINE_CLOCK);
 
        PP_ASSERT_WITH_CODE((engine_clock >= min),
                        "Engine clock can't satisfy stutter requirement!", return 0);