Commit 2f9e87f5 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

driver core: Add a comment to set_primary_fwnode() on nullifying

Explain what parent && fn == parent->fwnode conditional does.
With this refactor the code a bit.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230323182640.61085-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cf34b880
...@@ -4982,9 +4982,13 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode) ...@@ -4982,9 +4982,13 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
} else { } else {
if (fwnode_is_primary(fn)) { if (fwnode_is_primary(fn)) {
dev->fwnode = fn->secondary; dev->fwnode = fn->secondary;
/* Skip nullifying fn->secondary if the primary is shared */
if (parent && fn == parent->fwnode)
return;
/* Set fn->secondary = NULL, so fn remains the primary fwnode */ /* Set fn->secondary = NULL, so fn remains the primary fwnode */
if (!(parent && fn == parent->fwnode)) fn->secondary = NULL;
fn->secondary = NULL;
} else { } else {
dev->fwnode = NULL; dev->fwnode = NULL;
} }
......
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