public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: shawn.guo@freescale.com (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/5] ARM: imx: clk-gate2: Use post decrement for share_count
Date: Tue, 1 Jul 2014 19:52:53 +0800	[thread overview]
Message-ID: <20140701115252.GM14471@dragon> (raw)
In-Reply-To: <1404194129-25543-4-git-send-email-festevam@gmail.com>

On Tue, Jul 01, 2014 at 02:55:28AM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> SSI clocks use the share_count mechanism since SSI and SPDIF share the same
> clock gate bits.
> 
> When using the share_count for the SSI clock we notice that it gets disabled
> due to the usage of pre-decrement operation in the clk_gate2_disable() function.
> 
> Use the post-decrement operation so that the correct share_count is used and the
> SSI clock does not get disable when an audio file needs to be played. 
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  arch/arm/mach-imx/clk-gate2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
> index 4ba587d..463083c 100644
> --- a/arch/arm/mach-imx/clk-gate2.c
> +++ b/arch/arm/mach-imx/clk-gate2.c
> @@ -67,7 +67,7 @@ static void clk_gate2_disable(struct clk_hw *hw)
>  
>  	spin_lock_irqsave(gate->lock, flags);
>  
> -	if (gate->share_count && --(*gate->share_count) > 0)
> +	if (gate->share_count && (*gate->share_count)-- > 0)

The change makes no sense.  Let's say that clk_gate2_disable() gets
called with share_count being 1.  In this case, we should access
register to gate the clock, right?

Shawn

>  		goto out;
>  
>  	reg = readl(gate->reg);
> -- 
> 1.8.3.2
> 

  reply	other threads:[~2014-07-01 11:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-01  5:55 [PATCH 1/5] ARM: dts: imx6sx: Fix sdma node Fabio Estevam
2014-07-01  5:55 ` [PATCH 2/5] ARM: dts: imx6sx: Fix SSI nodes Fabio Estevam
2014-07-01  7:45   ` Markus Pargmann
2014-07-01  7:49     ` Markus Pargmann
2014-07-01  5:55 ` [PATCH 3/5] ARM: imx: clk-imx6sx: Remove SSI IPG clocks Fabio Estevam
2014-07-01  6:23   ` Nicolin Chen
2014-07-01  5:55 ` [PATCH 4/5] ARM: imx: clk-gate2: Use post decrement for share_count Fabio Estevam
2014-07-01 11:52   ` Shawn Guo [this message]
2014-07-01 17:44     ` Fabio Estevam
2014-07-02  4:35       ` Shawn Guo
2014-07-02 14:27         ` Fabio Estevam
2014-07-03  3:26           ` Shawn Guo
2014-07-02 15:29       ` Mike Turquette
2014-07-02 16:52         ` Fabio Estevam
2014-07-02 17:17           ` Mike Turquette
2014-07-03  7:46           ` Shawn Guo
2014-07-03  7:56             ` Shawn Guo
2014-07-01  5:55 ` [PATCH 5/5] ARM: dts: imx6sx-sdb: Add audio support Fabio Estevam

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=20140701115252.GM14471@dragon \
    --to=shawn.guo@freescale.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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