All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Mike Turquette <mturquette@linaro.org>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de
Subject: Re: Automatic clock disabling on clk_put()
Date: Tue, 12 May 2015 16:23:48 -0700	[thread overview]
Message-ID: <55528B84.5050700@codeaurora.org> (raw)
In-Reply-To: <20150511060129.GG6325@pengutronix.de>

On 05/10/15 23:01, Sascha Hauer wrote:
> Hi,
>
> Since we now have per-user clks we could automatically disable clks on
> clk_put() to make the drivers errors paths easier. AFAIR that was one
> of the motivations to switch to per user clks. Is this just not yet
> implemented or are there problems implementing this?
>
>

I don't recall that as being a motivation for per-user clks. The
documentation explicitly states:

 * Note: drivers must ensure that all clk_enable calls made on this
 * clock source are balanced by clk_disable calls prior to calling
 * this function.

so it seems that such a behavior would be an API change. Is it really
that hard to call clk_disable_unprepare() on a clock at the end of an
error path? Maybe you could add a devm_clk_get_prepare_enable() that
does what you want and then call clk_disable_unprepare on the exit path?

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

WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: Automatic clock disabling on clk_put()
Date: Tue, 12 May 2015 16:23:48 -0700	[thread overview]
Message-ID: <55528B84.5050700@codeaurora.org> (raw)
In-Reply-To: <20150511060129.GG6325@pengutronix.de>

On 05/10/15 23:01, Sascha Hauer wrote:
> Hi,
>
> Since we now have per-user clks we could automatically disable clks on
> clk_put() to make the drivers errors paths easier. AFAIR that was one
> of the motivations to switch to per user clks. Is this just not yet
> implemented or are there problems implementing this?
>
>

I don't recall that as being a motivation for per-user clks. The
documentation explicitly states:

 * Note: drivers must ensure that all clk_enable calls made on this
 * clock source are balanced by clk_disable calls prior to calling
 * this function.

so it seems that such a behavior would be an API change. Is it really
that hard to call clk_disable_unprepare() on a clock at the end of an
error path? Maybe you could add a devm_clk_get_prepare_enable() that
does what you want and then call clk_disable_unprepare on the exit path?

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

  reply	other threads:[~2015-05-12 23:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11  6:01 Automatic clock disabling on clk_put() Sascha Hauer
2015-05-11  6:01 ` Sascha Hauer
2015-05-12 23:23 ` Stephen Boyd [this message]
2015-05-12 23:23   ` Stephen Boyd
2015-05-13  6:45   ` Uwe Kleine-König
2015-05-13  6:45     ` Uwe Kleine-König
2015-05-13 19:45     ` Stephen Boyd
2015-05-13 19:45       ` Stephen Boyd
2015-05-13 20:12       ` Russell King - ARM Linux
2015-05-13 20:12         ` Russell King - ARM Linux
2015-05-13  6:47   ` Sascha Hauer
2015-05-13  6:47     ` Sascha Hauer

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=55528B84.5050700@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=s.hauer@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.