From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 09CB4ECAAD1 for ; Tue, 30 Aug 2022 17:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FtYeAAW0bXfXZ5UeTHzH5MxoNewjKCn5rx2pC9U2vws=; b=RjbKi0hqcpJTU1 0yw+6HPfFOEi/kWPgToa9+fugZF7l5v7sU6Rqbu8haRY/WchcGPly2VTQrAYAtx69MhF1faMFWlxM G5lZgNS1Vrs80KPSrOILYbv8Q9Ujr6cl35EWOujFwFV4eo2jx0w48jHtFo/YPFCVeM0Y/0j2P8v+b qucnYEQq+QkxoXATkmbOoAbvtLu+vAxUB4cWw1ePr/vDIPDbVnfBRNebVP3b7nrPVf/SanQCFjIRm r+8pzcwqOq1FrbAZHMpBkxcppDZ2rSOU1aUWxNoeiKgkEZKLetPAGbtEEoksRtQr0VZ5fMcRkfK7C Bs4m7pUFK2FzleTUtp0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oT4hq-000hmS-Pm; Tue, 30 Aug 2022 17:07:18 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oT4hn-000hkk-KB for linux-arm-kernel@lists.infradead.org; Tue, 30 Aug 2022 17:07:16 +0000 Received: by mail-ej1-x62f.google.com with SMTP id nc14so18571424ejc.4 for ; Tue, 30 Aug 2022 10:07:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=AvdCfYjT/xhsGz3hwU8EJwwAxSoChuuFpkaC5m1h5Ss=; b=odLHEHirz8JquS9bzO1JvmBNKQiYSktXvBo/HPSZwI5+9jgfpG8e56+1hCimn8dxuH htDjkk9FRHx/ObuClkmPhlgFojB+QxVahURCiNy9DHFS4ABJ3P4tScBZCTvN/ePbZEoz ctFkrujcoEkbtQ3lHYKIaXdgXzpU49NZf5kk4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=AvdCfYjT/xhsGz3hwU8EJwwAxSoChuuFpkaC5m1h5Ss=; b=iaXF8PKR9CY6p5PT68hMVQWi2ASvRkkcZMIoKemH68JHDRSOk0nZg2zRnoABxrkRkv XqIB0OYcL0mcxpzQIbPNuTA8dzza8KrC/Ip4C+9oeksCfKjhlWBs6PiBLMP0tWbOozZm hG7/z0m6c65EmOUto8UYIIRRMZUu0PuyzeUyi+jPhUaVuuYBmSNfQBVfDEaMjYsRcVJs TCSIuVhsMz+wI+fEThDIb+rqCRMiPqPHkyckG0ntfwMYQTxug5hcmOG/g51MGOkXLNYD Wh6FZP97ddZhDpNiDq1E9LAXD3IYeG/r7+qLpyWeSAxgGBLxuh9/oivI47Hjtld6xK4d R8AQ== X-Gm-Message-State: ACgBeo2xl9WzDeppzYihckCKqoerHPuIiTB/OtIExnYZZ5CK7mlFo/7w PRO8Esl7xzotMCe6gc+XcbI0MQ== X-Google-Smtp-Source: AA6agR4zRA+K46Z8+ezJunedLRnzhn2M5vq7ZC/3Rxn0St3EV3VeUQYitIGl9xnwjNZD+1uEyIwg9w== X-Received: by 2002:a17:907:d0f:b0:731:5c2:a9a5 with SMTP id gn15-20020a1709070d0f00b0073105c2a9a5mr16955340ejc.413.1661879231398; Tue, 30 Aug 2022 10:07:11 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i (net-188-217-49-118.cust.vodafonedsl.it. [188.217.49.118]) by smtp.gmail.com with ESMTPSA id kv2-20020a17090778c200b0073cd7cc2c81sm6007502ejc.181.2022.08.30.10.07.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 10:07:10 -0700 (PDT) Date: Tue, 30 Aug 2022 19:07:08 +0200 From: Tommaso Merciai To: Ming Qian Cc: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] media: amphion: release m2m ctx when releasing vpu instance Message-ID: <20220830170708.GA141868@tom-ThinkPad-T14s-Gen-2i> References: <20220829053316.19400-1-ming.qian@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220829053316.19400-1-ming.qian@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220830_100715_716111_AB0800D2 X-CRM114-Status: GOOD ( 18.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Ming, Nice, from my point off view you move v4l2_m2m_ctx_release into the right position (release function). checkpatch.pl also looks good. total: 0 errors, 0 warnings, 772 lines checked Looks good to me. Reviewed-by: Tommaso Merciai Regards, Tommaso On Mon, Aug 29, 2022 at 01:33:16PM +0800, Ming Qian wrote: > release m2m ctx in the callback function that > release the vpu instance, then there is no need > to add lock around releasing m2m ctx. > > Fixes: 3cd084519c6f ("media: amphion: add vpu v4l2 m2m support") > Signed-off-by: Ming Qian > --- > drivers/media/platform/amphion/vpu_v4l2.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c > index 1f18289aa47a..99ad2f1c5a53 100644 > --- a/drivers/media/platform/amphion/vpu_v4l2.c > +++ b/drivers/media/platform/amphion/vpu_v4l2.c > @@ -688,6 +688,10 @@ static int vpu_v4l2_release(struct vpu_inst *inst) > inst->workqueue = NULL; > } > > + if (inst->fh.m2m_ctx) { > + v4l2_m2m_ctx_release(inst->fh.m2m_ctx); > + inst->fh.m2m_ctx = NULL; > + } > v4l2_ctrl_handler_free(&inst->ctrl_handler); > mutex_destroy(&inst->lock); > v4l2_fh_del(&inst->fh); > @@ -770,13 +774,6 @@ int vpu_v4l2_close(struct file *file) > > vpu_trace(vpu->dev, "tgid = %d, pid = %d, inst = %p\n", inst->tgid, inst->pid, inst); > > - vpu_inst_lock(inst); > - if (inst->fh.m2m_ctx) { > - v4l2_m2m_ctx_release(inst->fh.m2m_ctx); > - inst->fh.m2m_ctx = NULL; > - } > - vpu_inst_unlock(inst); > - > call_void_vop(inst, release); > vpu_inst_unregister(inst); > vpu_inst_put(inst); > -- > 2.37.1 > -- Tommaso Merciai Embedded Linux Engineer tommaso.merciai@amarulasolutions.com __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 info@amarulasolutions.com www.amarulasolutions.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel