summaryrefslogtreecommitdiff
path: root/drivers/w1
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2018-07-06 07:35:50 +0200
committerSebastian Reichel <sre@kernel.org>2018-07-11 18:09:08 +0200
commitfae68031f7fbc8b6db58d87830ba7ed1d696fbb1 (patch)
tree6a9486a69b5802af55406fb6269230acdeeaaa1c /drivers/w1
parentda0a5d99b14ced8ec4bf741f5d2457348b932c82 (diff)
downloadlwn-fae68031f7fbc8b6db58d87830ba7ed1d696fbb1.tar.gz
lwn-fae68031f7fbc8b6db58d87830ba7ed1d696fbb1.zip
w1: core: match sub-nodes of bus masters in devicetree
Once a new slave device is detected, match it against all sub-nodes of the master bus controller. If a match is found, set the slave device's of_node pointer. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/w1.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index caef0e0fd817..890c038c25f8 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -26,6 +26,7 @@
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/hwmon.h>
+#include <linux/of.h>
#include <linux/atomic.h>
@@ -686,6 +687,8 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
sl->dev.bus = &w1_bus_type;
sl->dev.release = &w1_slave_release;
sl->dev.groups = w1_slave_groups;
+ sl->dev.of_node = of_find_matching_node(sl->master->dev.of_node,
+ sl->family->of_match_table);
dev_set_name(&sl->dev, "%02x-%012llx",
(unsigned int) sl->reg_num.family,