Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 235228ba authored by Enric Balletbo i Serra's avatar Enric Balletbo i Serra Committed by Tony Lindgren
Browse files

omap3: IGEP v2: Improve igep2_flash_init() function



The changes are:
  - Use 'for' loop instead 'while' loop.
  - No need to initialize ret to 0, we're assigning it right after.
  - No need to check for onenandcs < GPMC_CS_NUM here, it will always be true.

Signed-off-by: default avatarEnric Balletbo i Serra <eballetbo@gmail.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent ae3e0333
Loading
Loading
Loading
Loading
+11 −12
Original line number Original line Diff line number Diff line
@@ -155,32 +155,31 @@ static void __init igep2_flash_init(void)
	u8 cs = 0;
	u8 cs = 0;
	u8 onenandcs = GPMC_CS_NUM + 1;
	u8 onenandcs = GPMC_CS_NUM + 1;


	while (cs < GPMC_CS_NUM) {
	for (cs = 0; cs < GPMC_CS_NUM; cs++) {
		u32 ret = 0;
		u32 ret;
		ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
		ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);


		/* Check if NAND/oneNAND is configured */
		/* Check if NAND/oneNAND is configured */
		if ((ret & 0xC00) == 0x800)
		if ((ret & 0xC00) == 0x800)
			/* NAND found */
			/* NAND found */
			pr_err("IGEP v2: Unsupported NAND found\n");
			pr_err("IGEP2: Unsupported NAND found\n");
		else {
		else {
			ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
			ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
			if ((ret & 0x3F) == (ONENAND_MAP >> 24))
			if ((ret & 0x3F) == (ONENAND_MAP >> 24))
				/* ONENAND found */
				/* ONENAND found */
				onenandcs = cs;
				onenandcs = cs;
		}
		}
		cs++;
	}
	}

	if (onenandcs > GPMC_CS_NUM) {
	if (onenandcs > GPMC_CS_NUM) {
		pr_err("IGEP v2: Unable to find configuration in GPMC\n");
		pr_err("IGEP2: Unable to find configuration in GPMC\n");
		return;
		return;
	}
	}


	if (onenandcs < GPMC_CS_NUM) {
	igep2_onenand_data.cs = onenandcs;
	igep2_onenand_data.cs = onenandcs;

	if (platform_device_register(&igep2_onenand_device) < 0)
	if (platform_device_register(&igep2_onenand_device) < 0)
			pr_err("IGEP v2: Unable to register OneNAND device\n");
		pr_err("IGEP2: Unable to register OneNAND device\n");
	}
}
}


#else
#else