From: Thierry Reding <thierry.reding@gmail.com>
To: Rob Herring <robh+dt@kernel.org>, Frank Rowand <frowand.list@gmail.com>
Cc: devicetree@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] of: reserved-memory: Support memory-regions property
Date: Fri, 3 Apr 2020 20:56:38 +0200 [thread overview]
Message-ID: <20200403185640.118569-3-thierry.reding@gmail.com> (raw)
In-Reply-To: <20200403185640.118569-1-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.com>
Implement the memory-regions property as the preferred way to get at the
list of reserved memory regions referenced by a device. For backwards-
compatibility, fallback to the memory-region property.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/of/of_reserved_mem.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 1a84bc0d5fa8..62a35422c28d 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -302,9 +302,9 @@ static DEFINE_MUTEX(of_rmem_assigned_device_mutex);
* @idx: Index of selected region
*
* This function assigns respective DMA-mapping operations based on reserved
- * memory region specified by 'memory-region' property in @np node to the @dev
- * device. When driver needs to use more than one reserved memory region, it
- * should allocate child devices and initialize regions by name for each of
+ * memory region specified by 'memory-region(s)' property in @np node to the
+ * @dev device. When driver needs to use more than one reserved memory region,
+ * it should allocate child devices and initialize regions by name for each of
* child device.
*
* Returns error code or zero on success.
@@ -320,7 +320,10 @@ int of_reserved_mem_device_init_by_idx(struct device *dev,
if (!np || !dev)
return -EINVAL;
- target = of_parse_phandle(np, "memory-region", idx);
+ target = of_parse_phandle(np, "memory-regions", idx);
+ if (!target)
+ target = of_parse_phandle(np, "memory-region", idx);
+
if (!target)
return -ENODEV;
--
2.24.1
next prev parent reply other threads:[~2020-04-03 18:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-03 18:56 [PATCH 0/4] of: reserved-memory: Various improvements Thierry Reding
2020-04-03 18:56 ` [PATCH 1/4] dt-bindings: reserved-memory: Introduce memory-region{s,-names} Thierry Reding
2020-04-03 18:56 ` Thierry Reding [this message]
2020-04-03 18:56 ` [PATCH 3/4] of: reserved-memory: Support lookup of regions by name Thierry Reding
2020-04-03 18:56 ` [PATCH 4/4] of: reserved-memory: Support multiple regions per device Thierry Reding
2020-04-05 1:24 ` [PATCH 0/4] of: reserved-memory: Various improvements Rob Herring
2020-04-06 10:04 ` Thierry Reding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200403185640.118569-3-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).