From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752132AbcHHJAe (ORCPT ); Mon, 8 Aug 2016 05:00:34 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:35070 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750846AbcHHJAc (ORCPT ); Mon, 8 Aug 2016 05:00:32 -0400 MIME-Version: 1.0 In-Reply-To: References: <20160804212553.GB15690@codeaurora.org> From: Geert Uytterhoeven Date: Mon, 8 Aug 2016 11:00:30 +0200 X-Google-Sender-Auth: 6Zjl_GNSwphNg8dAskBrqDINFkQ Message-ID: Subject: Re: of_clk_add_(hw_)providers multipule times for one node? To: Masahiro Yamada Cc: Stephen Boyd , Rob Herring , linux-clk , Michael Turquette , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 7, 2016 at 6:54 PM, Masahiro Yamada wrote: > 2016-08-05 6:25 GMT+09:00 Stephen Boyd : >> +Rob in case he has any insight >> >> On 07/09, Masahiro Yamada wrote: >>> I think the current code allows to add >>> clk_providers multiple times against one DT node. >>> >>> Are there cases that really need to do so? >> >> If we have clk drivers that have a device driver structure and >> also use CLK_OF_DECLARE then we could get into a situation where >> they register two providers for the same device node. I can't >> think of any other situation where this would happen though. > > What is the benefit for splitting one clock device > into CLK_OF_DECLARE() and a platform_driver? It may be useful if you want to provide a few clocks very early in the boot (through CLK_OF_DECLARE()), and the remaining ones later (through the platform_driver). > If we go this way, I think we need to fix the current code. > > of_clk_add_provider() calls of_clk_del_provider() > in its failure path. > > Notice of_clk_del_provider() unregister > all the providers associated with the device node. > > So, if of_clk_add_provider() fails to register a platform driver, > it may unregister another provider added by OF_CLK_DECLARE(). Do you have to call of_clk_add_provider() from the platform driver? Can't you just populate the missing entries in the clk_onecell_data as registered from the CLK_OF_DECLARE() driver part? Alternatively, if there's a clear (non-Linux specific, as this affects DT!) distinction between the two sets of clocks, you could register your own twocell_get routine from CLK_OF_DELCARE(), and fill in a second (third, fourth, ...) set of clocks from the platform_driver. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds