diff options
author | Sergio Paracuellos <sergio.paracuellos@gmail.com> | 2018-05-25 19:54:51 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-06-01 12:17:05 +0300 |
commit | 24298a218e321cf54a5d7d7dce9bd0d393b2ac0c (patch) | |
tree | 293af41e102583939f2302c745ca55dace389504 /drivers/staging | |
parent | 7efcce04309260e8088e89ca2c0a33cff452ac5c (diff) | |
download | linux-24298a218e321cf54a5d7d7dce9bd0d393b2ac0c.tar.xz |
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: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/mt7621-gpio/gpio-mt7621.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c b/drivers/staging/mt7621-gpio/gpio-mt7621.c index 143268a866c2..c96ae678e91f 100644 --- a/drivers/staging/mt7621-gpio/gpio-mt7621.c +++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c @@ -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); |