patch-2.1.126 linux/drivers/sound/gus_wave.c

Next file: linux/drivers/sound/legacy.h
Previous file: linux/drivers/sound/es1370.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.125/linux/drivers/sound/gus_wave.c linux/drivers/sound/gus_wave.c
@@ -863,7 +863,7 @@
 
 	int bank, chunk, addr, total = 0;
 	int bank_sizes[4];
-	int i, j, bits = -1, nbanks = 0;
+	int i, j, bits = -1, testbits = -1, nbanks = 0;
 
 	/*
 	 * This routine determines what kind of RAM is installed in each of the four
@@ -974,28 +974,26 @@
 		}
 	}
 	/*
-	 * The last resort is to search for a combination where the last bank is
-	 * smaller than the actual SIMM. This leaves some memory in the last bank
-	 * unused but doesn't leave holes in the DRAM address space.
-	 */
-	if (bits == -1)		/* No luck yet */
-	{
-		for (i = 0; bits == -1 && i < 13; i++)
-		{
-			bits = i;
-
-			for (j = 0; bits != -1 && j < nbanks - 1; j++)
-				if (mem_decode[i][j] != bank_sizes[j])
-					bits = -1;	/* No hit */
-		}
-		if (bits != -1)
-		{
+ 	 * The last resort is to search for a combination where the banks are
+ 	 * smaller than the actual SIMMs. This leaves some memory in the banks
+ 	 * unused but doesn't leave holes in the DRAM address space.
+ 	 */
+ 	if (bits == -1)		/* No luck yet */
+ 	{
+ 		for (i = 0; i < 13; i++)
+ 		{
+ 			testbits = i;
+ 			for (j = 0; testbits != -1 && j < nbanks - 1; j++)
+ 				if (mem_decode[i][j] > bank_sizes[j]) {
+ 					testbits = -1;
+ 				}
+ 			if(testbits > bits) bits = testbits;
+ 		}
+ 		if (bits != -1)
+ 		{
 			printk(KERN_INFO "Interwave: Can't use all installed RAM.\n");
 			printk(KERN_INFO "Interwave: Try reordering SIMMS.\n");
 		}
-	}
-	if (bits == -1)
-	{
 		printk(KERN_INFO "Interwave: Can't find working DRAM encoding.\n");
 		printk(KERN_INFO "Interwave: Defaulting to 256k. Try reordering SIMMS.\n");
 		bits = 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov