From patchwork Thu Jun 23 00:09:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Rakity X-Patchwork-Id: 907642 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5N0Bgwd016135 for ; Thu, 23 Jun 2011 00:11:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757743Ab1FWALl (ORCPT ); Wed, 22 Jun 2011 20:11:41 -0400 Received: from na3sys009aog113.obsmtp.com ([74.125.149.209]:59196 "EHLO na3sys009aog113.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757685Ab1FWALk convert rfc822-to-8bit (ORCPT ); Wed, 22 Jun 2011 20:11:40 -0400 Received: from SC-OWA01.marvell.com ([65.219.4.129]) (using TLSv1) by na3sys009aob113.postini.com ([74.125.148.12]) with SMTP ID DSNKTgKEsCcJRkxEACwtOy1CwP5SB8iUHPRb@postini.com; Wed, 22 Jun 2011 17:11:40 PDT Received: from SC-vEXCH3.marvell.com ([10.93.76.133]) by SC-OWA01.marvell.com ([10.93.76.21]) with mapi; Wed, 22 Jun 2011 17:09:13 -0700 From: Philip Rakity To: "linux-mmc@vger.kernel.org" , Arindam Nath CC: "Rafael J. Wysocki" Date: Wed, 22 Jun 2011 17:09:11 -0700 Subject: [RFC] sdhci: suspend code correct ? Thread-Topic: [RFC] sdhci: suspend code correct ? Thread-Index: AcwxOchlL/szBEYhRImnpPFXSlvQIw== Message-ID: <8E5F1A83-6949-4B4C-9482-30D582B7C54C@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 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 (demeter2.kernel.org [140.211.167.43]); Thu, 23 Jun 2011 00:11:42 +0000 (UTC) Looking at suspend in sdhci.c, it appears it does not handle errors correctly. If suspend has an error shouldn't the code put things back to the state they were in before the suspend ? If we are suspending then it is not clear why we need to run the re-tune timer. resume will cause a re-tuning. comments please. One other issue not addressed in the code below is what error code is supposed to be returned if say sdhci-pxav3.c detects that it cannot suspend because it detects say dma active? -EBUSY ? Will the suspend code retry or should the sdhci-pxa code wait for the dma to complete ? Philip 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/host/sdhci.c b/drivers/mmc/host/sdhci.c index 91d9892..9c85d6d 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2224,20 +2224,28 @@ out: int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state) { int ret; + int cantune = 0; sdhci_disable_card_detection(host); /* Disable tuning since we are suspending */ if (host->version >= SDHCI_SPEC_300 && host->tuning_count && - host->tuning_mode == SDHCI_TUNING_MODE_1) { - host->flags &= ~SDHCI_NEEDS_RETUNING; - mod_timer(&host->tuning_timer, jiffies + - host->tuning_count * HZ); + host->tuning_mode == SDHCI_TUNING_MODE_1) { + host->flags &= ~SDHCI_NEEDS_RETUNING; + del_timer_sync(&host->tuning_timer); + cantune= 1; } ret = mmc_suspend_host(host->mmc); - if (ret) + if (ret) { + if (cantune) { + host->flags |= SDHCI_NEEDS_RETUNING; + mod_timer(&host->tuning_timer, jiffies + + host->tuning_count * HZ); + } + sdhci_enable_card_detection(host); return ret; + } free_irq(host->irq, host);-- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in