Re: [PATCH] ledtrig-cpu: use spin_lock to replace mutex lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


--
To unsubscribe from this list: send the line "unsubscribe linux-leds" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux