mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Restoring back the system state from MMC after a successful hibernation
@ 2009-07-21 14:05 A, Raghu
  2009-07-21 18:55 ` Matt Fleming
  0 siblings, 1 reply; 2+ messages in thread
From: A, Raghu @ 2009-07-21 14:05 UTC (permalink / raw)
  To: pierre, dbrownell; +Cc: linux-kernel, Dasgupta, Romit

Hi, 

I am trying a hibernate-restore procedure on my system, wherein I store the context image on a swap partition on a MMC device (/dev/mmcblk0). The hibernation process happens smoothly. However, when I try to restore back, after including "resume = /dev/mmcblk0" in the bootargs, I find that the MMC card does not get detected by the time late_initcall(software_resume) is called, as a result of which the restore does not happen.

To resolve the problem, I have included a mmc_flush_scheduled_work() call immediately after the mmc_detect_change(host, 0) call in mmc_start_host(struct mmc_host *host) function defined in linux/drivers/mmc/core/core.c, so that instead of mmc_rescan happening sometime later, it now happens right away, and the MMC card gets detected at the end of the host's .probe() callback itself.

/*****

void mmc_start_host(struct mmc_host *host)

{
        mmc_power_off(host);
        mmc_detect_change(host, 0);
        mmc_flush_scheduled_work();
}

The host's probe() routine calls mmc_add_host , which in turn calls mmc_start_host.

*****/

Is this approach correct? Or is there any other way I can get the MMC card detected before late_initcall(software_resume) happens?

Kindly CC the reply to me as I am not a part of the linux kernel mailing list.

Thanks and Regards
Raghu A.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Restoring back the system state from MMC after a successful hibernation
  2009-07-21 14:05 Restoring back the system state from MMC after a successful hibernation A, Raghu
@ 2009-07-21 18:55 ` Matt Fleming
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Fleming @ 2009-07-21 18:55 UTC (permalink / raw)
  To: A, Raghu; +Cc: pierre, dbrownell, linux-kernel, Dasgupta, Romit

On Tue, Jul 21, 2009 at 07:35:55PM +0530, A, Raghu wrote:
> Hi, 
> 
> I am trying a hibernate-restore procedure on my system, wherein I store the context image on a swap partition on a MMC device (/dev/mmcblk0). The hibernation process happens smoothly. However, when I try to restore back, after including "resume = /dev/mmcblk0" in the bootargs, I find that the MMC card does not get detected by the time late_initcall(software_resume) is called, as a result of which the restore does not happen.
> 
> To resolve the problem, I have included a mmc_flush_scheduled_work() call immediately after the mmc_detect_change(host, 0) call in mmc_start_host(struct mmc_host *host) function defined in linux/drivers/mmc/core/core.c, so that instead of mmc_rescan happening sometime later, it now happens right away, and the MMC card gets detected at the end of the host's .probe() callback itself.
> 
> /*****
> 
> void mmc_start_host(struct mmc_host *host)
> 
> {
>         mmc_power_off(host);
>         mmc_detect_change(host, 0);
>         mmc_flush_scheduled_work();
> }
> 
> The host's probe() routine calls mmc_add_host , which in turn calls mmc_start_host.
> 
> *****/
> 
> Is this approach correct? Or is there any other way I can get the MMC card detected before late_initcall(software_resume) happens?
> 

I think this is a good idea. Based on the comment for mmc_add_host(), by
the time we've exited mmc_add_host() the host should be ready to start
servicing requests, so mmc_start_host() really needs to have the
detected the card by the time it returns.

Perhaps it would be a good idea for mmc_detect_change() to grow another
argument that allows the detection to be synchronous?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-21 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-21 14:05 Restoring back the system state from MMC after a successful hibernation A, Raghu
2009-07-21 18:55 ` Matt Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®