Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4259,6 +4259,12 @@ static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
*
* Set the device's firmware node pointer to @fwnode, but if a secondary
* firmware node of the device is present, preserve it.
*
* Valid fwnode cases are:
* - primary --> secondary --> -ENODEV
* - primary --> NULL
* - secondary --> -ENODEV
* - NULL
*/
void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
{
Expand All @@ -4277,8 +4283,9 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
} else {
if (fwnode_is_primary(fn)) {
dev->fwnode = fn->secondary;
/* Set fn->secondary = NULL to keep fn as a primary fwnode */
if (!(parent && fn == parent->fwnode))
fn->secondary = ERR_PTR(-ENODEV);
fn->secondary = NULL;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by "original commit SHA ("DESCRIPTION") was fully correct" something different was meant, I think @andy-shev was asking to mention the original commit that introduced the code before d5dcce0

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by "original commit SHA ("DESCRIPTION") was fully correct" something different was meant, I think @andy-shev was asking to mention the original commit that introduced the code before d5dcce0

Thanks @lyakh for pointing it out.

} else {
dev->fwnode = NULL;
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/soundwire/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ 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 @@ -52,9 +53,6 @@ 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