mfd: core: Set fwnode for created devices [Linux 4.9.187]

This Linux kernel change "mfd: core: Set fwnode for created devices" is included in the Linux 4.9.187 release. This change is authored by Robert Hancock <hancock [at] sedsystems.ca> on Tue Jun 4 16:35:43 2019 -0600. The commit for this change in Linux stable tree is f140505 (patch) which is from upstream commit c176c6d. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream c176c6d.

mfd: core: Set fwnode for created devices

[ Upstream commit c176c6d7e932662668bcaec2d763657096589d85 ]

The logic for setting the of_node on devices created by mfd did not set
the fwnode pointer to match, which caused fwnode-based APIs to
malfunction on these devices since the fwnode pointer was null. Fix
this.

Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>

There is one line of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/mfd/mfd-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index c57e407..5c8ed21 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -179,6 +179,7 @@ static int mfd_add_device(struct device *parent, int id,
        for_each_child_of_node(parent->of_node, np) {
            if (of_device_is_compatible(np, cell->of_compatible)) {
                pdev->dev.of_node = np;
+               pdev->dev.fwnode = &np->fwnode;
                break;
            }
        }

Leave a Reply

Your email address will not be published. Required fields are marked *