Commit 317b2099 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Lee Jones

mfd: ti_am335x_tscadc: Avoid possible deadlock of reg_lock

Since the addition of continuous sampling mode and shared irq support,
the reg_lock lock can be taken with and without interrupts. This patch
uses the *_irq* variant which should be used in order to avaoid a deadlock.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent df73de9b
...@@ -56,21 +56,25 @@ EXPORT_SYMBOL_GPL(am335x_tsc_se_update); ...@@ -56,21 +56,25 @@ EXPORT_SYMBOL_GPL(am335x_tsc_se_update);
void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val) void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val)
{ {
spin_lock(&tsadc->reg_lock); unsigned long flags;
spin_lock_irqsave(&tsadc->reg_lock, flags);
tsadc->reg_se_cache = tscadc_readl(tsadc, REG_SE); tsadc->reg_se_cache = tscadc_readl(tsadc, REG_SE);
tsadc->reg_se_cache |= val; tsadc->reg_se_cache |= val;
am335x_tsc_se_update(tsadc); am335x_tsc_se_update(tsadc);
spin_unlock(&tsadc->reg_lock); spin_unlock_irqrestore(&tsadc->reg_lock, flags);
} }
EXPORT_SYMBOL_GPL(am335x_tsc_se_set); EXPORT_SYMBOL_GPL(am335x_tsc_se_set);
void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val) void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val)
{ {
spin_lock(&tsadc->reg_lock); unsigned long flags;
spin_lock_irqsave(&tsadc->reg_lock, flags);
tsadc->reg_se_cache = tscadc_readl(tsadc, REG_SE); tsadc->reg_se_cache = tscadc_readl(tsadc, REG_SE);
tsadc->reg_se_cache &= ~val; tsadc->reg_se_cache &= ~val;
am335x_tsc_se_update(tsadc); am335x_tsc_se_update(tsadc);
spin_unlock(&tsadc->reg_lock); spin_unlock_irqrestore(&tsadc->reg_lock, flags);
} }
EXPORT_SYMBOL_GPL(am335x_tsc_se_clr); EXPORT_SYMBOL_GPL(am335x_tsc_se_clr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment