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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20140520184044.3f637e58aa8d67a062c621d5@skynet.be>
Date:	Tue, 20 May 2014 18:40:44 +0200
From:	Fabian Frederick <fabf@...net.be>
To:	linux-kernel <linux-kernel@...r.kernel.org>
Cc:	Jean-Christophe Plagniol-Villard <plagnioj@...osoft.com>,
	akpm <akpm@...ux-foundation.org>
Subject: [PATCH 1/1] drivers/video/fbdev/nvidia/nv_hw.c: replace shift loop
 by ilog2

This patch also fixes function nv30UpdateArbitrationSettings
which was completely written with spaces at start of lines.

Cc: Jean-Christophe Plagniol-Villard <plagnioj@...osoft.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@...net.be>
---
 drivers/video/fbdev/nvidia/nv_hw.c | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/drivers/video/fbdev/nvidia/nv_hw.c b/drivers/video/fbdev/nvidia/nv_hw.c
index 81c80ac..2058c52 100644
--- a/drivers/video/fbdev/nvidia/nv_hw.c
+++ b/drivers/video/fbdev/nvidia/nv_hw.c
@@ -405,9 +405,7 @@ static void nv4UpdateArbitrationSettings(unsigned VClk,
 	nv4CalcArbitration(&fifo_data, &sim_data);
 	if (fifo_data.valid) {
 		int b = fifo_data.graphics_burst_size >> 4;
-		*burst = 0;
-		while (b >>= 1)
-			(*burst)++;
+		*burst = ilog2(b);
 		*lwm = fifo_data.graphics_lwm >> 3;
 	}
 }
@@ -645,9 +643,7 @@ static void nv10UpdateArbitrationSettings(unsigned VClk,
 	nv10CalcArbitration(&fifo_data, &sim_data);
 	if (fifo_data.valid) {
 		int b = fifo_data.graphics_burst_size >> 4;
-		*burst = 0;
-		while (b >>= 1)
-			(*burst)++;
+		*burst = ilog2(b);
 		*lwm = fifo_data.graphics_lwm >> 3;
 	}
 }
@@ -658,19 +654,18 @@ static void nv30UpdateArbitrationSettings (
     unsigned int      *lwm
 )
 {
-    unsigned int MClk, NVClk;
-    unsigned int fifo_size, burst_size, graphics_lwm;
+	unsigned int MClk, NVClk;
+	unsigned int fifo_size, burst_size, graphics_lwm;
 
-    fifo_size = 2048;
-    burst_size = 512;
-    graphics_lwm = fifo_size - burst_size;
+	fifo_size = 2048;
+	burst_size = 512;
+	graphics_lwm = fifo_size - burst_size;
 
-    nvGetClocks(par, &MClk, &NVClk);
+	nvGetClocks(par, &MClk, &NVClk);
 
-    *burst = 0;
-    burst_size >>= 5;
-    while(burst_size >>= 1) (*burst)++;
-    *lwm = graphics_lwm >> 3;
+	burst_size >>= 5;
+	*burst = ilog2(burst_size);
+	*lwm = graphics_lwm >> 3;
 }
 
 static void nForceUpdateArbitrationSettings(unsigned VClk,
@@ -746,9 +741,7 @@ static void nForceUpdateArbitrationSettings(unsigned VClk,
 	nv10CalcArbitration(&fifo_data, &sim_data);
 	if (fifo_data.valid) {
 		int b = fifo_data.graphics_burst_size >> 4;
-		*burst = 0;
-		while (b >>= 1)
-			(*burst)++;
+		*burst = ilog2(b);
 		*lwm = fifo_data.graphics_lwm >> 3;
 	}
 }
-- 
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