thermal: hisilicon: fix IRQ imbalance enabling
When register sensors into thermal zone during initialization phase, it
will report error for IRQ imbalance enabling:
[ 2.040713] WARNING: at kernel/irq/manage.c:513
[ 2.040719] Modules linked in:
[ 2.040721]
[ 2.040729] CPU: 1 PID: 804 Comm: irq/33-hisi_the Not tainted 4.5.0-rc4+ #505
[ 2.040732] Hardware name: HiKey Development Board (DT)
[ 2.040736] task: ffffffc03ae82580 ti: ffffffc0379c8000 task.ti: ffffffc0379c8000
[ 2.040745] PC is at __enable_irq+0x74/0x84
[ 2.040749] LR is at __enable_irq+0x74/0x84
This is caused by enabling IRQ twice. During sensor's initialization
it tries to enable IRQ; but this flow will be preempted by IRQ handler.
Finally introduces race condition between them and the "irq_enabled"
flag will be set to false, so when initialize another sensor, it will
call enable_irq() twice.
hisi_thermal_get_temp() hisi_thermal_alarm_irq
if (max_temp < sensor->thres_temp) {
data->irq_enabled = true;
'----------> disable_irq_nosync(irq);
data->irq_enabled = false;
enable_irq(data->irq); <--------------------------`
}
This patch is to fix this issue, firstly init "irq_enabled" flag according
to interrupt controller's setting. And also use more strictly
condition so check if need enable the interrupt.
Signed-off-by:
Leo Yan <leo.yan@linaro.org>
Loading
Please sign in to comment