From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: linux-kernel@vger.kernel.org
Cc: Lee Jones <lee.jones@linaro.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Subject: [PATCH] mfd: core: Restore error-free return for dt-disabled devices
Date: Fri, 30 Oct 2020 15:18:06 +0100 [thread overview]
Message-ID: <20201030141806.1272650-1-paul.kocialkowski@bootlin.com> (raw)
When adding devices via mfd (mfd_add_device), a check on the device-tree
status of the device was performed to gracefully handle disabled devices
without errors.
This was done with a check using of_device_is_available, that was recently
moved to the mfd_match_of_node_to_dev function (by returning -ENODEV).
However, no specific case was added to handle -ENODEV, so it was handled
like any error.
At the end of the day, this causes the mfd_add_devices process to fail as
soon as one device is marked disabled. This is quite problematic and
definitely not what we want.
Introduce a special case to handle -ENODEV gracefully and restore original
behavior.
Fixes: 466a62d7642f ("mfd: core: Make a best effort attempt to match
devices with the correct of_nodes")
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
drivers/mfd/mfd-core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index c3651f06684f..be9900866f2d 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -215,6 +215,13 @@ static int mfd_add_device(struct device *parent, int id,
ret = mfd_match_of_node_to_dev(pdev, np, cell);
if (ret == -EAGAIN)
continue;
+
+ /* Ignore 'disabled' devices error free */
+ if (ret == -ENODEV) {
+ ret = 0;
+ goto fail_alias;
+ }
+
if (ret)
goto fail_alias;
--
2.28.0
reply other threads:[~2020-10-30 14:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201030141806.1272650-1-paul.kocialkowski@bootlin.com \
--to=paul.kocialkowski@bootlin.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.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 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).