Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7979026ybi; Thu, 6 Jun 2019 04:51:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdxHTXueRHbobOVWYnn/itiqDnmanKMY+8q+/TgdSGD3ZqDAU5uSF2nAyf3Zdbu16ioUJP X-Received: by 2002:a63:b07:: with SMTP id 7mr3025992pgl.21.1559821904132; Thu, 06 Jun 2019 04:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559821904; cv=none; d=google.com; s=arc-20160816; b=pLfM2aWdfa9JRJXtPeO4tdN2ozIpOWiFj5IrbokyWTeTRUpXJik4F5xcxEkLI+yX57 ttU/SxJG6Qu6TOF/ac85laHn/vGDLJTugrmyeL4bPRgxznz2NW7VKqJR23rWf2GK/WKA Ctvudl2SRjPhvuhpjHs1x8+ctYlmXaMiSQ3GCMQn5B0V6qHro3ap2NT/sd5z06mZK4Tm Mt3S14bfzktCZH4kdseDdQdkSVHj7Ldt3zfd9CtIm+NlpQhKUiubeQNg1BQJCrzDEfAV kDw9s71Bauh86nvoZaC0x8yM/VbVnC2SnUtTSppNxr74IOumIg91YeKfdq2Ov5Xh3hrJ Vz3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=12BcY+6Sd4Zt533Ccxl5kW0J15l4gAOuDSV/eQF9Bcc=; b=n6V9lbfeet7m+Qd3nWQy5h8MIagauzD6DO8od4sMW4x4H7lYGtE2JbunqckknsmxXB KWElSeZSWX1ew6F+ybq/QH6nwpm0ZzrXhFjxkpZcp4OID4INoL7NY6ca4DMdjYpVsitV QCs83C9Sj6MFSdwTu3dcWhuReMS8fqbda1j2t1TAYJRb+AQ9c4Gt4REjATWSgRTUszjz nKLLlhHW84TDYA8LsdxzU/M07vG6tGp1yfyh/Ym1kAd3hF1voxnSFx/Bs4ebWiWP2Tmd lV3Ot3XlWpuPDHlZNG8FdGwURwV5rydNN8qSSWt71tC40swf1d4kQ9vqjPaHkHy8iB0o Wlaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4si1946834pgc.213.2019.06.06.04.51.26; Thu, 06 Jun 2019 04:51:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727204AbfFFIdU (ORCPT + 99 others); Thu, 6 Jun 2019 04:33:20 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:42799 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726092AbfFFIdU (ORCPT ); Thu, 6 Jun 2019 04:33:20 -0400 Received: from localhost (aaubervilliers-681-1-24-139.w90-88.abo.wanadoo.fr [90.88.144.139]) (Authenticated sender: maxime.ripard@bootlin.com) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 6C6F510001B; Thu, 6 Jun 2019 08:33:08 +0000 (UTC) Date: Thu, 6 Jun 2019 10:33:07 +0200 From: Maxime Ripard To: Jernej =?utf-8?Q?=C5=A0krabec?= Cc: paul.kocialkowski@bootlin.com, wens@csie.org, mchehab@kernel.org, gregkh@linuxfoundation.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/7] media: cedrus: Add infra for extra buffers connected to capture buffers Message-ID: <20190606083307.b5zpk4n6x3w6mtmb@flea> References: <20190530211516.1891-1-jernej.skrabec@siol.net> <20190530211516.1891-7-jernej.skrabec@siol.net> <20190603121859.sbphcjy75kmed6oc@flea> <3029072.frl2UAsRGt@jernej-laptop> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="llwlg2xtnnijika2" Content-Disposition: inline In-Reply-To: <3029072.frl2UAsRGt@jernej-laptop> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --llwlg2xtnnijika2 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 03, 2019 at 05:48:25PM +0200, Jernej =C5=A0krabec wrote: > Dne ponedeljek, 03. junij 2019 ob 14:18:59 CEST je Maxime Ripard napisal(= a): > > > +static void cedrus_buf_cleanup(struct vb2_buffer *vb) > > > +{ > > > + struct vb2_queue *vq =3D vb->vb2_queue; > > > + > > > + if (!V4L2_TYPE_IS_OUTPUT(vq->type)) { > > > + struct cedrus_ctx *ctx =3D vb2_get_drv_priv(vq); > > > + struct cedrus_buffer *cedrus_buf; > > > + > > > + cedrus_buf =3D vb2_to_cedrus_buffer(vq->bufs[vb->index]); > > > + > > > + if (cedrus_buf->extra_buf_size) > > > + dma_free_coherent(ctx->dev->dev, > > > + cedrus_buf- > >extra_buf_size, > > > + cedrus_buf- > >extra_buf, > > > + cedrus_buf- > >extra_buf_dma); > > > + } > > > +} > > > + > > > > I'm really not a fan of allocating something somewhere, and freeing it > > somewhere else. Making sure you don't leak something is hard enough to > > not have some non-trivial allocation scheme. > > Ok, what about introducing two new optional methods in engine callbacks, > buffer_init and buffer_destroy, which would be called from cedrus_buf_ini= t() and > cedrus_buf_cleanup(), respectively. That way all (de)allocation logic sta= ys > within the same engine. Yep, that would work for me. Thanks! Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --llwlg2xtnnijika2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXPjPwwAKCRDj7w1vZxhR xfVpAQCOr8fs3rk1qqMT7K32xwhOKrfkpEzeOlKL8hYuHFgkPQEA+ZYtxUfOTSQu 8EDER1DVGqjSGhBpL356m0j1JSeHNgM= =Hz+3 -----END PGP SIGNATURE----- --llwlg2xtnnijika2--