[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1469519027-11387-4-git-send-email-quentin.schulz@free-electrons.com>
Date: Tue, 26 Jul 2016 09:43:46 +0200
From: Quentin Schulz <quentin.schulz@...e-electrons.com>
To: jdelvare@...e.com, linux@...ck-us.net, jic23@...nel.org,
knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
maxime.ripard@...e-electrons.com, wens@...e.org,
lee.jones@...aro.org
Cc: Quentin Schulz <quentin.schulz@...e-electrons.com>,
linux-kernel@...r.kernel.org, linux-hwmon@...r.kernel.org,
linux-iio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
thomas.petazzoni@...e-electrons.com,
antoine.tenart@...e-electrons.com
Subject: [PATCH v3 3/4] mfd: mfd-core: reattach mfd of_node to cells without of_compatible
When an MFD cell has an of_compatible (meaning it is present in the Device
Tree), other nodes can reference it using a phandle.
However when the MFD cell is not declared in the Device Tree, the only way
other nodes can reference it are by using a phandle to the MFD. Then when
this MFD cell tries to register itself in one framework, the registration
is denied by the framework because it is not matching the of_node of the
node which is referenced by the phandle in one of the other nodes.
This reattaches the of_node of the MFD to the MFD cell device structure
when the MFD cell has no of_compatible.
Signed-off-by: Quentin Schulz <quentin.schulz@...e-electrons.com>
---
We need this modification to register the thermal sensor in the thermal
framework.
Added in v3.
drivers/mfd/mfd-core.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 3ac486a..0b19663 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -175,12 +175,16 @@ static int mfd_add_device(struct device *parent, int id,
if (ret < 0)
goto fail_res;
- 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)) {
- pdev->dev.of_node = np;
- break;
+ if (parent->of_node) {
+ if (cell->of_compatible) {
+ for_each_child_of_node(parent->of_node, np) {
+ if (of_device_is_compatible(np, cell->of_compatible)) {
+ pdev->dev.of_node = np;
+ break;
+ }
}
+ } else {
+ pdev->dev.of_node = parent->of_node;
}
}
--
2.5.0
Powered by blists - more mailing lists