mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nathan Lynch <ntl@pobox.com>
To: Bryan Wu <cooloney@gmail.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Miles Lane <miles.lane@gmail.com>,
	akpm <akpm@linux-foundation.org>,
	Linux LED Subsystem <linux-leds@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ledtrig-cpu: use spin_lock to replace mutex lock
Date: Mon, 22 Oct 2012 17:28:14 -0500	[thread overview]
Message-ID: <1350944894.19698.208.camel@doorstop.aus.2wire.com> (raw)
In-Reply-To: <CAK5ve-JAc2Env1AyZMY178QobhqmAh4euHQdPS=UH3mGGeSgLA@mail.gmail.com>

Hi Bryan,

On Thu, 2012-10-18 at 11:18 -0700, Bryan Wu wrote:
> @@ -117,14 +117,14 @@ static int __init ledtrig_cpu_init(void)
>  	for_each_possible_cpu(cpu) {
>  		struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
> 
> -		mutex_init(&trig->lock);
> +		spin_lock_init(&trig->lock);
> 
>  		snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
> 
> -		mutex_lock(&trig->lock);
> +		spin_lock(&trig->lock);
>  		led_trigger_register_simple(trig->name, &trig->_trig);
>  		trig->lock_is_inited = 1;
> -		mutex_unlock(&trig->lock);
> +		spin_unlock(&trig->lock);

I wouldn't know how to fix the original problem, but I don't think this
patch is okay -- led_trigger_register_simple() does things that
potentially sleep (GFP_KERNEL allocation, down_write), so it's not safe
to call while holding a spinlock.



  parent reply	other threads:[~2012-10-22 22:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18 18:18 Bryan Wu
2012-10-18 18:22 ` Bryan Wu
2012-10-18 18:35 ` Linus Walleij
2012-10-18 19:34   ` Bryan Wu
2012-10-22 18:59     ` Bryan Wu
2012-10-22 22:38       ` Rafael J. Wysocki
2012-10-22 23:15         ` Bryan Wu
2012-10-23  0:27           ` Rafael J. Wysocki
2012-10-22 22:28 ` Nathan Lynch [this message]
2012-10-22 23:12   ` Bryan Wu

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=1350944894.19698.208.camel@doorstop.aus.2wire.com \
    --to=ntl@pobox.com \
    --cc=akpm@linux-foundation.org \
    --cc=cooloney@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=miles.lane@gmail.com \
    --cc=rjw@sisk.pl \
    /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

all inboxes | Powered by JetHome®