1. seandroid
  2. Untitled project
  3. kernel/exynos

Commits

Dima Zavin  committed eb3fa53

media: exynos: mfc: don't drop wakeup source in multiple context case

Wakeup sources aren't ref counted, but we we always dropping ours in
release. If there were multiple contexts open, it would allow suspend
even though the MFC was still in use. Although, by itself, it's not a
problem, it did not have the intended effect.

Bug: 7261738
Change-Id: Id42006b2cff0e84711047a149a8654ed950f012a
Signed-off-by: Dima Zavin <dima@android.com>

  • Participants
  • Parent commits 1bfd620
  • Branches android-exynos-manta-3.4-jb-mr1.1, seandroid-exynos-manta-3.4-jb-mr1.1

Comments (0)

Files changed (1)

File drivers/media/video/exynos/mfc/s5p_mfc.c

View file
 
 	mfc_debug_enter();
 
-	__pm_stay_awake(&dev->mfc_ws);
-
 	node = s5p_mfc_get_node_type(file);
 	if (node == MFCNODE_INVALID) {
 		mfc_err("cannot specify node type\n");
 	}
 #endif
 	dev->num_inst++;	/* It is guarded by mfc_mutex in vfd */
+	if (dev->num_inst == 1)
+		__pm_stay_awake(&dev->mfc_ws);
 
 	/* Allocate memory for context */
 	ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
 
 err_ctx_alloc:
 	dev->num_inst--;
+	if (dev->num_inst == 0)
+		__pm_relax(&dev->mfc_ws);
 
 #ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
 err_drm_playback:
 #endif
 err_node_type:
-	__pm_relax(&dev->mfc_ws);
 	mfc_debug_leave();
 
 	return ret;
 
 		mfc_debug(2, "power off\n");
 		s5p_mfc_power_off();
+		__pm_relax(&dev->mfc_ws);
+
 	}
 
 	if (ctx->type == MFCINST_DECODER)
 	dev->ctx[ctx->num] = 0;
 	kfree(ctx);
 
-	__pm_relax(&dev->mfc_ws);
-
 	mfc_debug_leave();
 
 	return 0;