lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20140520182918.0259b9804a1b01693cb2b287@skynet.be>
Date:	Tue, 20 May 2014 18:29:18 +0200
From:	Fabian Frederick <fabf@...net.be>
To:	linux-kernel <linux-kernel@...r.kernel.org>
Cc:	akpm <akpm@...ux-foundation.org>,
	Alex Deucher <alexander.deucher@....com>
Subject: [PATCH 1/1]  drivers/gpu/drm/radeon/ci_dpm.c: replace shift loop by
 ilog2


Cc: Alex Deucher <alexander.deucher@....com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@...net.be>
---
 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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ