MLK-22243: fsl_easrc: Add lock to protect configuration of slot
authorShengjiu Wang <shengjiu.wang@nxp.com>
Wed, 10 Jul 2019 02:55:38 +0000 (10:55 +0800)
committerShengjiu Wang <shengjiu.wang@nxp.com>
Fri, 19 Jul 2019 10:25:30 +0000 (18:25 +0800)
With multi-instance case, the fsl_easrc_config_slot will be called
in parallel, the fsl_easrc_slot is independent with context, so
we need to lock to protect the access of fsl_easrc_config_slot,
otherwise, the slot configuration will be fail for some instance
that cause "input DMA task timeout".

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
sound/soc/fsl/fsl_easrc.c

index 21262ee..cea61f7 100644 (file)
@@ -1065,6 +1065,7 @@ int fsl_easrc_config_context(struct fsl_easrc *easrc, unsigned int ctx_id)
 {
        struct fsl_easrc_context *ctx;
        struct device *dev;
+       unsigned long lock_flags;
        int ret;
 
        /* to modify prefilter coeficients, the user must perform
@@ -1094,7 +1095,9 @@ int fsl_easrc_config_context(struct fsl_easrc *easrc, unsigned int ctx_id)
        if (ret)
                return ret;
 
+       spin_lock_irqsave(&easrc->lock, lock_flags);
        ret = fsl_easrc_config_slot(easrc, ctx->index);
+       spin_unlock_irqrestore(&easrc->lock, lock_flags);
        if (ret)
                return ret;