From 12c438b891997ab26c219831971dd58bd3b92640 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Fri, 11 Dec 2020 14:43:14 -0600 Subject: [PATCH] soundwire: slave: force fwnode as primary Recent changes in drivers/base/core.c modified the behavior for fwnodes. While the changes are legit and make sense, they have a ripple effect on SoundWire Slave devices. Intel validation found a corner case where in module load/unload loops, the dev->fwnode pointer is overridden with device properties, which as a result caused suspend-resume timeouts since the dev->fwnode is detected as problematic in ACPI layers. This patch forces the fwnode to be properly reinitialized as a primary node. Fixes: d5dcce0c414f ("device property: Keep secondary firmware node secondary by type") Tested-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/soundwire/slave.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c index 180f38bd003bca..80d11c0b01a796 100644 --- a/drivers/soundwire/slave.c +++ b/drivers/soundwire/slave.c @@ -35,7 +35,6 @@ int sdw_slave_add(struct sdw_bus *bus, /* Initialize data structure */ memcpy(&slave->id, id, sizeof(*id)); slave->dev.parent = bus->dev; - slave->dev.fwnode = fwnode; if (id->unique_id == SDW_IGNORED_UNIQUE_ID) { /* name shall be sdw:link:mfg:part:class */ @@ -53,6 +52,9 @@ int sdw_slave_add(struct sdw_bus *bus, slave->dev.of_node = of_node_get(to_of_node(fwnode)); slave->dev.type = &sdw_slave_type; slave->dev.groups = sdw_slave_status_attr_groups; + /* make sure fwnode is a primary fwnode */ + fwnode->secondary = NULL; + set_primary_fwnode(&slave->dev, fwnode); slave->bus = bus; slave->status = SDW_SLAVE_UNATTACHED; init_completion(&slave->enumeration_complete);