All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregory.clement@free-electrons.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: mvebu: Fix of_clk_get() call in a non sleeping context
Date: Tue, 08 Mar 2016 17:38:11 +0100	[thread overview]
Message-ID: <8760wx3oy4.fsf@free-electrons.com> (raw)
In-Reply-To: <20160308173134.22a3ad64@free-electrons.com> (Thomas Petazzoni's message of "Tue, 8 Mar 2016 17:31:34 +0100")

Hi Thomas,
 
 On mar., mars 08 2016, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:

> Hello,
>
> On Tue, 08 Mar 2016 17:19:39 +0100, Gregory CLEMENT wrote:
>
>> OK, so let's only use clk_enable() which can't sleep. On mvebu SoCs
>> there is no prepare/unprepare operation for the clock, so trying to use
>> clk_prepare_enable() is useless. Especially for this code which is not
>> for a random IP but especially for the Armada XP SoC.
>> 
>> If in the future the same logic can be used for a new mvebu SoC which
>> need the prepare/unprepare feature, then we will see how to deal with
>> it, but I really doubt that it will happen.
>
> I am not sure doing a clk_enable() without a clk_prepare() before it is
> legal, and that's why the clk_prepare_enable() helper is widely used.
>
> From the clk_prepare() comment:
>
> ""
> In fact clk_prepare must be called before clk_enable.
> ""
>

And from clk_enable comment we have:
""
clk_enable must not sleep, which differentiates it from clk_prepare.  In a
simple case, clk_enable can be used instead of clk_prepare to ungate a clk
if the operation will never sleep.
""

Moreoever for me the "must" was to insist to the order of the call no to
the fact that both must be called.

Gregory

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Gregory CLEMENT <gregory.clement@free-electrons.com>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	Lior Amsalem <alior@marvell.com>,
	Nadav Haklai <nadavh@marvell.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH] ARM: mvebu: Fix of_clk_get() call in a non sleeping context
Date: Tue, 08 Mar 2016 17:38:11 +0100	[thread overview]
Message-ID: <8760wx3oy4.fsf@free-electrons.com> (raw)
In-Reply-To: <20160308173134.22a3ad64@free-electrons.com> (Thomas Petazzoni's message of "Tue, 8 Mar 2016 17:31:34 +0100")

Hi Thomas,
 
 On mar., mars 08 2016, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:

> Hello,
>
> On Tue, 08 Mar 2016 17:19:39 +0100, Gregory CLEMENT wrote:
>
>> OK, so let's only use clk_enable() which can't sleep. On mvebu SoCs
>> there is no prepare/unprepare operation for the clock, so trying to use
>> clk_prepare_enable() is useless. Especially for this code which is not
>> for a random IP but especially for the Armada XP SoC.
>> 
>> If in the future the same logic can be used for a new mvebu SoC which
>> need the prepare/unprepare feature, then we will see how to deal with
>> it, but I really doubt that it will happen.
>
> I am not sure doing a clk_enable() without a clk_prepare() before it is
> legal, and that's why the clk_prepare_enable() helper is widely used.
>
> From the clk_prepare() comment:
>
> ""
> In fact clk_prepare must be called before clk_enable.
> ""
>

And from clk_enable comment we have:
""
clk_enable must not sleep, which differentiates it from clk_prepare.  In a
simple case, clk_enable can be used instead of clk_prepare to ungate a clk
if the operation will never sleep.
""

Moreoever for me the "must" was to insist to the order of the call no to
the fact that both must be called.

Gregory

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2016-03-08 16:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08 14:18 [PATCH] ARM: mvebu: Fix of_clk_get() call in a non sleeping context Gregory CLEMENT
2016-03-08 14:18 ` Gregory CLEMENT
2016-03-08 15:41 ` Thomas Petazzoni
2016-03-08 15:41   ` Thomas Petazzoni
2016-03-08 16:19   ` Gregory CLEMENT
2016-03-08 16:19     ` Gregory CLEMENT
2016-03-08 16:31     ` Thomas Petazzoni
2016-03-08 16:31       ` Thomas Petazzoni
2016-03-08 16:38       ` Gregory CLEMENT [this message]
2016-03-08 16:38         ` Gregory CLEMENT
2016-03-08 16:51         ` Thomas Petazzoni
2016-03-08 16:51           ` Thomas Petazzoni
2016-03-08 20:55           ` Russell King - ARM Linux
2016-03-08 20:55             ` Russell King - ARM Linux
2016-03-08 20:50         ` Russell King - ARM Linux
2016-03-08 20:50           ` Russell King - ARM Linux
2016-03-10 12:44           ` Gregory CLEMENT
2016-03-10 12:44             ` Gregory CLEMENT

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=8760wx3oy4.fsf@free-electrons.com \
    --to=gregory.clement@free-electrons.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 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.