Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6961719ybn; Mon, 30 Sep 2019 06:36:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxlBMbvoazslLd7KheAJMJ71NBLRjfaTtjSlduanV/NpuMjSffpmjMW54W3gvhjZ8Doz/E X-Received: by 2002:a50:ec81:: with SMTP id e1mr19742245edr.107.1569850585770; Mon, 30 Sep 2019 06:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569850585; cv=none; d=google.com; s=arc-20160816; b=QiUq19QyhbgYsv+e8aG2gpoRCH7DvkFO3DCiD/2SDlQYZ3t0PmcVv69nk3DT0eTp0z J0TntKGXjbVX75iBWxOdiF3Nu6OmJNQrWAOa1pyqIE1LPfnDZ1rypDv9zv1rYXimyIeV ikHklI+NiUDNOVTJQADULYh9K9OwnkcP+VeclezAY0aX/y2ipCmE3yxLa9R+mr/IXLVC 4lLaBWe5MisrL1VviCTie/ADnfRb63sdF6XV5XHYvJCMOu6tICm349qJJweReHUkHOiY a/yKzXml7DIT66Lu0SzGUTcTT5xCxwkJiaftLxVJN0mACoDYpJuX1RcJLw/fiwG1sv0n 4HEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=O2D9ideqbpI9/xsoKsJRGKKvd7dGNFrDU3BVif7IZjI=; b=UidztnHrmf7c/sIxu5udee11uV6AamN4cE/FbC/+rMgmlT3z/RDHUuxs9BmbYFjZw9 oNjvqw54MpWfZlJdKbQHCqIckmjGoISJd6AIL/sYC0P+SH6FT6DoWiSAnhWOpvtldYZb O5C0FgLvWIA2xcDaZfuytFYz5CSBigRcMrzQ+6wjY/LWxa+Xcta5dFoEuSKObR28m+PL Nyja4hVnduue9YzJ0Tiuh/nNSet6wdGnJLCnj0nOTKT72jZsFp/JcAxHmUwzRo2pnbH8 YzoH8O0k1QDiy5ll/h/CBQFU+K9FJrixbHzuB5CKWKFKIc9EeKMmrUcqVmxcyYijw4cU PdRg== 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 d17si6714946edv.76.2019.09.30.06.36.00; Mon, 30 Sep 2019 06:36:25 -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 S1731221AbfI3Nc7 (ORCPT + 99 others); Mon, 30 Sep 2019 09:32:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:55408 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729738AbfI3Nc7 (ORCPT ); Mon, 30 Sep 2019 09:32:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 20575ADD5; Mon, 30 Sep 2019 13:32:57 +0000 (UTC) Message-ID: <95f8dabea99f104336491281b88c04b58d462258.camel@suse.de> Subject: Re: [PATCH 05/11] of: Ratify of_dma_configure() interface From: Nicolas Saenz Julienne To: Christoph Hellwig , Rob Herring Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Florian Fainelli , Arnd Bergmann , Frank Rowand , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Vasut , Lorenzo Pieralisi , Oza Pawandeep , Stefan Wahren , Simon Horman , Geert Uytterhoeven , Robin Murphy Date: Mon, 30 Sep 2019 15:32:55 +0200 In-Reply-To: <20190930125752.GD12051@infradead.org> References: <20190927002455.13169-1-robh@kernel.org> <20190927002455.13169-6-robh@kernel.org> <20190930125752.GD12051@infradead.org> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-J2uUUCx3PD1vZZDm+yYn" User-Agent: Evolution 3.32.4 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-J2uUUCx3PD1vZZDm+yYn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2019-09-30 at 05:57 -0700, Christoph Hellwig wrote: > On Thu, Sep 26, 2019 at 07:24:49PM -0500, Rob Herring wrote: > > -int of_dma_configure(struct device *dev, struct device_node *np, bool > > force_dma) > > +int of_dma_configure(struct device *dev, struct device_node *parent, b= ool > > force_dma) >=20 > This creates a > 80 char line. >=20 > > { > > u64 dma_addr, paddr, size =3D 0; > > int ret; > > bool coherent; > > unsigned long offset; > > const struct iommu_ops *iommu; > > + struct device_node *np; > > u64 mask; > > =20 > > + np =3D dev->of_node; > > + if (!np) > > + np =3D parent; > > + if (!np) > > + return -ENODEV; >=20 > I have to say I find the older calling convention simpler to understand. > If we want to enforce the invariant I'd rather do that explicitly: >=20 > if (dev->of_node && np !=3D dev->of_node) > return -EINVAL; As is, this would break Freescale Layerscape fsl-mc bus' dma_configure(): static int fsl_mc_dma_configure(struct device *dev) { struct device *dma_dev =3D dev; while (dev_is_fsl_mc(dma_dev)) dma_dev =3D dma_dev->parent; return of_dma_configure(dev, dma_dev->of_node, 0); } But I think that with this series, given the fact that we now treat the lac= k of dma-ranges as a 1:1 mapping instead of an error, we could rewrite the funct= ion like this: static int fsl_mc_dma_configure(struct device *dev) { return of_dma_configure(dev, false, 0); } If needed I can test this. Regards, Nicolas --=-J2uUUCx3PD1vZZDm+yYn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAl2SBAcACgkQlfZmHno8 x/4Nzwf+LG0gvylrOQLw5x/IHv2Kgv6fhZ0lnwVON/shyUQa9M2SJ6AmcGSBXL/D poq3K8WHsQdr5e2yEyy2/lT92p6qSNbdIDjOeDyq3YskHZP6SBm/nC2l/dtDU9z6 fv3/gGTWP7ckQI4v4690kUZ4Txb3ndCWgrf7GXn7JKT7uDaqmIsiefi0S+YU8Y2L mr1dudpZ3wAnCI0uA6Za8Db6QQ2lCtGHvchLzv0dC8n4qlMMipuWGFD8y/R6BGw7 90iinlHnoJrL07DjWy4nVFPqvXnFUADXr5eXAijh+ZQ7kCFOKHwYvEB7Zrh0mEw8 bdGzfMEbXgkzUdAaLb8mb48VqHBsOg== =Byb8 -----END PGP SIGNATURE----- --=-J2uUUCx3PD1vZZDm+yYn--