From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756516AbbDKAwq (ORCPT ); Fri, 10 Apr 2015 20:52:46 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:58220 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754894AbbDKAwp (ORCPT ); Fri, 10 Apr 2015 20:52:45 -0400 Message-ID: <5528705B.3040102@codeaurora.org> Date: Fri, 10 Apr 2015 17:52:43 -0700 From: Stephen Boyd User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Heiko Stuebner , mturquette@linaro.org CC: linux@arm.linux.org.uk, linux-kernel@vger.kernel.org, dianders@chromium.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 3/4] clk: add CLK_DEFER_ORPHAN flag to prevent orphans from being used References: <1427988853-9549-1-git-send-email-heiko@sntech.de> <1427988853-9549-4-git-send-email-heiko@sntech.de> In-Reply-To: <1427988853-9549-4-git-send-email-heiko@sntech.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/02/15 08:34, Heiko Stuebner wrote: > The usage of clocks derived from an orphan can produce issues when trying > to set rates etc. So ideally a clk_get to such a clock should defer till > the clock hierarchy is complete. > But as some arches probably rely on such clocks we can't disable them all. > Therefore add a new clk flag where arches can enable this behaviour for > their clocks. > > Signed-off-by: Heiko Stuebner > --- > drivers/clk/clk.c | 6 ++++++ > include/linux/clk-provider.h | 1 + > 2 files changed, 7 insertions(+) > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > index 476f491..8511c62 100644 > --- a/drivers/clk/clk.c > +++ b/drivers/clk/clk.c > @@ -3041,6 +3041,12 @@ struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec, > if (provider->node == clkspec->np) > clk = provider->get(clkspec, provider->data); > if (!IS_ERR(clk)) { > + if ((__clk_get_flags(clk) & CLK_DEFER_ORPHAN) > + && clk_is_orphan(clk)) { > + clk = ERR_PTR(-EPROBE_DEFER); > + break; > + } > + > clk = __clk_create_clk(__clk_get_hw(clk), dev_id, > con_id); > > diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h > index 28abf1b..ef8d669 100644 > --- a/include/linux/clk-provider.h > +++ b/include/linux/clk-provider.h > @@ -31,6 +31,7 @@ > #define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */ > #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */ > #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */ > +#define CLK_DEFER_ORPHAN BIT(9) /* defer clk_get calls for orphans */ > I don't see why this is an opt-in feature. If we think there are arches that are setting rates of clocks before they're ready then we have a problem and we should fix it. These last two patches don't look necessary. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project