linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: kernel@pengutronix.de, ceggers@arri.de,
	Ahmad Fatoum <a.fatoum@pengutronix.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 2/2] nvmem: core: skip nodes with compatibles other than "nvmem-cell"
Date: Tue, 28 Apr 2020 13:18:27 +0200	[thread overview]
Message-ID: <20200428111829.2215-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20200428111829.2215-1-a.fatoum@pengutronix.de>

The nvmem cell binding used to apply to all objects which match
"^.*@[0-9a-f]+$", without taking a compatible into account, which
precluded extension of EEPROMs by child nodes other than nvmem.

A previous commit changed the binding, so that nvmem cells that
feature a compatible property must have "nvmem-cell" as the value,
otherwise they are skipped.

Adjust the driver to observe the new binding change. This change
does not change behavior for any device tree that was already
compliant with the nvmem binding.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/nvmem/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 05c6ae4b0b97..eb697f5ad07d 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -547,6 +547,10 @@ static int nvmem_add_cells_from_of(struct nvmem_device *nvmem)
 	parent = dev->of_node;
 
 	for_each_child_of_node(parent, child) {
+		if (of_find_property(child, "compatible", NULL) &&
+		    !of_device_is_compatible(child, "nvmem-cell"))
+			continue;
+
 		addr = of_get_property(child, "reg", &len);
 		if (!addr || (len < 2 * sizeof(u32))) {
 			dev_err(dev, "nvmem: invalid reg on %pOF\n", child);
-- 
2.26.2


  parent reply	other threads:[~2020-04-28 11:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 11:18 [PATCH v3 0/2] nvmem: skip nodes with compatibles other than "nvmem-cell" Ahmad Fatoum
2020-04-28 11:18 ` [PATCH v3 1/2] dt-bindings: " Ahmad Fatoum
2020-05-08  6:56   ` Ahmad Fatoum
2020-04-28 11:18 ` Ahmad Fatoum [this message]
2020-05-11 11:33   ` [PATCH v3 2/2] nvmem: core: " Srinivas Kandagatla
2020-12-30 13:43   ` Kamel Bouhara
2021-01-18 13:25     ` Ahmad Fatoum
2020-05-12 14:18 ` [PATCH v3 0/2] nvmem: " Rob Herring
2020-10-12 15:36   ` Ahmad Fatoum
2020-11-02 15:23     ` Ahmad Fatoum
2020-11-16 17:04       ` Ahmad Fatoum
2020-11-16 17:21         ` Srinivas Kandagatla
2020-11-16 17:28           ` Ahmad Fatoum

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=20200428111829.2215-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=ceggers@arri.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.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).