From: bui duc phuc Date: Wed, 10 Jun 2026 10:20:12 +0000 (+0700) Subject: ASoC: mediatek: common: mtk-afe-fe-dai: Use guard() for mutex locks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9475859429e4d8957e8050b1156af6f88efa5ed1;p=thirdparty%2Flinux.git ASoC: mediatek: common: mtk-afe-fe-dai: Use guard() for mutex locks Clean up the code using guard() for mutex locks. Merely code refactoring, and no behavior change. Signed-off-by: bui duc phuc Link: https://patch.msgid.link/20260610102021.83273-2-phucduc.bui@gmail.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c index 3809068f5620b..2a20fa5dba492 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c @@ -292,28 +292,24 @@ int mtk_dynamic_irq_acquire(struct mtk_base_afe *afe) { int i; - mutex_lock(&afe->irq_alloc_lock); + guard(mutex)(&afe->irq_alloc_lock); for (i = 0; i < afe->irqs_size; ++i) { if (afe->irqs[i].irq_occupyed == 0) { afe->irqs[i].irq_occupyed = 1; - mutex_unlock(&afe->irq_alloc_lock); return i; } } - mutex_unlock(&afe->irq_alloc_lock); return afe->irqs_size; } EXPORT_SYMBOL_GPL(mtk_dynamic_irq_acquire); int mtk_dynamic_irq_release(struct mtk_base_afe *afe, int irq_id) { - mutex_lock(&afe->irq_alloc_lock); + guard(mutex)(&afe->irq_alloc_lock); if (irq_id >= 0 && irq_id < afe->irqs_size) { afe->irqs[irq_id].irq_occupyed = 0; - mutex_unlock(&afe->irq_alloc_lock); return 0; } - mutex_unlock(&afe->irq_alloc_lock); return -EINVAL; } EXPORT_SYMBOL_GPL(mtk_dynamic_irq_release);