Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753562AbbEMGp5 (ORCPT ); Wed, 13 May 2015 02:45:57 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:39900 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751954AbbEMGp4 (ORCPT ); Wed, 13 May 2015 02:45:56 -0400 Date: Wed, 13 May 2015 08:45:50 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Stephen Boyd Cc: Sascha Hauer , Mike Turquette , kernel@pengutronix.de, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: Automatic clock disabling on clk_put() Message-ID: <20150513064550.GE28888@pengutronix.de> References: <20150511060129.GG6325@pengutronix.de> <55528B84.5050700@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <55528B84.5050700@codeaurora.org> 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: ukl@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 Content-Length: 1859 Lines: 45 Hello, On Tue, May 12, 2015 at 04:23:48PM -0700, Stephen Boyd wrote: > On 05/10/15 23:01, Sascha Hauer wrote: > > Hi, > > > > Since we now have per-user clks we could automatically disable clks on > > clk_put() to make the drivers errors paths easier. AFAIR that was one > > of the motivations to switch to per user clks. Is this just not yet > > implemented or are there problems implementing this? > > I don't recall that as being a motivation for per-user clks. The > documentation explicitly states: > > * Note: drivers must ensure that all clk_enable calls made on this > * clock source are balanced by clk_disable calls prior to calling > * this function. > > so it seems that such a behavior would be an API change. Is it really well, it's a compatible API change. So if you continue to use it as you were obliged to do before, everything is fine. IMHO the introduction of per-user clocks are a much bigger issue. I'm not sure that auto disabling is a good idea[1], but at least giving a warning should be possible. > that hard to call clk_disable_unprepare() on a clock at the end of an > error path? Maybe you could add a devm_clk_get_prepare_enable() that > does what you want and then call clk_disable_unprepare on the exit path? You mean clk_disable_unprepare is called in the same function that calls clk_put I assume such that you don't have to do anything in the exit path. Best regards Uwe [1] mainly because I didn't think about it -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ | -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/