fix-huge-text-alloc-in-gta01.patch

From: Andy Green <[EMAIL PROTECTED]>

Werner spotted another giant array index issue in
mach-gta01.c, this fixes it removing 4MBytes of text allocation
from vmlinux that was previously wasted (>50% of the kernel image!)

ll arch/arm/boot/Image
Before: 7852880
After : 3658576

Signed-off-by: Andy Green <[EMAIL PROTECTED]>
---

 arch/arm/mach-s3c2410/mach-gta01.c |   27 ++++++++-------------------
 1 files changed, 8 insertions(+), 19 deletions(-)


diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c
index ed4dcbf..72fb985 100644
--- a/arch/arm/mach-s3c2410/mach-gta01.c
+++ b/arch/arm/mach-s3c2410/mach-gta01.c
@@ -383,25 +383,11 @@ static struct s3c2410_platform_nand gta01_nand_info = {
 	.sets		= gta01_nand_sets,
 };
 
-static unsigned int mmc_millivolts[] = {
-	[MMC_VDD_165_195]	= 1700,
-	[MMC_VDD_20_21]		= 2100,
-	[MMC_VDD_21_22]		= 2200,
-	[MMC_VDD_22_23]		= 2300,
-	[MMC_VDD_23_24]		= 2400,
-	[MMC_VDD_24_25]		= 2500,
-	[MMC_VDD_25_26]		= 2600,
-	[MMC_VDD_26_27]		= 2700,
-	[MMC_VDD_27_28]		= 2800,
-	[MMC_VDD_28_29]		= 2900,
-	[MMC_VDD_29_30]		= 3000,
-	[MMC_VDD_30_31]		= 3100,
-	[MMC_VDD_31_32]		= 3200,
-	[MMC_VDD_32_33]		= 3300,
-};
-
 static void gta01_mmc_set_power(unsigned char power_mode, unsigned short vdd)
 {
+	int bit;
+	int mv = 1700; /* 1.7V for MMC_VDD_165_195 */
+
 	printk(KERN_DEBUG "mmc_set_power(power_mode=%u, vdd=%u\n",
 	       power_mode, vdd);
 
@@ -413,9 +399,12 @@ static void gta01_mmc_set_power(unsigned char power_mode, unsigned short vdd)
 					   PCF50606_REGULATOR_D2REG, 0);
 			break;
 		case MMC_POWER_ON:
+			/* translate MMC_VDD_* VDD bit to mv */
+			for (bit = 7; bit != 24; bit++)
+				if (vdd == (1 << bit))
+					mv += 100 * (bit - 4);
 			pcf50606_voltage_set(pcf50606_global,
-					     PCF50606_REGULATOR_D2REG,
-					     mmc_millivolts[vdd]);
+					     PCF50606_REGULATOR_D2REG, mv);
 			pcf50606_onoff_set(pcf50606_global,
 					   PCF50606_REGULATOR_D2REG, 1);
 			break;

Reply via email to