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 X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 678E9C4360C for ; Fri, 27 Sep 2019 00:26:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 391B020835 for ; Fri, 27 Sep 2019 00:26:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Qc7+6qRg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 391B020835 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3a5rW7ZESYPGi0jomZ9ZMLYMxNVvCjDEbY01lFD4Npo=; b=Qc7+6qRgHC+v5p 4eCt7jBG/GJRNAAL1NW3sqIZyN/i3+uJzpYz7Gm4gO+M1lI75M/e7BxM0gg3PKGhedQIbCtjlJOyA S7wWE5rHwPlTCuOipZCoACt4TV/+zwewLo4qfYM2DYuNN66r8AWVQsecX5M6476yVWPJIJfD0iYyY OSHtalDiDUCw8Q11oLFZeShu4UHXFtrWFbu3cpC7CaTesERe9uCB8LEFTb6rrFPZPA3S3nBTDoPaY IPTnaYt/Wj4tvXet72pJkX0uV/3B2nGBI3pHxfrcjsD8uc3S08EGdYWPBUoGXzjTED8xPdkhH3RbA CCoc5E8VHkogN0j/wqNQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iDe5r-0006Zi-IB; Fri, 27 Sep 2019 00:26:43 +0000 Received: from mail-oi1-f195.google.com ([209.85.167.195]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iDe4H-0004L9-M1 for linux-arm-kernel@lists.infradead.org; Fri, 27 Sep 2019 00:25:07 +0000 Received: by mail-oi1-f195.google.com with SMTP id k9so3726629oib.7 for ; Thu, 26 Sep 2019 17:25:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/FdaUd4Foou3uzALlTE4nuHwXAnVOybAVTlMM/NfMxM=; b=Y+8yx8A/Jfp0ir8lv26W4/PXePkg5OmIB9c14aH9j0aKCSohocs7D5F1+avEXbtzOD m7TLacCBOui2kV1df05WCD/FD0s1tlHeDhl9vtfxVVRcYzeQVXpvJLJUjVWqr8P7EbhZ xrdxNaSZTt+zDhM+6lUSaFNaqSIHI7brEnksYlqFRPzuSMEjJtH/928+SQaIEn4Xo0nP 8GbMPoOV92m7i8Qn98rOGHSTZVBtoBLiuBNskC9e9HfwGLNDWSyw6W+EKRhdMhulSw21 mHCc9ua4jCV9Mw5UWzY9WFcncTDHwsZtvJu1xymZEQ8tgw8iM+kP6bjKhTTm/lCaYTUP JGKw== X-Gm-Message-State: APjAAAWk18WVusAmO4ZRdIKb1ey0gDSIdFffX45V3b+Rf1k+YcjG07K1 ALXdT+30/6U5MAuBXx8wVA== X-Google-Smtp-Source: APXvYqxes6fLBSO8a/NFYc1ZhLQ2DJ3dk3ZrSbyT+sGdDBiq/Yncolj5jjG+yPBb+Q9ycO7s7d945A== X-Received: by 2002:aca:fdc9:: with SMTP id b192mr4641000oii.50.1569543904799; Thu, 26 Sep 2019 17:25:04 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id j11sm339866otk.80.2019.09.26.17.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 17:25:04 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 05/11] of: Ratify of_dma_configure() interface Date: Thu, 26 Sep 2019 19:24:49 -0500 Message-Id: <20190927002455.13169-6-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927002455.13169-1-robh@kernel.org> References: <20190927002455.13169-1-robh@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190926_172505_787386_87C73E98 X-CRM114-Status: GOOD ( 16.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 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 , Nicolas Saenz Julienne Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Robin Murphy For various DMA masters not directly represented in DT, we pass the OF node of their parent or bridge device as the master_np argument to of_dma_configure(), such that they can inherit the appropriate DMA configuration from whatever is described there. This creates an ambiguity for properties which are not valid for a device itself but only for its parent bus, since we don't know whether to start looking for those at master_np or master_np->parent. Fortunately, the de-facto interface since the prototype change in 1f5c69aa51f9 ("of: Move of_dma_configure() to device.c to help re-use") is pretty clear-cut: either master_np is redundant with dev->of_node, or dev->of_node is NULL and master_np is already the relevant parent. Let's formally ratify that so we can start relying on it. Signed-off-by: Robin Murphy Signed-off-by: Rob Herring --- drivers/of/device.c | 12 ++++++++++-- include/linux/of_device.h | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index da8158392010..a45261e21144 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -75,7 +75,8 @@ int of_device_add(struct platform_device *ofdev) /** * of_dma_configure - Setup DMA configuration * @dev: Device to apply DMA configuration - * @np: Pointer to OF node having DMA configuration + * @parent: OF node of parent device having DMA configuration, if + * @dev->of_node is NULL (ignored otherwise) * @force_dma: Whether device is to be set up by of_dma_configure() even if * DMA capability is not explicitly described by firmware. * @@ -86,15 +87,22 @@ int of_device_add(struct platform_device *ofdev) * can use a platform bus notifier and handle BUS_NOTIFY_ADD_DEVICE events * to fix up DMA configuration. */ -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, bool force_dma) { u64 dma_addr, paddr, size = 0; int ret; bool coherent; unsigned long offset; const struct iommu_ops *iommu; + struct device_node *np; u64 mask; + np = dev->of_node; + if (!np) + np = parent; + if (!np) + return -ENODEV; + ret = of_dma_get_range(np, &dma_addr, &paddr, &size); if (ret < 0) { /* diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 8d31e39dd564..a4fe418e57f6 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -56,7 +56,7 @@ static inline struct device_node *of_cpu_device_node_get(int cpu) } int of_dma_configure(struct device *dev, - struct device_node *np, + struct device_node *parent, bool force_dma); #else /* CONFIG_OF */ @@ -107,7 +107,7 @@ static inline struct device_node *of_cpu_device_node_get(int cpu) } static inline int of_dma_configure(struct device *dev, - struct device_node *np, + struct device_node *parent, bool force_dma) { return 0; -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel