linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mturquette@linaro.org (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 7/8] clk: per-user clock accounting for debug
Date: Wed, 27 Aug 2014 13:54:10 -0700	[thread overview]
Message-ID: <20140827205410.5251.27621@quantum> (raw)
In-Reply-To: <1408375833-10703-7-git-send-email-tomeu.vizoso@collabora.com>

Quoting Tomeu Vizoso (2014-08-18 08:30:32)
> @@ -936,10 +939,25 @@ EXPORT_SYMBOL_GPL(clk_provider_disable);
>   */
>  void clk_disable(struct clk *clk_user)
>  {
> +       struct clk_core *clk;
> +       unsigned long flags;
> +
>         if (IS_ERR_OR_NULL(clk_user))
>                 return;
>  
> -       clk_provider_disable(clk_to_clk_core(clk_user));
> +       clk = clk_to_clk_core(clk_user);
> +
> +       flags = clk_enable_lock();
> +       if (!WARN(clk_user->enable_count == 0,
> +                 "incorrect disable clk dev %s con %s last disabler %pF\n",
> +                 clk_user->dev_id, clk_user->con_id, clk_user->last_disable)) {
> +
> +               clk_user->last_disable = __builtin_return_address(0);
> +               clk_user->enable_count--;
> +
> +               __clk_disable(clk);
> +       }
> +       clk_enable_unlock(flags);
>  }
>  EXPORT_SYMBOL_GPL(clk_disable);
>  
> @@ -1000,10 +1018,22 @@ EXPORT_SYMBOL_GPL(clk_provider_enable);
>   */
>  int clk_enable(struct clk *clk_user)
>  {
> +       struct clk_core *clk;
> +       unsigned long flags;
> +       int ret;
> +
>         if (!clk_user)
>                 return 0;
>  
> -       return clk_provider_enable(clk_to_clk_core(clk_user));
> +       clk = clk_to_clk_core(clk_user);
> +
> +       flags = clk_enable_lock();
> +       ret = __clk_enable(clk);
> +       if (!ret)
> +               clk_user->enable_count++;
> +       clk_enable_unlock(flags);
> +
> +       return ret;
>  }
>  EXPORT_SYMBOL_GPL(clk_enable);
>  

While we're at it, why not do per-using accounting for clk_{un}prepare?

Regards,
Mike

  reply	other threads:[~2014-08-27 20:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 15:30 [PATCH v7 0/8] Per-user clock constraints Tomeu Vizoso
2014-08-18 15:30 ` [PATCH v7 1/8] clk: Add temporary mapping to the existing API Tomeu Vizoso
2014-08-20 14:50   ` Mike Turquette
2014-08-21 18:04     ` Tony Lindgren
2014-08-21 18:10       ` Jason Cooper
2014-08-22  3:49         ` Simon Horman
2014-08-25  9:18         ` Sebastian Hesselbarth
2014-08-18 15:30 ` [PATCH v7 2/8] clk: provide public clk_is_enabled function Tomeu Vizoso
2014-08-18 15:30 ` [PATCH v7 3/8] cpufreq: kirkwood: Remove use of the clk provider API Tomeu Vizoso
     [not found]   ` <20140820225513.5251.284@quantum>
2014-08-21  7:53     ` Tomeu Vizoso
2014-08-21 13:38       ` Andrew Lunn
2014-08-22 19:29         ` Mike Turquette
2014-08-22 20:11           ` Andrew Lunn
2014-08-22 20:27             ` Andrew Lunn
2014-08-26 21:46             ` Mike Turquette
2014-08-26 22:36               ` Andrew Lunn
2014-08-26 23:30                 ` Mike Turquette
2014-08-27  0:35                   ` Andrew Lunn
2014-08-27  5:04                     ` Mike Turquette
2014-08-27 15:58                   ` Jason Gunthorpe
2014-08-18 15:30 ` [PATCH v7 4/8] ASoC: mxs-saif: fix mixed use of public and provider clk API Tomeu Vizoso
2014-08-18 15:30 ` [PATCH v7 6/8] clk: use struct clk only for external API Tomeu Vizoso
2014-08-18 15:30 ` [PATCH v7 7/8] clk: per-user clock accounting for debug Tomeu Vizoso
2014-08-27 20:54   ` Mike Turquette [this message]
2014-08-18 15:30 ` [PATCH v7 8/8] clk: Add floor and ceiling constraints to clock rates Tomeu Vizoso
2014-08-21  2:12 ` [PATCH v7 0/8] Per-user clock constraints Andrew Lunn
2014-08-21  7:10   ` Tomeu Vizoso
2014-08-26 13:20 ` Heiko Stübner

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=20140827205410.5251.27621@quantum \
    --to=mturquette@linaro.org \
    --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;
as well as URLs for NNTP newsgroup(s).