From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753020AbaIXTwn (ORCPT ); Wed, 24 Sep 2014 15:52:43 -0400 Received: from gw-1.arm.linux.org.uk ([78.32.30.217]:41342 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751124AbaIXTwl (ORCPT ); Wed, 24 Sep 2014 15:52:41 -0400 Date: Wed, 24 Sep 2014 20:52:22 +0100 From: Russell King - ARM Linux To: Alan Stern Cc: Pavel Machek , Krzysztof Kozlowski , Dan Williams , Vinod Koul , linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Ulf Hansson , Grant Likely , Lars-Peter Clausen , Michal Simek , "Rafael J. Wysocki" , Len Brown , Randy Dunlap , linux-doc@vger.kernel.org, linux-pm@vger.kernel.org, Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz Subject: Re: [PATCH v7 1/5] PM / Runtime: Add getter for quering the IRQ safe option Message-ID: <20140924195222.GB5182@n2100.arm.linux.org.uk> References: <20140924175302.GB1231@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 24, 2014 at 03:47:17PM -0400, Alan Stern wrote: > On Wed, 24 Sep 2014, Pavel Machek wrote: > > > On Wed 2014-09-24 15:50:08, Krzysztof Kozlowski wrote: > > > Add a simple getter pm_runtime_is_irq_safe() for quering whether runtime > > > PM IRQ safe was set or not. > > > > > > Various bus drivers implementing runtime PM may use choose to suspend > > > differently based on IRQ safeness status of child driver (e.g. do not > > > unprepare the clock if IRQ safe is not set). > > > > > > Signed-off-by: Krzysztof Kozlowski > > > Reviewed-by: Ulf Hansson > > > > Are you sure this is good interface? > > > > "Tell me if another function works this or that way". > > > > That's certainly not traditional interface, and it seems dangerous to > > me. Callbacks now have different semantic requirements based on value > > of some flag... > > > > Would it be possible to have two sets of callbacks, one irq safe and > > one not? > > Or maybe add a flag to the bus-specific device structures, indicating > specifically whether or not the clock should be unprepared during a > runtime suspend. Then individual drivers could set this flag or not, > independent of the irq-safe setting. What you're proposing is _less_ safe, because with your proposal, you now have the possibility that drivers will tell runtime PM that it has IRQ safe callbacks, but the bus code tries to prepare/unprepare the clock, which causes a might-sleep-if warning. This is fragile. -- FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.