Skip to content

Commit

Permalink
soundwire: slave: force fwnode as primary
Browse files Browse the repository at this point in the history
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: d5dcce0 ("device property: Keep secondary firmware node secondary by type")
Tested-by: Pierre-Louis Bossart <[email protected]>
Signed-off-by: Bard Liao <[email protected]>
  • Loading branch information
bardliao committed Dec 18, 2020
1 parent 0f8b24a commit 03b55f5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/soundwire/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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);
Expand Down

0 comments on commit 03b55f5

Please sign in to comment.