linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Joachim Eastwood <manabian@gmail.com>
Cc: mturquette@baylibre.com, linux-clk@vger.kernel.org
Subject: Re: [PATCH v2 2/2] clk: lpc18xx-cgu: fix potential system hang when disabling unused clocks
Date: Mon, 19 Oct 2015 15:27:43 -0700	[thread overview]
Message-ID: <20151019222743.GD19782@codeaurora.org> (raw)
In-Reply-To: <1440527643-2960-3-git-send-email-manabian@gmail.com>

On 08/25, Joachim Eastwood wrote:
> diff --git a/drivers/clk/nxp/clk-lpc18xx-cgu.c b/drivers/clk/nxp/clk-lpc18xx-cgu.c
> index e0a3cb8970ab..3d8d0ac38f96 100644
> --- a/drivers/clk/nxp/clk-lpc18xx-cgu.c
> +++ b/drivers/clk/nxp/clk-lpc18xx-cgu.c
> @@ -8,6 +8,7 @@
>   * warranty of any kind, whether express or implied.
>   */
>  
> +#include <linux/clk.h>
>  #include <linux/clk-provider.h>
>  #include <linux/delay.h>
>  #include <linux/kernel.h>
> @@ -480,6 +481,42 @@ static const struct clk_ops lpc18xx_pll1_ops = {
>  	.recalc_rate = lpc18xx_pll1_recalc_rate,
>  };
>  
> +static int lpc18xx_cgu_gate_enabled(struct clk_hw *hw)

s/enabled/enable/?

> +{
> +	return clk_gate_ops.enable(hw);
> +}
> +
> +static void lpc18xx_cgu_gate_disable(struct clk_hw *hw)
> +{
> +	clk_gate_ops.disable(hw);
> +}
> +
> +static int lpc18xx_cgu_gate_is_enabled(struct clk_hw *hw)
> +{
> +	struct clk *parent;
> +
> +	/*
> +	 * The consumer of base clocks needs know if the
> +	 * base clock is really enabled before it can be
> +	 * accessed. It is therefore necessary to verify
> +	 * this all the way up.
> +	 */
> +	parent = clk_get_parent(hw->clk);
> +	if (IS_ERR(parent))
> +		return 0;
> +
> +	if (!__clk_is_enabled(parent))

Same comment as in patch 1.

> +		return 0;
> +
> +	return clk_gate_ops.is_enabled(hw);
> +}
> +
> +static const struct clk_ops lpc18xx_gate_ops = {
> +	.enable = lpc18xx_cgu_gate_enabled,
> +	.disable = lpc18xx_cgu_gate_disable,
> +	.is_enabled = lpc18xx_cgu_gate_is_enabled,
> +};
> +
>  static struct lpc18xx_cgu_pll_clk lpc18xx_cgu_src_clk_plls[] = {
>  	LPC1XX_CGU_CLK_PLL(PLL0USB,	pll0_src_ids, pll0_ops),
>  	LPC1XX_CGU_CLK_PLL(PLL0AUDIO,	pll0_src_ids, pll0_ops),

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2015-10-19 22:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25 18:34 [PATCH v2 0/2] Fix unused clock disabling on LPC18xx Joachim Eastwood
2015-08-25 18:34 ` [PATCH v2 1/2] clk: lpc18xx-ccu: fix potential system hang when disabling unused clocks Joachim Eastwood
2015-10-19 22:26   ` Stephen Boyd
2015-10-20 10:42     ` Joachim Eastwood
2015-10-21  9:34       ` Michael Turquette
2015-10-21 13:22         ` Joachim Eastwood
2015-08-25 18:34 ` [PATCH v2 2/2] clk: lpc18xx-cgu: " Joachim Eastwood
2015-10-19 22:27   ` Stephen Boyd [this message]
2015-10-18 22:01 ` [PATCH v2 0/2] Fix unused clock disabling on LPC18xx Joachim Eastwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151019222743.GD19782@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=manabian@gmail.com \
    --cc=mturquette@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).