These macros and functions have dummy entries, so it should not be an issue.
@@ -35,6 +36,7 @@ static int sdw_slave_add(struct sdw_bus *bus,
ÂÂÂÂÂ slave->dev.release = sdw_slave_release;
ÂÂÂÂÂ slave->dev.bus = &sdw_bus_type;
+ÂÂÂ slave->dev.of_node = of_node_get(to_of_node(fwnode));
shouldn't this protected by
#if IS_ENABLED(CONFIG_OF) ?
ÂÂÂÂÂ slave->bus = bus;
ÂÂÂÂÂ slave->status = SDW_SLAVE_UNATTACHED;
ÂÂÂÂÂ slave->dev_num = 0;
@@ -112,3 +114,48 @@ int sdw_acpi_find_slaves(struct sdw_bus *bus)
 }
 #endif
+
+/*
+ * sdw_of_find_slaves() - Find Slave devices in master device tree node
+ * @bus: SDW bus instance
+ *
+ * Scans Master DT node for SDW child Slave devices and registers it.
+ */
+int sdw_of_find_slaves(struct sdw_bus *bus)
+{
+ÂÂÂ struct device *dev = bus->dev;
+ÂÂÂ struct device_node *node;
+
+ÂÂÂ for_each_child_of_node(bus->dev->of_node, node) {
+ÂÂÂÂÂÂÂ struct sdw_slave_id id;
+ÂÂÂÂÂÂÂ const char *compat = NULL;
+ÂÂÂÂÂÂÂ int unique_id, ret;
+ÂÂÂÂÂÂÂ int ver, mfg_id, part_id, class_id;
+
+ÂÂÂÂÂÂÂ compat = of_get_property(node, "compatible", NULL);
+ÂÂÂÂÂÂÂ if (!compat)
+ÂÂÂÂÂÂÂÂÂÂÂ continue;
+
+ÂÂÂÂÂÂÂ ret = sscanf(compat, "sdw%x,%x,%x,%x",
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ &ver, &mfg_id, &part_id, &class_id);
+ÂÂÂÂÂÂÂ if (ret != 4) {
+ÂÂÂÂÂÂÂÂÂÂÂ dev_err(dev, "Manf ID & Product code not found %s\n",
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ compat);
+ÂÂÂÂÂÂÂÂÂÂÂ continue;
+ÂÂÂÂÂÂÂ }
+
+ÂÂÂÂÂÂÂ ret = of_property_read_u32(node, "sdw-instance-id", &unique_id);
+ÂÂÂÂÂÂÂ if (ret) {
+ÂÂÂÂÂÂÂÂÂÂÂ dev_err(dev, "Instance id not found:%d\n", ret);
+ÂÂÂÂÂÂÂÂÂÂÂ continue;
I am confused here.
If you have two identical devices on the same link, isn't this property required and that should be a real error instead of a continue?
+ÂÂÂÂÂÂÂ }
+
+ÂÂÂÂÂÂÂ id.sdw_version = ver - 0xF;
maybe a comment in the code would help to make the encoding self-explanatory, as you did in the DT bindings
 Version number '0x10' represents SoundWire 1.0
 Version number '0x11' represents SoundWire 1.1
+ÂÂÂÂÂÂÂ id.unique_id = unique_id;
+ÂÂÂÂÂÂÂ id.mfg_id = mfg_id;
+ÂÂÂÂÂÂÂ id.part_id = part_id;
+ÂÂÂÂÂÂÂ id.class_id = class_id;
+ÂÂÂÂÂÂÂ sdw_slave_add(bus, &id, of_fwnode_handle(node));
+ÂÂÂ }
+ÂÂÂ return 0;
+}