提交 24298a21 编写于 作者: S Sergio Paracuellos 提交者: Greg Kroah-Hartman

staging: mt7621-gpio: change lock place in irq mask and unmask functions

Functions mediatek_gpio_irq_umask mediatek_gpio_irq_unmask are
reading and modifying registers but only the write is being hold.
It should be a complete lock instead for those which are type of
"read-modify-write". This makes more sense.
Signed-off-by: NSergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: NNeilBrown <neil@brown.name>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 7efcce04
......@@ -231,10 +231,9 @@ mediatek_gpio_irq_unmask(struct irq_data *d)
if (!rg)
return;
spin_lock_irqsave(&rg->lock, flags);
rise = mtk_gpio_r32(rg, GPIO_REG_REDGE);
fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
spin_lock_irqsave(&rg->lock, flags);
mtk_gpio_w32(rg, GPIO_REG_REDGE, rise | (PIN_MASK(pin) & rg->rising));
mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall | (PIN_MASK(pin) & rg->falling));
spin_unlock_irqrestore(&rg->lock, flags);
......@@ -253,10 +252,9 @@ mediatek_gpio_irq_mask(struct irq_data *d)
if (!rg)
return;
spin_lock_irqsave(&rg->lock, flags);
rise = mtk_gpio_r32(rg, GPIO_REG_REDGE);
fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
spin_lock_irqsave(&rg->lock, flags);
mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall & ~PIN_MASK(pin));
mtk_gpio_w32(rg, GPIO_REG_REDGE, rise & ~PIN_MASK(pin));
spin_unlock_irqrestore(&rg->lock, flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册