From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751114AbcGGM04 (ORCPT ); Thu, 7 Jul 2016 08:26:56 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:40152 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750883AbcGGM0u (ORCPT ); Thu, 7 Jul 2016 08:26:50 -0400 Date: Thu, 7 Jul 2016 13:26:36 +0100 From: Russell King - ARM Linux To: Kuninori Morimoto Cc: Michael Turquette , Rob Herring , Mark Brown , Linux-Kernel , Linux-DT , Linux-ARM , Linux-ALSA , linux-clk@vger.kernel.org Subject: Re: [PATCH v2] clkdev: add devm_of_clk_get() Message-ID: <20160707122636.GP1041@n2100.armlinux.org.uk> References: <87wpl2yyuw.wl%kuninori.morimoto.gx@renesas.com> <146785219147.73491.2827268663638530377@resonance> <87ziptixv7.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ziptixv7.wl%kuninori.morimoto.gx@renesas.com> 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 Thu, Jul 07, 2016 at 09:54:03AM +0000, Kuninori Morimoto wrote: > > Hi Michael > > > > +struct clk *devm_of_clk_get(struct device *dev, > > > + struct device_node *np, int index) > > > > Any reason not to use devm_clk_get? Why do we need this helper? > > Because of_clk_get() can parse "clocks", "#clock-cells" on DT. clk_get() should also work just fine. clk_get() uses __of_clk_get_by_name() internally, which uses "clock-names" to locate the index if a connection id is given. of_clk_get() allows lookup of a clock by index only, omitting the name, which means you need to coordinate the order of clocks in DT with the order that the driver wants... which sounds error prone to me. -- 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.