From patchwork Thu Oct 1 12:03:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Ulyanov X-Patchwork-Id: 7308281 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D4FADBEEA4 for ; Thu, 1 Oct 2015 12:05:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A940205D8 for ; Thu, 1 Oct 2015 12:05:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2DF9C2063A for ; Thu, 1 Oct 2015 12:05:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933325AbbJAMFR (ORCPT ); Thu, 1 Oct 2015 08:05:17 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:35099 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933134AbbJAMFN (ORCPT ); Thu, 1 Oct 2015 08:05:13 -0400 Received: by wicge5 with SMTP id ge5so26485876wic.0 for ; Thu, 01 Oct 2015 05:05:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Uwiq70WoUdj1/v+UPA9ZpKCbMY0EhjLwa2H4YW4yS44=; b=gu0i6ibQCmXRrK/yKrddTZZu8su6oQLYmtf9xbiM/fA4W//vfP/mhpWqwtVSRZXClV Lmrd/fk9kfX+3fYWLxxq5Dihjrf080DirfG2GXCsewIvECuTKy2mHbDxMjamRtu3AyJK qOaUE4XX3bkoBe9Iql053GeG8SPbjTXcC+oXls/RZKtgduYP7nUZ/pxkJc9M+2omaxjD NUeaCmwMJ8G++QhMQINa8XlonpIZFhfXqVcvZEkv8Fz0rf7VX2FpWKQFgmzOpd8W0Eg2 BIqQxA9hc5BBGJSBlj+82g/XZ3z/mbXiSo13vj/qAgG4G2MmM6uCF8NuHicmxNUZquWE YUkg== X-Gm-Message-State: ALoCoQkHDVq1vwwSGbVvqMQqohCSyk0c1XdjBYKYLs5+78sv+zvEeYXtuyJ9is6HG3m4WPgnIGUg X-Received: by 10.194.58.177 with SMTP id s17mr11905438wjq.102.1443701112477; Thu, 01 Oct 2015 05:05:12 -0700 (PDT) Received: from localhost.localdomain ([85.106.4.244]) by smtp.gmail.com with ESMTPSA id x9sm5776346wjf.44.2015.10.01.05.05.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Oct 2015 05:05:11 -0700 (PDT) From: Mikhail Ulyanov To: hverkuil@xs4all.nl, horms@verge.net.au, magnus.damm@gmail.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, mchehab@osg.samsung.com Cc: laurent.pinchart@ideasonboard.com, j.anaszewski@samsung.com, kamil@wypas.org, sergei.shtylyov@cogentembedded.com, devicetree@vger.kernel.org, linux-media@vger.kernel.org, linux-sh@vger.kernel.org, Mikhail Ulyanov Subject: [PATCH 2/2] V4L2: platform: rcar_jpu: switch off clock on release later Date: Thu, 1 Oct 2015 15:03:32 +0300 Message-Id: <1443701012-20730-3-git-send-email-mikhail.ulyanov@cogentembedded.com> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1443701012-20730-1-git-send-email-mikhail.ulyanov@cogentembedded.com> References: <1443701012-20730-1-git-send-email-mikhail.ulyanov@cogentembedded.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Give JPU peripheral chance to finish current job. Don't switch off clock until context release. Signed-off-by: Mikhail Ulyanov --- drivers/media/platform/rcar_jpu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/rcar_jpu.c b/drivers/media/platform/rcar_jpu.c index 039bbbc..aa327e6 100644 --- a/drivers/media/platform/rcar_jpu.c +++ b/drivers/media/platform/rcar_jpu.c @@ -1296,17 +1296,17 @@ static int jpu_release(struct file *file) struct jpu *jpu = video_drvdata(file); struct jpu_ctx *ctx = fh_to_ctx(file->private_data); - mutex_lock(&jpu->mutex); - if (--jpu->ref_count == 0) - clk_disable_unprepare(jpu->clk); - mutex_unlock(&jpu->mutex); - v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); v4l2_ctrl_handler_free(&ctx->ctrl_handler); v4l2_fh_del(&ctx->fh); v4l2_fh_exit(&ctx->fh); kfree(ctx); + mutex_lock(&jpu->mutex); + if (--jpu->ref_count == 0) + clk_disable_unprepare(jpu->clk); + mutex_unlock(&jpu->mutex); + return 0; }