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: 7308291 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A6B199F302 for ; Thu, 1 Oct 2015 12:05:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1C212063F 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 0EF4F2060A for ; Thu, 1 Oct 2015 12:05:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933299AbbJAMFR (ORCPT ); Thu, 1 Oct 2015 08:05:17 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:37131 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933332AbbJAMFN (ORCPT ); Thu, 1 Oct 2015 08:05:13 -0400 Received: by wicfx3 with SMTP id fx3so25076406wic.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=ZV8DKwrCfJ84mJtuSE8SxeksWoa5gvBiHE5eT7pDswlM6aJHICFB5k8b8pcwOMVVG3 9Aop8piLkBQ3HKp3j5fGp6pj1efCUNWu3EAVO5Fn9nCzY7Fa8rugTRdZ8PDQgOrQRnOf AsMgxlhbiyqL6zx5uaiFY85yFcKSg3GE1R05VVW3fyP+n4x913I+VXY5IjQw7h9/Tj/Z C3Aas/16mS3MG7Hv1Clv8oyAbdy7tBwQUD8hdjsdGsin7g5PqCLevmia0Ee5DUJMUtNR HDfzDwC9n4Q9Mds0EcDPwtt0AOJfLOP+afx1yU5UUQDK67f8CgUPPc05//ThlQsSz2mf 28ZA== X-Gm-Message-State: ALoCoQl/rPR2hOKLp4TqvwRyyxQd3XEa+nt6eXMIsWPmZ4Qr9Jw1sk3YxvJdN/3g9kdqJtOz/hu2 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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=unavailable 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; }