[PATCH 1/1] drivers/gpu/drm/radeon/ci_dpm.c: replace shift loop by ilog2
From: Fabian Frederick
Date: Tue May 20 2014 - 12:29:25 EST
Cc: Alex Deucher <alexander.deucher@xxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
---
drivers/gpu/drm/radeon/ci_dpm.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 10dae41..e4abf9e 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -3725,10 +3725,8 @@ int ci_dpm_force_performance_level(struct radeon_device *rdev,
if (level == RADEON_DPM_FORCED_LEVEL_HIGH) {
if ((!pi->sclk_dpm_key_disabled) &&
pi->dpm_level_enable_mask.sclk_dpm_enable_mask) {
- levels = 0;
tmp = pi->dpm_level_enable_mask.sclk_dpm_enable_mask;
- while (tmp >>= 1)
- levels++;
+ levels = ilog2(tmp);
if (levels) {
ret = ci_dpm_force_state_sclk(rdev, levels);
if (ret)
@@ -3744,10 +3742,8 @@ int ci_dpm_force_performance_level(struct radeon_device *rdev,
}
if ((!pi->mclk_dpm_key_disabled) &&
pi->dpm_level_enable_mask.mclk_dpm_enable_mask) {
- levels = 0;
tmp = pi->dpm_level_enable_mask.mclk_dpm_enable_mask;
- while (tmp >>= 1)
- levels++;
+ levels = ilog2(tmp);
if (levels) {
ret = ci_dpm_force_state_mclk(rdev, levels);
if (ret)
@@ -3763,10 +3759,8 @@ int ci_dpm_force_performance_level(struct radeon_device *rdev,
}
if ((!pi->pcie_dpm_key_disabled) &&
pi->dpm_level_enable_mask.pcie_dpm_enable_mask) {
- levels = 0;
tmp = pi->dpm_level_enable_mask.pcie_dpm_enable_mask;
- while (tmp >>= 1)
- levels++;
+ levels = ilog2(tmp);
if (levels) {
ret = ci_dpm_force_state_pcie(rdev, level);
if (ret)
--
1.8.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/