Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2863351rdb; Tue, 26 Dec 2023 07:30:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4oA4XDitXAJGf1jWGgvt25EtO5Pg3RmCTp7AsYxwUSINLb0eTR7Pp+pnZ9vAzEJWhTb1N X-Received: by 2002:a05:6512:3b8f:b0:50e:7c9b:85da with SMTP id g15-20020a0565123b8f00b0050e7c9b85damr994099lfv.76.1703604655834; Tue, 26 Dec 2023 07:30:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703604655; cv=none; d=google.com; s=arc-20160816; b=Xb1cY0cbkz+AXe4R3bfvkYCQ+ZoZlaO6XmzjJf+JvNwFT5MQvXE7UfCK360p86JbLC lk2Fv2RS5+Jxm6Toz9ahayB5b+fUrO7LAHLefE/xKT6eu3vjADB/JX5GFNBHqxUk9Fv/ jkvVF72SLgeWMVP+whhoc4wvdG+GiEG5JFynFvkHTXqMTTu35dtOrQNBv6z6yj/7jr5N Tavrqv9J0hWpx1/DzOLSZ5j0NwrHqK0NvPAVkixjRxzvQAOQ4wbhWeCnPfLkik9rh1kD NuFgHtstYzxHghGvG6wNkhS8sN/+wSaAJX2Yc5yJumCjrk38BWPNFkC5MBTCp1ShyVee +uuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=iL4W3mkebgniKCp9vwIyQ/EwzBTkJUm2MPZUexlFuvg=; fh=eQqwBgXCAQlbBqatRpe9/mJbDt60TBcxud9t3usZbic=; b=wvt3NVmYf9ij6r42AywwREeZ0HGb0v/A0yxPribOLpiHKmIqlmxLG0pX8sARW8ru9N J+S9lffXgCqe70M9lIFRyBwIHEqZ3vGeztRzucbrXObqZS0ctPF5Re3rH0JOAI0HeHJM Iazp1TUhkJFfTId/x8ooTAFrsRmfPE6kydL0wYnHA/VkpbAvm3i5qBRTy1tuvjdakYcr hPMLDZuFb12HbamCo150cKyzYllOEZjaMxZlB1vLMSinn4JkpJCp5AYd+e4H7cAZml4z B5ucvvI8h2FeL5gq+wGZl1qs20z1qy+fjX/RWgzdE1gO556MiTdBkaID+Lz5Ii2ZK1mI exfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="oZ/WFyxx"; spf=pass (google.com: domain of linux-kernel+bounces-11547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11547-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kj17-20020a170907765100b00a234c0bb899si4930289ejc.979.2023.12.26.07.30.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 07:30:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="oZ/WFyxx"; spf=pass (google.com: domain of linux-kernel+bounces-11547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11547-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8E1A41F229E6 for ; Tue, 26 Dec 2023 15:30:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37F6A4F5E3; Tue, 26 Dec 2023 15:30:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oZ/WFyxx" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FF8A4EB35; Tue, 26 Dec 2023 15:30:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DB4BC433C8; Tue, 26 Dec 2023 15:30:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703604643; bh=+DXbzpdkr8gy1jHBrPxa1rews3taczzI9G1V+1FZGxA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oZ/WFyxxLo4THXqtr3qO8etYffapGkwoFzxmZmrJ+HO+EJ6IsSoL0RZexYf1h2Ydq Izm/eezZbv6G83yFPq7Mb5SSG4xHcrjagA/CudV15eu7/hyl+qjFOIvN6+hcFzn8MG pIEdHaQUuX7o0fzThtdPSc1sHsPWLcsMDMtzk242MhN8Xn7Zlwso2ZVYoJz3UjabrW 8zkSQXq8O4YiqEoWiXUAvN6FYwHIU7a8k7UULcXZauDwrbbX5XRxmiCyMaMktCC+sd O02Ey1MXSrJo5zpbSJYB843md3ZUdx8XQ3jNW5eUKoAqi/LUTcYqdUTN6dAkV0Ms9Y bmh3AIaVE76mw== Date: Tue, 26 Dec 2023 15:30:37 +0000 From: Jonathan Cameron To: Nuno =?UTF-8?B?U8Oh?= Cc: Paul Cercueil , Lars-Peter Clausen , Sumit Semwal , Christian =?UTF-8?B?S8O2bmln?= , Vinod Koul , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Michael Hennerich Subject: Re: [PATCH v5 6/8] iio: buffer-dma: Enable support for DMABUFs Message-ID: <20231226153037.1a2052f3@jic23-huawei> In-Reply-To: <219abc43b4fdd4a13b307ed2efaa0e6869e68e3f.camel@gmail.com> References: <20231219175009.65482-1-paul@crapouillou.net> <20231219175009.65482-7-paul@crapouillou.net> <20231221160445.0e3e5a8c@jic23-huawei> <219abc43b4fdd4a13b307ed2efaa0e6869e68e3f.camel@gmail.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.38; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > > > +struct iio_dma_buffer_block * > > > +iio_dma_buffer_attach_dmabuf(struct iio_buffer *buffer, > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 struct dma_buf_attachment *attach) > > > +{ > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct iio_dma_buffer_queu= e *queue =3D iio_buffer_to_queue(buffer); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct iio_dma_buffer_bloc= k *block; > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0int err; > > > + > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mutex_lock(&queue->lock); = =20 > >=20 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0guard(mutex)(&queue->lo= ck); =20 >=20 > I'm also a big fan of this new stuff but shouldn't we have a prep patch m= aking the > transition to that? Otherwise we'll end up with a mix of styles. I'm happ= y to clean > up stuff with follow up patches (even some coding style could be improved= IIRC) but > typically that's not how we handle things like this I believe... Ideally yes, I think a prep patch would make sense - but I'm not that fussed about it and follow up patches would be fine here.=20 There are cases for using this that are much easier to justify than others, so I don't really mind if simple mutex_lock(); do_something mutex_unlock(); cases are left for ever not using guard(), though I also don't mind if peop= le want to use scoped_guard() or guard for these just to be consistent. Either way is pre= tty easy to read. We'll probably also continue to gain new uses of this logic = such as the conditional guard stuff that is queued up for the next merge window = and whilst that is going on we are going to have a bit of mixed style. Jonathan >=20 > - Nuno S=C3=A1 > > =20 >=20