linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: thomas.petazzoni@free-electrons.com (Thomas Petazzoni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/7] mmc: atmel-mci: prepare clk before calling enable
Date: Tue, 16 Jul 2013 17:13:24 +0200	[thread overview]
Message-ID: <20130716171324.7d483ada@skate> (raw)
In-Reply-To: <1373987208-24120-1-git-send-email-b.brezillon@overkiz.com>

Dear Boris BREZILLON,

On Tue, 16 Jul 2013 17:06:48 +0200, Boris BREZILLON wrote:

>  	buf = kmalloc(ATMCI_REGS_SIZE, GFP_KERNEL);
>  	if (!buf)
> @@ -389,9 +391,13 @@ static int atmci_regs_show(struct seq_file *s, void *v)
>  	 * consistent.
>  	 */
>  	spin_lock_bh(&host->lock);
> -	clk_enable(host->mck);
> +	ret = clk_prepare_enable(host->mck);

I am not very familiar with the spin_lock_bh() variant, but are you
sure we are allowed to sleep within a spin_lock_bh()-protected critical
section?

Remember that clk_prepare_enable() calls both ->prepare() and
->enable() for the clock, and ->prepare() is allowed to sleep, while
->enable() is guaranteed not to sleep.

Therefore, clk_prepare() is usually called at probe time, while
clk_enable() is called whenever enabling/disabling the clock is really
needed. So not all clk_enable() can transparently be converted into a
clk_prepare_enable().

Best regards,

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

  reply	other threads:[~2013-07-16 15:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16 15:03 [PATCH v3 0/7] ARM: at91: prepare transition to common clk framework Boris BREZILLON
2013-07-16 15:05 ` [PATCH v3 1/7] ARM: at91/tc/clocksource: replace clk_enable/disable with clk_prepare_enable/disable_unprepare Boris BREZILLON
2013-07-16 15:48   ` Daniel Lezcano
2013-07-16 15:06 ` [PATCH v3 2/7] mmc: atmel-mci: prepare clk before calling enable Boris BREZILLON
2013-07-16 15:13   ` Thomas Petazzoni [this message]
2013-07-16 15:49     ` boris brezillon
2013-07-16 17:13   ` Russell King - ARM Linux
2013-07-16 15:08 ` [PATCH v3 3/7] at91/avr32/atmel_lcdfb: " Boris BREZILLON
2013-07-16 15:10 ` [PATCH v3 4/7] USB: gadget: atmel_usba: " Boris BREZILLON
2013-07-16 15:16 ` [PATCH v3 5/7] spi: atmel: " Boris BREZILLON
2013-07-17  8:10   ` Mark Brown
2013-07-16 15:22 ` [PATCH v3 6/7] USB: ohci-at91: add usb_clk for transition to common clk framework Boris BREZILLON
2013-07-16 16:48   ` Alan Stern
2013-07-16 17:08     ` boris brezillon
2013-07-16 18:47       ` Alan Stern
2013-07-16 19:06         ` boris brezillon
2013-07-16 17:07   ` Russell King - ARM Linux
2013-07-17 15:33   ` Alan Stern
2013-07-17 15:45     ` boris brezillon
2013-07-17 16:17       ` Alan Stern
2013-07-16 15:25 ` [PATCH v3 7/7] usb: gadget: at91_udc: " Boris BREZILLON

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=20130716171324.7d483ada@skate \
    --to=thomas.petazzoni@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 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).