[PATCH 1/1] drivers/video/fbdev/nvidia/nv_hw.c: replace shift loop by ilog2

From: Fabian Frederick
Date: Tue May 20 2014 - 12:40:59 EST


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

Cc: Jean-Christophe Plagniol-Villard <plagnioj@xxxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/