media: s5p-mfc: fix close sequence
authorMarek Szyprowski <m.szyprowski@samsung.com>
Fri, 1 Jul 2016 07:04:31 +0000 (09:04 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 4 Aug 2016 04:31:20 +0000 (13:31 +0900)
Turn power off after disabling clocks.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ibd5df109f2664edea7a42fc797945bd31c11f1d2

drivers/media/platform/s5p-mfc/s5p_mfc.c

index 2724fb96b2c829e29afe21e42862af3a3a518f15..a955eec715485b8adaa6d02309df7764b5ba27df 100644 (file)
@@ -941,6 +941,8 @@ static int s5p_mfc_release(struct file *file)
        if (dev->curr_ctx == ctx->num)
                clear_bit(0, &dev->hw_lock);
        dev->num_inst--;
+       mfc_debug(2, "Shutting down clock\n");
+       s5p_mfc_clock_off();
        if (dev->num_inst == 0) {
                mfc_debug(2, "Last instance\n");
                s5p_mfc_deinit_hw(dev);
@@ -948,8 +950,6 @@ static int s5p_mfc_release(struct file *file)
                if (s5p_mfc_power_off() < 0)
                        mfc_err("Power off failed\n");
        }
-       mfc_debug(2, "Shutting down clock\n");
-       s5p_mfc_clock_off();
        dev->ctx[ctx->num] = NULL;
        s5p_mfc_dec_ctrls_delete(ctx);
        v4l2_fh_del(&ctx->fh);