From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751930AbdA1TLv (ORCPT ); Sat, 28 Jan 2017 14:11:51 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:38586 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751756AbdA1TLn (ORCPT ); Sat, 28 Jan 2017 14:11:43 -0500 Date: Sat, 28 Jan 2017 19:03:10 +0000 From: Russell King - ARM Linux To: Dmitry Torokhov Cc: Michael Turquette , Stephen Boyd , Viresh Kumar , Guenter Roeck , Andy Shevchenko , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] clk: add more managed APIs Message-ID: <20170128190309.GN27312@n2100.armlinux.org.uk> References: <20170128184047.GA24957@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170128184047.GA24957@dtor-ws> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 28, 2017 at 10:40:47AM -0800, Dmitry Torokhov wrote: > When converting a driver to managed resources it is desirable to be able to > manage all resources in the same fashion. This change allows managing > clocks in the same way we manage many other resources. > > This adds the following managed APIs: > > - devm_clk_prepare()/devm_clk_unprepare(); > - devm_clk_enable()/devm_clk_disable(); > - devm_clk_prepare_enable()/devm_clk_disable_unprepare(). Does it make any sense what so ever to have devm_clk_enable() and devm_clk_disable()? Take a moment to think about where you use all of these. The devm_* functions are there to be used in probe functions so that cleanup paths can be streamlined and less erroneous. They aren't for general use throughout the driver. Given that, there are two operations that you may wish to do in the probe path: 1. prepare a clock (avoiding the enable because you want to perform the enable elsewhere in the driver.) 2. prepare and enable a clock So, does having devm_clk_enable() really make sense? I don't think it does, and I suspect they'll get very little if any use. So, I think best not add them until someone comes up with a good and wide-spread use case. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.