Re: Bugs in MMC [was: [Bug 10030] Suspend doesn't work when SD card is inserted]

David Brownell
2008-03-03T21:59:50Z

On Monday 25 February 2008, Pierre Ossman wrote:
> On Sun, 24 Feb 2008 10:33:34 -0500 (EST)
> Alan Stern <stern@rowland.harvard.edu> wrote:
>
> > But even changing that won't solve the second issue, which is a genuine
> > bug. There is a race between detect events and suspend events. The
> > mmc_suspend_host() routine starts out by flushing the kmmcd workqueue
> > before calling the host's suspend routine. So what happens if another
> > detect event occurs in between?
> >
>
> The idea is that host drivers shouldn't do that. Once they've called
> mmc_suspend_host(), then they shouldn't be poking the MMC core in any
> other way. None of this is of course properly documented. :/

Card insert/remove events can be system wake events though. Which
makes that restriction impractical.

I think hosts need to be able to call mmc_detect_change() as soon as
they see a stable signal. The MMC core can hold off handling that
for a while, if it needs to wait until the code walking the device
tree gets around to resuming that host. It's a lot more natural to
hold off such stuff one time there than in N host drivers; especially
since the MMC core already has such hold-off code.

- Dave