Commit fae68031 authored by Daniel Mack's avatar Daniel Mack Committed by Sebastian Reichel

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: default avatarDaniel Mack <daniel@zonque.org>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
parent da0a5d99
......@@ -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,
......
......@@ -274,6 +274,8 @@ struct w1_family {
struct w1_family_ops *fops;
const struct of_device_id *of_match_table;
atomic_t refcnt;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment