Skip to content

Commit 768ac4f

Browse files
claudiubezneabroonie
authored andcommitted
ASoC: mchp-spdifrx: disable end of block interrupt on failures
Disable end of block interrupt in case of wait for completion timeout or errors to undo previously enable operation (done in mchp_spdifrx_isr_blockend_en()). Otherwise we can end up with an unbalanced reference counter for this interrupt. Fixes: ef265c5 ("ASoC: mchp-spdifrx: add driver for SPDIF RX") Signed-off-by: Claudiu Beznea <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent f2906aa commit 768ac4f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sound/soc/atmel/mchp-spdifrx.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,15 +288,17 @@ static void mchp_spdifrx_isr_blockend_en(struct mchp_spdifrx_dev *dev)
288288
spin_unlock_irqrestore(&dev->blockend_lock, flags);
289289
}
290290

291-
/* called from atomic context only */
291+
/* called from atomic/non-atomic context */
292292
static void mchp_spdifrx_isr_blockend_dis(struct mchp_spdifrx_dev *dev)
293293
{
294-
spin_lock(&dev->blockend_lock);
294+
unsigned long flags;
295+
296+
spin_lock_irqsave(&dev->blockend_lock, flags);
295297
dev->blockend_refcount--;
296298
/* don't enable BLOCKEND interrupt if it's already enabled */
297299
if (dev->blockend_refcount == 0)
298300
regmap_write(dev->regmap, SPDIFRX_IDR, SPDIFRX_IR_BLOCKEND);
299-
spin_unlock(&dev->blockend_lock);
301+
spin_unlock_irqrestore(&dev->blockend_lock, flags);
300302
}
301303

302304
static irqreturn_t mchp_spdif_interrupt(int irq, void *dev_id)
@@ -575,6 +577,7 @@ static int mchp_spdifrx_subcode_ch_get(struct mchp_spdifrx_dev *dev,
575577
if (ret <= 0) {
576578
dev_dbg(dev->dev, "user data for channel %d timeout\n",
577579
channel);
580+
mchp_spdifrx_isr_blockend_dis(dev);
578581
return ret;
579582
}
580583

0 commit comments

Comments
 (0)