All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Andy Gross <andy.gross@linaro.org>,
	Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>,
	Frank Rowand <frowand.list@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	Rob Herring <robh+dt@kernel.org>, Tony Luck <tony.luck@intel.com>
Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	David Brown <david.brown@linaro.org>,
	linux-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/5] of/platform: Generalize /reserved-memory handling
Date: Wed,  4 Oct 2017 20:32:54 -0700	[thread overview]
Message-ID: <20171005033258.12825-2-bjorn.andersson@linaro.org> (raw)
In-Reply-To: <20171005033258.12825-1-bjorn.andersson@linaro.org>

By iterating over all /reserved-memory child nodes and match each one to
a list of compatibles that we want to treat specially, we can easily
extend the list of compatibles to handle - without having to resort to
of_platform_populate() that would create unnecessary platform_devices.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---

Changes since v2:
- Simplify logic per Rob's suggestion.

Changes since v1:
- New patch

 drivers/of/platform.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index b19524623498..ee89f096f0f3 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -497,6 +497,11 @@ int of_platform_default_populate(struct device_node *root,
 EXPORT_SYMBOL_GPL(of_platform_default_populate);
 
 #ifndef CONFIG_PPC
+static const struct of_device_id reserved_mem_matches[] = {
+	{ .compatible = "ramoops" },
+	{}
+};
+
 static int __init of_platform_default_populate_init(void)
 {
 	struct device_node *node;
@@ -505,15 +510,12 @@ static int __init of_platform_default_populate_init(void)
 		return -ENODEV;
 
 	/*
-	 * Handle ramoops explicitly, since it is inside /reserved-memory,
-	 * which lacks a "compatible" property.
+	 * Handle certain compatibles explicitly, since we don't want to create
+	 * platform_devices for every node in /reserved-memory with a
+	 * "compatible",
 	 */
-	node = of_find_node_by_path("/reserved-memory");
-	if (node) {
-		node = of_find_compatible_node(node, NULL, "ramoops");
-		if (node)
-			of_platform_device_create(node, NULL, NULL);
-	}
+	for_each_matching_node(node, reserved_mem_matches)
+		of_platform_device_create(node, NULL, NULL);
 
 	/* Populate everything else. */
 	of_platform_default_populate(NULL, NULL, NULL);
-- 
2.12.0

WARNING: multiple messages have this Message-ID (diff)
From: bjorn.andersson@linaro.org (Bjorn Andersson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/5] of/platform: Generalize /reserved-memory handling
Date: Wed,  4 Oct 2017 20:32:54 -0700	[thread overview]
Message-ID: <20171005033258.12825-2-bjorn.andersson@linaro.org> (raw)
In-Reply-To: <20171005033258.12825-1-bjorn.andersson@linaro.org>

By iterating over all /reserved-memory child nodes and match each one to
a list of compatibles that we want to treat specially, we can easily
extend the list of compatibles to handle - without having to resort to
of_platform_populate() that would create unnecessary platform_devices.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---

Changes since v2:
- Simplify logic per Rob's suggestion.

Changes since v1:
- New patch

 drivers/of/platform.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index b19524623498..ee89f096f0f3 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -497,6 +497,11 @@ int of_platform_default_populate(struct device_node *root,
 EXPORT_SYMBOL_GPL(of_platform_default_populate);
 
 #ifndef CONFIG_PPC
+static const struct of_device_id reserved_mem_matches[] = {
+	{ .compatible = "ramoops" },
+	{}
+};
+
 static int __init of_platform_default_populate_init(void)
 {
 	struct device_node *node;
@@ -505,15 +510,12 @@ static int __init of_platform_default_populate_init(void)
 		return -ENODEV;
 
 	/*
-	 * Handle ramoops explicitly, since it is inside /reserved-memory,
-	 * which lacks a "compatible" property.
+	 * Handle certain compatibles explicitly, since we don't want to create
+	 * platform_devices for every node in /reserved-memory with a
+	 * "compatible",
 	 */
-	node = of_find_node_by_path("/reserved-memory");
-	if (node) {
-		node = of_find_compatible_node(node, NULL, "ramoops");
-		if (node)
-			of_platform_device_create(node, NULL, NULL);
-	}
+	for_each_matching_node(node, reserved_mem_matches)
+		of_platform_device_create(node, NULL, NULL);
 
 	/* Populate everything else. */
 	of_platform_default_populate(NULL, NULL, NULL);
-- 
2.12.0

WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Andy Gross <andy.gross@linaro.org>,
	Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>,
	Frank Rowand <frowand.list@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	Rob Herring <robh+dt@kernel.org>, Tony Luck <tony.luck@intel.com>
Cc: David Brown <david.brown@linaro.org>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-soc@vger.kernel.org
Subject: [PATCH v3 1/5] of/platform: Generalize /reserved-memory handling
Date: Wed,  4 Oct 2017 20:32:54 -0700	[thread overview]
Message-ID: <20171005033258.12825-2-bjorn.andersson@linaro.org> (raw)
In-Reply-To: <20171005033258.12825-1-bjorn.andersson@linaro.org>

By iterating over all /reserved-memory child nodes and match each one to
a list of compatibles that we want to treat specially, we can easily
extend the list of compatibles to handle - without having to resort to
of_platform_populate() that would create unnecessary platform_devices.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---

Changes since v2:
- Simplify logic per Rob's suggestion.

Changes since v1:
- New patch

 drivers/of/platform.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index b19524623498..ee89f096f0f3 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -497,6 +497,11 @@ int of_platform_default_populate(struct device_node *root,
 EXPORT_SYMBOL_GPL(of_platform_default_populate);
 
 #ifndef CONFIG_PPC
+static const struct of_device_id reserved_mem_matches[] = {
+	{ .compatible = "ramoops" },
+	{}
+};
+
 static int __init of_platform_default_populate_init(void)
 {
 	struct device_node *node;
@@ -505,15 +510,12 @@ static int __init of_platform_default_populate_init(void)
 		return -ENODEV;
 
 	/*
-	 * Handle ramoops explicitly, since it is inside /reserved-memory,
-	 * which lacks a "compatible" property.
+	 * Handle certain compatibles explicitly, since we don't want to create
+	 * platform_devices for every node in /reserved-memory with a
+	 * "compatible",
 	 */
-	node = of_find_node_by_path("/reserved-memory");
-	if (node) {
-		node = of_find_compatible_node(node, NULL, "ramoops");
-		if (node)
-			of_platform_device_create(node, NULL, NULL);
-	}
+	for_each_matching_node(node, reserved_mem_matches)
+		of_platform_device_create(node, NULL, NULL);
 
 	/* Populate everything else. */
 	of_platform_default_populate(NULL, NULL, NULL);
-- 
2.12.0

  reply	other threads:[~2017-10-05  3:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05  3:32 [PATCH v3 0/5] Qualcomm remote filesystem shared memory driver Bjorn Andersson
2017-10-05  3:32 ` Bjorn Andersson
2017-10-05  3:32 ` Bjorn Andersson [this message]
2017-10-05  3:32   ` [PATCH v3 1/5] of/platform: Generalize /reserved-memory handling Bjorn Andersson
2017-10-05  3:32   ` Bjorn Andersson
     [not found]   ` <20171005033258.12825-2-bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-10-10  0:50     ` Rob Herring
2017-10-10  0:50       ` Rob Herring
2017-10-10  0:50       ` Rob Herring
2017-10-05  3:32 ` [PATCH v3 2/5] of: reserved_mem: Accessor for acquiring reserved_mem Bjorn Andersson
2017-10-05  3:32   ` Bjorn Andersson
2017-10-10  0:52   ` Rob Herring
2017-10-10  0:52     ` Rob Herring
2017-10-05  3:32 ` [PATCH v3 3/5] dt-binding: soc: qcom: Add binding for rmtfs memory Bjorn Andersson
2017-10-05  3:32   ` Bjorn Andersson
2017-10-05  3:32 ` [PATCH v3 4/5] soc: qcom: Remote filesystem memory driver Bjorn Andersson
2017-10-05  3:32   ` Bjorn Andersson
2017-10-10  0:49   ` Rob Herring
2017-10-10  0:49     ` Rob Herring
2017-10-05  3:32 ` [PATCH v3 5/5] arm64: dts: msm8916: Mark rmtfs node as qcom,rmtfs-mem compatible Bjorn Andersson
2017-10-05  3:32   ` [PATCH v3 5/5] arm64: dts: msm8916: Mark rmtfs node as qcom, rmtfs-mem compatible Bjorn Andersson

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=20171005033258.12825-2-bjorn.andersson@linaro.org \
    --to=bjorn.andersson@linaro.org \
    --cc=andy.gross@linaro.org \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=david.brown@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tony.luck@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.