From nobody Mon Feb 9 18:18:27 2026 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1569385043; cv=none; d=zoho.com; s=zohoarc; b=BC25FXgR4e1A8b9guN6qiiwx9mqy/9kaNeV4h4cIAWi6us/skb3nAVeTPwxFji4ifedqug8HPvQ1bJe18pAE9d+DtFXrUIGblOUIr29v9t/wnyVbaTQJZTdJorEvvTBtclARutveVxegl+646PYs6Tb0A9S3ikwvArtYTRecZAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569385043; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=oagCNKJ/SZXLScnipmge4nHsBK4g6ViGQr3+FUh34cE=; b=d2juSDrstdTq5MDkM/ZOIIGrn/ZsV5F8b/vjsn+/7k4LkzAOI2qKJE9Xi/4Rlpn+2ZDwisy3afqsXm4mnXKU5IzIXU4kg0lrcFgV3tH/7BCD0yaNm5fJaxo9eEhbcS3sAG+ZkM9yN3oqFugq5kV2Yy0v4MrCgGLxLBiWgL122f0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1569385043935752.9605654736941; Tue, 24 Sep 2019 21:17:23 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCyj2-0000RU-0X; Wed, 25 Sep 2019 04:16:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iCpJ9-0000FG-DE for xen-devel@lists.xenproject.org; Tue, 24 Sep 2019 18:13:03 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by localhost (Halon) with ESMTPS id ece94744-def6-11e9-b588-bc764e2007e4; Tue, 24 Sep 2019 18:12:53 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A1202AF03; Tue, 24 Sep 2019 18:12:52 +0000 (UTC) X-Inumbo-ID: ece94744-def6-11e9-b588-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Nicolas Saenz Julienne To: robh+dt@kernel.org, devicetree@vger.kernel.org, frowand.list@gmail.com, linux-arm-kernel@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, xen-devel@lists.xenproject.org, linux-tegra@vger.kernel.org, linux-media@vger.kernel.org, linux-pci@vger.kernel.org Date: Tue, 24 Sep 2019 20:12:33 +0200 Message-Id: <20190924181244.7159-3-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190924181244.7159-1-nsaenzjulienne@suse.de> References: <20190924181244.7159-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 25 Sep 2019 04:16:20 +0000 Subject: [Xen-devel] [PATCH 02/11] of: base: introduce __of_n_*_cells_parent() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, mbrugger@suse.com, wahrenst@gmx.net, james.quinlan@broadcom.com, robin.murphy@arm.com, Nicolas Saenz Julienne Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Master PCI devices might not appear in the device tree, yet they still need to get the underlying cells properties in order to calculate the bus DMA constraints. This conflicts with of_n_*_cells() as it's designed under the assumption it'll receive a device OF node. Create __of_n_*_cells_parent() in order to deal with this limitation. For now, it'll only be available privately to OF code. Signed-off-by: Nicolas Saenz Julienne --- drivers/of/base.c | 44 +++++++++++++++++++++++++++++------------ drivers/of/of_private.h | 3 +++ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 1d667eb730e1..94f83051910c 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -86,34 +86,52 @@ static bool __of_node_is_type(const struct device_node = *np, const char *type) return np && match && type && !strcmp(match, type); } =20 -int of_n_addr_cells(struct device_node *np) +int __of_n_addr_cells_parent(struct device_node *parent) { u32 cells; =20 - do { - if (np->parent) - np =3D np->parent; - if (!of_property_read_u32(np, "#address-cells", &cells)) + while (parent) { + if (!of_property_read_u32(parent, "#address-cells", &cells)) return cells; - } while (np->parent); + + parent =3D parent->parent; + } + /* No #address-cells property for the root node */ return OF_ROOT_NODE_ADDR_CELLS_DEFAULT; } + +int of_n_addr_cells(struct device_node *np) +{ + if (np->parent) + np =3D np->parent; + + return __of_n_addr_cells_parent(np); +} EXPORT_SYMBOL(of_n_addr_cells); =20 -int of_n_size_cells(struct device_node *np) +int __of_n_size_cells_parent(struct device_node *parent) { u32 cells; =20 - do { - if (np->parent) - np =3D np->parent; - if (!of_property_read_u32(np, "#size-cells", &cells)) + while (parent) { + if (!of_property_read_u32(parent, "#size-cells", &cells)) return cells; - } while (np->parent); - /* No #size-cells property for the root node */ + + parent =3D parent->parent; + } + + /* No #address-cells property for the root node */ return OF_ROOT_NODE_SIZE_CELLS_DEFAULT; } + +int of_n_size_cells(struct device_node *np) +{ + if (np->parent) + np =3D np->parent; + + return __of_n_size_cells_parent(np); +} EXPORT_SYMBOL(of_n_size_cells); =20 #ifdef CONFIG_NUMA diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h index 24786818e32e..b528304be244 100644 --- a/drivers/of/of_private.h +++ b/drivers/of/of_private.h @@ -39,6 +39,9 @@ extern struct mutex of_mutex; extern struct list_head aliases_lookup; extern struct kset *of_kset; =20 +int __of_n_addr_cells_parent(struct device_node *parent); +int __of_n_size_cells_parent(struct device_node *parent); + #if defined(CONFIG_OF_DYNAMIC) extern int of_property_notify(int action, struct device_node *np, struct property *prop, struct property *old_prop); --=20 2.23.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel