From: Thierry Bultel <thierry.bultel@basystemes.fr>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] [PATCH 1/1] rtcan_flexcan: with open firmware, use devm_clk_put instead of clk_put
Date: Sat, 3 Oct 2015 14:24:53 +0200 [thread overview]
Message-ID: <560FC915.1010209@basystemes.fr> (raw)
In-Reply-To: <20151002173432.GV31137@hermes.click-hack.org>
Le 02/10/2015 19:34, Gilles Chanteperdrix a écrit :
> On Fri, Sep 25, 2015 at 03:22:50PM +0200, Thierry Bultel wrote:
>> Signed-off-by: Thierry Bultel <thierry.bultel@basystemes.fr>
>> ---
>> ksrc/drivers/can/rtcan_flexcan.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/ksrc/drivers/can/rtcan_flexcan.c b/ksrc/drivers/can/rtcan_flexcan.c
>> index f5477db..91c5ebf 100644
>> --- a/ksrc/drivers/can/rtcan_flexcan.c
>> +++ b/ksrc/drivers/can/rtcan_flexcan.c
>> @@ -235,6 +235,7 @@ struct flexcan_priv {
>> struct regulator *reg_xceiver;
>> struct clk *clk_ipg;
>> struct clk *clk_per;
>> + struct platform_device *pdev;
>> #endif
>> };
>>
>> @@ -1054,8 +1055,8 @@ static void put_clocks(struct flexcan_priv *priv)
>> #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
>> clk_put(priv->clk);
>> #else
>> - clk_put(priv->clk_per);
>> - clk_put(priv->clk_ipg);
>> + devm_clk_put(&priv->pdev->dev,priv->clk_per);
>> + devm_clk_put(&priv->pdev->dev,priv->clk_ipg);
>> #endif
>> }
>>
>> @@ -1132,6 +1133,7 @@ static int flexcan_probe(struct platform_device *pdev)
>> }
>> clock_freq = clk_get_rate(priv->clk_per);
>> }
>> + priv->pdev = pdev;
>> #endif
>>
>> mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
> I think you can completely drop the calls to clk_put: with
> devm_clk_get, the clocks should be automatically put when the device
> is destroyed. At least, this is what the doc says:
> http://lxr.free-electrons.com/source/include/linux/clk.h#L219
>
> Could you try the following patch, instead?
This is enough indeed, thanks.
Will you commit it ?
Thierry
>
> diff --git a/ksrc/drivers/can/rtcan_flexcan.c b/ksrc/drivers/can/rtcan_flexcan.c
> index f5477db..ddc3708 100644
> --- a/ksrc/drivers/can/rtcan_flexcan.c
> +++ b/ksrc/drivers/can/rtcan_flexcan.c
> @@ -1053,9 +1053,6 @@ static void put_clocks(struct flexcan_priv *priv)
> {
> #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
> clk_put(priv->clk);
> -#else
> - clk_put(priv->clk_per);
> - clk_put(priv->clk_ipg);
> #endif
> }
>
>
>
next prev parent reply other threads:[~2015-10-03 12:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 13:22 [Xenomai] [PATCH 1/1] rtcan_flexcan: with open firmware, use devm_clk_put instead of clk_put Thierry Bultel
2015-09-25 16:16 ` Michael Haberler
2015-09-25 17:19 ` Thierry Bultel
2015-10-02 17:34 ` Gilles Chanteperdrix
2015-10-03 12:24 ` Thierry Bultel [this message]
2015-10-04 11:47 ` Gilles Chanteperdrix
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=560FC915.1010209@basystemes.fr \
--to=thierry.bultel@basystemes.fr \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=xenomai@xenomai.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 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.