From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754296AbbDTGt3 (ORCPT ); Mon, 20 Apr 2015 02:49:29 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:38274 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754125AbbDTGt0 (ORCPT ); Mon, 20 Apr 2015 02:49:26 -0400 Date: Mon, 20 Apr 2015 08:49:10 +0200 From: Sascha Hauer To: Chaotian Jing Cc: Rob Herring , Matthias Brugger , Chris Ball , Ulf Hansson , Mark Rutland , James Liao , srv_heupstream@mediatek.com, Arnd Bergmann , devicetree@vger.kernel.org, Hongzhou Yang , Catalin Marinas , bin.zhang@mediatek.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Will Deacon , linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org, Sascha Hauer , "Joe.C" , Eddie Huang , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 3/5] mmc: mediatek: Add PM support for MMC driver Message-ID: <20150420064910.GO4946@pengutronix.de> References: <1426562035-16709-1-git-send-email-chaotian.jing@mediatek.com> <1426562035-16709-4-git-send-email-chaotian.jing@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1426562035-16709-4-git-send-email-chaotian.jing@mediatek.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 08:46:54 up 34 days, 18:38, 46 users, load average: 0.08, 0.11, 0.13 User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 17, 2015 at 11:13:53AM +0800, Chaotian Jing wrote: > Add PM support for Mediatek MMC driver > > Signed-off-by: Chaotian Jing > --- > drivers/mmc/host/mtk-sd.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 93 insertions(+), 1 deletion(-) > > @@ -1003,6 +1042,8 @@ static int msdc_ops_switch_volt(struct mmc_host *mmc, struct mmc_ios *ios) > > if (!IS_ERR(mmc->supply.vqmmc)) { > > + pm_runtime_get_sync(host->dev); > + > if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) { > min_uv = 3300000; > max_uv = 3300000; > @@ -1011,6 +1052,9 @@ static int msdc_ops_switch_volt(struct mmc_host *mmc, struct mmc_ios *ios) > max_uv = 1800000; > } else { > dev_err(host->dev, "Unsupported signal voltage!\n"); > + > + pm_runtime_mark_last_busy(host->dev); > + pm_runtime_put_autosuspend(host->dev); > return -EINVAL; > } > > @@ -1022,6 +1066,8 @@ static int msdc_ops_switch_volt(struct mmc_host *mmc, struct mmc_ios *ios) > } > } > > + pm_runtime_mark_last_busy(host->dev); > + pm_runtime_put_autosuspend(host->dev); This is unbalanced. You do a pm_runtime_get_sync() depending on !IS_ERR(mmc->supply.vqmmc), but you call pm_runtime_put_autosuspend() unconditionally. Besides, I don't see that the pm_ops are necessary here at all. This function does nothing on the controller. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |