Merge branch 'fixes-for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
Pull LED fix from Bryan Wu. * 'fixes-for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: ledtrig-cpu: kill useless mutex to fix sleep in atomic context
This commit is contained in:
Коммит
9dce781768
|
@ -33,8 +33,6 @@
|
||||||
struct led_trigger_cpu {
|
struct led_trigger_cpu {
|
||||||
char name[MAX_NAME_LEN];
|
char name[MAX_NAME_LEN];
|
||||||
struct led_trigger *_trig;
|
struct led_trigger *_trig;
|
||||||
struct mutex lock;
|
|
||||||
int lock_is_inited;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static DEFINE_PER_CPU(struct led_trigger_cpu, cpu_trig);
|
static DEFINE_PER_CPU(struct led_trigger_cpu, cpu_trig);
|
||||||
|
@ -50,12 +48,6 @@ void ledtrig_cpu(enum cpu_led_event ledevt)
|
||||||
{
|
{
|
||||||
struct led_trigger_cpu *trig = &__get_cpu_var(cpu_trig);
|
struct led_trigger_cpu *trig = &__get_cpu_var(cpu_trig);
|
||||||
|
|
||||||
/* mutex lock should be initialized before calling mutex_call() */
|
|
||||||
if (!trig->lock_is_inited)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mutex_lock(&trig->lock);
|
|
||||||
|
|
||||||
/* Locate the correct CPU LED */
|
/* Locate the correct CPU LED */
|
||||||
switch (ledevt) {
|
switch (ledevt) {
|
||||||
case CPU_LED_IDLE_END:
|
case CPU_LED_IDLE_END:
|
||||||
|
@ -75,8 +67,6 @@ void ledtrig_cpu(enum cpu_led_event ledevt)
|
||||||
/* Will leave the LED as it is */
|
/* Will leave the LED as it is */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&trig->lock);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ledtrig_cpu);
|
EXPORT_SYMBOL(ledtrig_cpu);
|
||||||
|
|
||||||
|
@ -117,14 +107,9 @@ static int __init ledtrig_cpu_init(void)
|
||||||
for_each_possible_cpu(cpu) {
|
for_each_possible_cpu(cpu) {
|
||||||
struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
|
struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
|
||||||
|
|
||||||
mutex_init(&trig->lock);
|
|
||||||
|
|
||||||
snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
|
snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
|
||||||
|
|
||||||
mutex_lock(&trig->lock);
|
|
||||||
led_trigger_register_simple(trig->name, &trig->_trig);
|
led_trigger_register_simple(trig->name, &trig->_trig);
|
||||||
trig->lock_is_inited = 1;
|
|
||||||
mutex_unlock(&trig->lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
register_syscore_ops(&ledtrig_cpu_syscore_ops);
|
register_syscore_ops(&ledtrig_cpu_syscore_ops);
|
||||||
|
@ -142,15 +127,9 @@ static void __exit ledtrig_cpu_exit(void)
|
||||||
for_each_possible_cpu(cpu) {
|
for_each_possible_cpu(cpu) {
|
||||||
struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
|
struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
|
||||||
|
|
||||||
mutex_lock(&trig->lock);
|
|
||||||
|
|
||||||
led_trigger_unregister_simple(trig->_trig);
|
led_trigger_unregister_simple(trig->_trig);
|
||||||
trig->_trig = NULL;
|
trig->_trig = NULL;
|
||||||
memset(trig->name, 0, MAX_NAME_LEN);
|
memset(trig->name, 0, MAX_NAME_LEN);
|
||||||
trig->lock_is_inited = 0;
|
|
||||||
|
|
||||||
mutex_unlock(&trig->lock);
|
|
||||||
mutex_destroy(&trig->lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unregister_syscore_ops(&ledtrig_cpu_syscore_ops);
|
unregister_syscore_ops(&ledtrig_cpu_syscore_ops);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче