r1690

stsp at dslinux.in-berlin.de stsp at dslinux.in-berlin.de
Sat Feb 10 14:06:25 CET 2007


Author: stsp
Date: 2007-02-10 14:06:20 +0100 (Sat, 10 Feb 2007)
New Revision: 1690

Log:
<pepsiman> stsp: do you agree with my code review?
<stsp> the default case that does nothing?
<pepsiman> yep
<pepsiman> it's going to fail silently
<stsp> ah
<stsp> make it panic() :)
<pepsiman> arm7 can't panic
<stsp> ok I see now where the problem is...
<stsp> I don't know which case should be default
<stsp> the code is just numbers :(
<pepsiman> default should be != 3


Modified: trunk/linux-2.6.x/arch/arm/mach-nds/arm7/wifi.c
===================================================================
--- trunk/linux-2.6.x/arch/arm/mach-nds/arm7/wifi.c	2007-02-10 10:49:56 UTC (rev 1689)
+++ trunk/linux-2.6.x/arch/arm/mach-nds/arm7/wifi.c	2007-02-10 13:06:20 UTC (rev 1690)
@@ -268,29 +268,23 @@
 	if (!(wifi_data.state & WIFI_STATE_UP))
 		return;
 
-	switch(ReadFlashByte(0x40)) {
-		case 2:
-		case 5:
-			Wifi_RFWrite(ReadFlashBytes(0xf2 + channel * 6, 3));
-			Wifi_RFWrite(ReadFlashBytes(0xf5 + channel * 6, 3));
-			for (i = 0; i < 20000; i++)
-				i++;
-			Wifi_BBWrite(0x1E, ReadFlashByte(0x146 + channel));
-			break;
-		case 3:
-			n=ReadFlashByte(0x42);
-			n+=0xCF;
-			for(i=0;i<=ReadFlashByte(0x43);i++) {
-				Wifi_BBWrite(ReadFlashByte(n),ReadFlashByte(n+channel+1));
-				n+=15;
-			}
-			for(i=0;i<ReadFlashByte(0x43);i++) {
-				Wifi_RFWrite( (ReadFlashByte(n)<<8) | ReadFlashByte(n+channel+1) | 0x050000 );
-				n+=15;
-			}
-			break;
-		default:
-			break;
+	if (ReadFlashByte(0x40) == 3) {
+		n=ReadFlashByte(0x42);
+		n+=0xCF;
+		for(i=0;i<=ReadFlashByte(0x43);i++) {
+			Wifi_BBWrite(ReadFlashByte(n),ReadFlashByte(n+channel+1));
+			n+=15;
+		}
+		for(i=0;i<ReadFlashByte(0x43);i++) {
+			Wifi_RFWrite( (ReadFlashByte(n)<<8) | ReadFlashByte(n+channel+1) | 0x050000 );
+			n+=15;
+		}
+	} else {
+		Wifi_RFWrite(ReadFlashBytes(0xf2 + channel * 6, 3));
+		Wifi_RFWrite(ReadFlashBytes(0xf5 + channel * 6, 3));
+		for (i = 0; i < 20000; i++)
+			i++;
+		Wifi_BBWrite(0x1E, ReadFlashByte(0x146 + channel));
 	}
 }
 




More information about the dslinux-commit mailing list