Until now, MFD has assumed all child devices passed to it (via
mfd_cells) are to be registered.  It does not take into account
requests from Device Tree and the like to disable child devices
on a per-platform basis.

Well now it does.

Reported-by: Barry Song <[email protected]>
Reported-by: Stephan Gerhold <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
---
 drivers/mfd/mfd-core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index eafdadd58e8b..24c139633524 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -182,6 +182,11 @@ static int mfd_add_device(struct device *parent, int id,
        if (parent->of_node && cell->of_compatible) {
                for_each_child_of_node(parent->of_node, np) {
                        if (of_device_is_compatible(np, cell->of_compatible)) {
+                               if (!of_device_is_available(np)) {
+                                       /* Ignore disabled devices error free */
+                                       ret = 0;
+                                       goto fail_alias;
+                               }
                                pdev->dev.of_node = np;
                                pdev->dev.fwnode = &np->fwnode;
                                break;
-- 
2.17.1

Reply via email to