public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] staging/xgifb: Replace XGI340_CR6B table with simple if/else
@ 2013-02-04 23:29 Peter Huewe
  2013-02-04 23:29 ` [PATCH 2/5] staging/xgifb: Move duplicated code for dram to helper function Peter Huewe
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Peter Huewe @ 2013-02-04 23:29 UTC (permalink / raw)
  To: Arnaud Patard
  Cc: Greg Kroah-Hartman, Miguel Gómez, Aaro Koskinen, Peter Huewe,
	Sam Hansen, devel, linux-kernel

The XGI340_CR6B lookup table consists of the entries
{0xaa, 0xaa, 0xaa, 0xaa} for an index <= 2 and
{0x00, 0x00, 0x00, 0x00} for all other indices.

The only user XGINew_SetDRAMDefaultRegister340 loops over these 4 values
of a line with a for loop and since all entries are the same for each line
we can simply replace the whole lookup table with a simple if/else assignment.

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/xgifb/vb_init.c  |    2 +-
 drivers/staging/xgifb/vb_table.h |   11 -----------
 2 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index dd34570..a778df6 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -429,7 +429,7 @@ static void XGINew_SetDRAMDefaultRegister340(
 	temp2 = 0;
 	for (i = 0; i < 4; i++) {
 		/* CR6B DQS fine tune delay */
-		temp = XGI340_CR6B[pVBInfo->ram_type][i];
+		temp = (pVBInfo->ram_type <= 2) ? 0xaa : 0x00;
 		for (j = 0; j < 4; j++) {
 			temp1 = ((temp >> (2 * j)) & 0x03) << 2;
 			temp2 |= temp1;
diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h
index fca1a1d..34e1656 100644
--- a/drivers/staging/xgifb/vb_table.h
+++ b/drivers/staging/xgifb/vb_table.h
@@ -103,17 +103,6 @@ static const unsigned char XGI27_cr41[24][8] = {
 	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}  /* 23 CRC5 */
 };
 
-const unsigned char XGI340_CR6B[8][4] = {
-	{0xaa, 0xaa, 0xaa, 0xaa},
-	{0xaa, 0xaa, 0xaa, 0xaa},
-	{0xaa, 0xaa, 0xaa, 0xaa},
-	{0x00, 0x00, 0x00, 0x00},
-	{0x00, 0x00, 0x00, 0x00},
-	{0x00, 0x00, 0x00, 0x00},
-	{0x00, 0x00, 0x00, 0x00},
-	{0x00, 0x00, 0x00, 0x00}
-};
-
 /* CR47,CR48,CR49,CR4A,CR4B,CR4C,CR70,CR71,CR74,CR75,CR76,CR77 */
 const unsigned char XGI340_AGPReg[12] = {
 	0x28, 0x23, 0x00, 0x20, 0x00, 0x20,
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-02-05 19:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-04 23:29 [PATCH 1/5] staging/xgifb: Replace XGI340_CR6B table with simple if/else Peter Huewe
2013-02-04 23:29 ` [PATCH 2/5] staging/xgifb: Move duplicated code for dram to helper function Peter Huewe
2013-02-04 23:29 ` [PATCH 3/5] staging/xgifb: Don't write the same values x times Peter Huewe
2013-02-04 23:29 ` [PATCH 4/5] staging/xgifb: Consolidate if/else for 'identical' branches Peter Huewe
2013-02-04 23:29 ` [PATCH 5/5] staging/xgifb: Consolidate if branches with similar conditions Peter Huewe
2013-02-05 19:18 ` [PATCH 1/5] staging/xgifb: Replace XGI340_CR6B table with simple if/else Greg Kroah-Hartman
2013-02-05 19:38   ` [PATCH] staging/xgifb: Remove unused variable Peter Huewe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox