CONFIG_MTD_ROM and suspend-to-RAM

Uwe Kleine-König Uwe.Kleine-Koenig at digi.com
Tue Jul 15 09:03:16 EDT 2008


Hello,

I have a machine with a CFI flash using the physmap-flash mapping
driver.

The problem after the failed detection (as reported earlier on the
list[1]) is that if my kernel has CONFIG_MTD_ROM map_rom_probe() is
called, which doesn't assign mtd->suspend and returns success.

Then when I do

	echo mem > /sys/power/state

physmap_flash_suspend is called which does:

	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
		ret |= info->mtd[i]->suspend(info->mtd[i]);

	return ret;

Unsurprisingly this results in an Oops.

IMHO both functions should behave better.  map_rom_probe should do some
probing (not sure this is possible though) and physmap_flash_suspend
should only call suspend if it's non-NULL.  Moreover
physmap_flash_suspend mangles the return value.  I would prefer to break
the loop after the first failure (and probably resume the already
suspended parts).  Moreover IIRC resume isn't called if suspend failed,
so there might be some chips that stay suspended after a failing
suspend.

I will come up with a patch addressing the physmap problems, but I don't
know map_rom and don't have a chip for that, so I will leave that to
someone else.

Best regards
Uwe

[1] http://thread.gmane.org/gmane.linux.drivers.mtd/22209

-- 
Uwe Kleine-König, Software Engineer
Digi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany
Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962



More information about the linux-mtd mailing list