drm/amd/powerplay: fix the confusing ppfeature mask calculations
authorEvan Quan <evan.quan@amd.com>
Tue, 19 Feb 2019 04:20:54 +0000 (12:20 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 22 Feb 2019 21:34:18 +0000 (16:34 -0500)
Simplify the ppfeature mask calculations.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c

index 5479125ff4f6e974ed2395c75d748b44b0af65be..6d8e9609e9006bf48f9eafc6a9a61b46aa48ac07 100644 (file)
@@ -4407,9 +4407,9 @@ static int vega10_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfe
                return ret;
 
        features_to_disable =
-               (features_enabled ^ new_ppfeature_masks) & features_enabled;
+               features_enabled & ~new_ppfeature_masks;
        features_to_enable =
-               (features_enabled ^ new_ppfeature_masks) ^ features_to_disable;
+               ~features_enabled & new_ppfeature_masks;
 
        pr_debug("features_to_disable 0x%llx\n", features_to_disable);
        pr_debug("features_to_enable 0x%llx\n", features_to_enable);
index 6c8e78611c033c20a381f492c7ad01cca764e150..bdb48e94eff6082e4cf16b958925075e8dfd7466 100644 (file)
@@ -2009,9 +2009,9 @@ static int vega12_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfe
                return ret;
 
        features_to_disable =
-               (features_enabled ^ new_ppfeature_masks) & features_enabled;
+               features_enabled & ~new_ppfeature_masks;
        features_to_enable =
-               (features_enabled ^ new_ppfeature_masks) ^ features_to_disable;
+               ~features_enabled & new_ppfeature_masks;
 
        pr_debug("features_to_disable 0x%llx\n", features_to_disable);
        pr_debug("features_to_enable 0x%llx\n", features_to_enable);
index c95e0f35ed7f6fe7adc96e80ac9bb882550e84e4..fae95d9ebd7a828fd5817f4fb411fd1e3edf2824 100644 (file)
@@ -3084,9 +3084,9 @@ static int vega20_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfe
                return ret;
 
        features_to_disable =
-               (features_enabled ^ new_ppfeature_masks) & features_enabled;
+               features_enabled & ~new_ppfeature_masks;
        features_to_enable =
-               (features_enabled ^ new_ppfeature_masks) ^ features_to_disable;
+               ~features_enabled & new_ppfeature_masks;
 
        pr_debug("features_to_disable 0x%llx\n", features_to_disable);
        pr_debug("features_to_enable 0x%llx\n", features_to_enable);