From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Subject: Re: [PATCH v9 2/4] amba: Don't unprepare the clocks if device driver wants IRQ safe runtime PM Date: Tue, 4 Nov 2014 21:18:34 +0100 Message-ID: <20141104201834.GC15071@amd> References: <1415105570-7871-1-git-send-email-k.kozlowski@samsung.com> <1415105570-7871-3-git-send-email-k.kozlowski@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:42646 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752274AbaKDUSg (ORCPT ); Tue, 4 Nov 2014 15:18:36 -0500 Content-Disposition: inline In-Reply-To: <1415105570-7871-3-git-send-email-k.kozlowski@samsung.com> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Krzysztof Kozlowski Cc: "Rafael J. Wysocki" , Len Brown , Jonathan Corbet , Russell King , Dan Williams , Vinod Koul , Ulf Hansson , Alan Stern , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Lars-Peter Clausen , Michal Simek , Kevin Hilman , Laurent Pinchart , Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz On Tue 2014-11-04 13:52:48, Krzysztof Kozlowski wrote: > The AMBA bus driver defines runtime Power Management functions which > disable and unprepare AMBA bus clock. This is problematic for runtime PM > because unpreparing a clock might sleep so it is not interrupt safe. > > However some drivers may want to implement runtime PM functions in > interrupt-safe way (see pm_runtime_irq_safe()). In such case the AMBA > bus driver should only disable/enable the clock in runtime suspend and > resume callbacks. > /* > * Hooks to provide runtime PM of the pclk (bus clock). It is safe to > * enable/disable the bus clock at runtime PM suspend/resume as this > @@ -95,8 +102,14 @@ static int amba_pm_runtime_suspend(struct device *dev) > struct amba_device *pcdev = to_amba_device(dev); > int ret = pm_generic_runtime_suspend(dev); > > - if (ret == 0 && dev->driver) > - clk_disable_unprepare(pcdev->pclk); > + if (ret == 0 && dev->driver) { > + pcdev->irq_safe = get_pm_runtime_irq_safe(dev); > + > + if (pcdev->irq_safe) > + clk_disable(pcdev->pclk); > + else > + clk_disable_unprepare(pcdev->pclk); > + } So you can handle the case of !pcdev->irq_safe. What is the penalty for always assuming !pcdev->irq_safe? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html