diff options
author | Liu Ying <gnuiyl@gmail.com> | 2016-03-14 04:10:08 -0400 |
---|---|---|
committer | Philipp Zabel <p.zabel@pengutronix.de> | 2016-03-31 05:24:30 -0400 |
commit | 32c26a56af3ae823a883e926b96e3ff00854e6a8 (patch) | |
tree | 6e7e595a598a4921a2fb047a4bbf4a2e56ddd156 | |
parent | 1cc9daea2a79720cdd8b13ce97515bf1b2b41939 (diff) |
gpu: ipu-v3: ipu-dmfc: Protect function ipu_dmfc_init_channel() with mutex
To avoid race condition issue, we should protect the function
ipu_dmfc_init_channel() with the mutex dmfc->priv->mutex, since it
configures the register DMFC_GENERAL1 at runtime which contains
several control bits for various display channels. This matches
better with fine grained locking logic in upper layer.
Signed-off-by: Liu Ying <gnuiyl@gmail.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r-- | drivers/gpu/ipu-v3/ipu-dmfc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/ipu-v3/ipu-dmfc.c b/drivers/gpu/ipu-v3/ipu-dmfc.c index 042c3958e2a0..129ccfa9d1d6 100644 --- a/drivers/gpu/ipu-v3/ipu-dmfc.c +++ b/drivers/gpu/ipu-v3/ipu-dmfc.c | |||
@@ -355,6 +355,8 @@ int ipu_dmfc_init_channel(struct dmfc_channel *dmfc, int width) | |||
355 | struct ipu_dmfc_priv *priv = dmfc->priv; | 355 | struct ipu_dmfc_priv *priv = dmfc->priv; |
356 | u32 dmfc_gen1; | 356 | u32 dmfc_gen1; |
357 | 357 | ||
358 | mutex_lock(&priv->mutex); | ||
359 | |||
358 | dmfc_gen1 = readl(priv->base + DMFC_GENERAL1); | 360 | dmfc_gen1 = readl(priv->base + DMFC_GENERAL1); |
359 | 361 | ||
360 | if ((dmfc->slots * 64 * 4) / width > dmfc->data->max_fifo_lines) | 362 | if ((dmfc->slots * 64 * 4) / width > dmfc->data->max_fifo_lines) |
@@ -364,6 +366,8 @@ int ipu_dmfc_init_channel(struct dmfc_channel *dmfc, int width) | |||
364 | 366 | ||
365 | writel(dmfc_gen1, priv->base + DMFC_GENERAL1); | 367 | writel(dmfc_gen1, priv->base + DMFC_GENERAL1); |
366 | 368 | ||
369 | mutex_unlock(&priv->mutex); | ||
370 | |||
367 | return 0; | 371 | return 0; |
368 | } | 372 | } |
369 | EXPORT_SYMBOL_GPL(ipu_dmfc_init_channel); | 373 | EXPORT_SYMBOL_GPL(ipu_dmfc_init_channel); |