From patchwork Fri Jan 14 08:23:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chuanxiao.Dong" X-Patchwork-Id: 477741 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0E8Ti2K004309 for ; Fri, 14 Jan 2011 08:29:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751439Ab1ANI3n (ORCPT ); Fri, 14 Jan 2011 03:29:43 -0500 Received: from mga11.intel.com ([192.55.52.93]:30367 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751046Ab1ANI3n (ORCPT ); Fri, 14 Jan 2011 03:29:43 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 14 Jan 2011 00:29:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.60,322,1291622400"; d="scan'208";a="877430790" Received: from unknown (HELO intel.com) ([172.16.120.128]) by fmsmga001.fm.intel.com with ESMTP; 14 Jan 2011 00:28:41 -0800 Date: Fri, 14 Jan 2011 16:23:24 +0800 From: Chuanxiao Dong To: linux-mmc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, cjb@laptop.org, ohad@wizery.com Subject: [PATCH v1 3/3]mmc: not clock gate host when host is in runtime suspended state Message-ID: <20110114082324.GD27523@intel.com> Reply-To: Chuanxiao Dong MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) 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]); Fri, 14 Jan 2011 08:29:44 +0000 (UTC) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index e296c5a..d2121fa 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -670,6 +670,17 @@ void mmc_gate_clock(struct mmc_host *host) host->ios.clock = 0; host->clk_gated = true; spin_unlock_irqrestore(&host->clk_lock, flags); +#ifdef CONFIG_PM_RUNTIME + /* + * mmc clock gating is done in a work queue which + * does not synchronized with host controller runtime + * power management. So when mmc gate clock, host may + * have already in runtime suspend state. In that case, + * driver cannot touch host controller registers + */ + if (host->class_dev.power.runtime_status != RPM_ACTIVE) + return; +#endif mmc_set_ios(host); }