From patchwork Thu Jun 9 18:25:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ohad Ben Cohen X-Patchwork-Id: 866442 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p59IPUCd010324 for ; Thu, 9 Jun 2011 18:25:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751353Ab1FISZ3 (ORCPT ); Thu, 9 Jun 2011 14:25:29 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:62937 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751205Ab1FISZ3 (ORCPT ); Thu, 9 Jun 2011 14:25:29 -0400 Received: by wwa36 with SMTP id 36so1990634wwa.1 for ; Thu, 09 Jun 2011 11:25:28 -0700 (PDT) Received: by 10.217.1.212 with SMTP id n62mr6761977wes.25.1307643928262; Thu, 09 Jun 2011 11:25:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.90.132 with HTTP; Thu, 9 Jun 2011 11:25:08 -0700 (PDT) X-Originating-IP: [46.116.119.47] In-Reply-To: References: <20110605123852.BC6F39D401C@zog.reactivated.net> From: Ohad Ben-Cohen Date: Thu, 9 Jun 2011 21:25:08 +0300 Message-ID: Subject: Re: [PATCH] mmc: sdio: reset card during power_restore To: Daniel Drake Cc: linux-mmc@vger.kernel.org Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 09 Jun 2011 18:25:30 +0000 (UTC) On Thu, Jun 9, 2011 at 8:56 PM, Daniel Drake wrote: > Done, the rmmod issue remains fixed - the card gets powered down during rmmod. great ! > Next up is the problem where on this setup, if I suspend after loading > the module, and the module asks the card to shut down during suspend, > it fails to get brought up during resume. we need to take into account that driver core change I spotted. > Note that I have now rolled in a patch you made in another thread to > correctly call into the driver's remove routine during suspend when > powering down the card. let's update that patch. I'd send you an updated one, but I have to go for awhile, so here's the quick change you need to do. replace the put_noidle() call in the hunk below with a put_sync(): } tell me how it goes... --- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 4d0c15b..e23888a 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -540,6 +540,13 @@ static void mmc_sdio_remove(struct mmc_host *host) BUG_ON(!host); BUG_ON(!host->card); + /* + * if this card is managed by runtime pm, make sure it is powered on + * before invoking its SDIO functions' ->remove() handler + */ + if (host->caps & MMC_CAP_POWER_OFF_CARD) + pm_runtime_get_sync(&host->card->dev); + for (i = 0;i < host->card->sdio_funcs;i++) { if (host->card->sdio_func[i]) { sdio_remove_func(host->card->sdio_func[i]); @@ -547,6 +554,9 @@ static void mmc_sdio_remove(struct mmc_host *host) } } + if (host->caps & MMC_CAP_POWER_OFF_CARD) + pm_runtime_put_noidle(&host->card->dev); //<============== use pm_runtime_put_sync here + mmc_remove_card(host->card); host->card = NULL;