]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: mediatek: common: mtk-afe-fe-dai: Use guard() for mutex locks
authorbui duc phuc <phucduc.bui@gmail.com>
Wed, 10 Jun 2026 10:20:12 +0000 (17:20 +0700)
committerMark Brown <broonie@kernel.org>
Thu, 11 Jun 2026 19:59:13 +0000 (20:59 +0100)
Clean up the code using guard() for mutex locks.
Merely code refactoring, and no behavior change.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260610102021.83273-2-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/mediatek/common/mtk-afe-fe-dai.c

index 3809068f5620bdeb02d8187ee49bd34e8818f518..2a20fa5dba492e154852af101ee96e4d07105c4b 100644 (file)
@@ -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);