summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-03-23 19:26:40 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-28 08:26:32 +0200
commit2f9e87f5a2941b259336c7ea6c5a1499ede4554a (patch)
tree734a37ec9e3eb1d2d62df23efa71c624a2862b5b /drivers/base
parentpowerpc/fsl: fix compiler warning in fsl_wakeup_sys_init() (diff)
downloadlinux-2f9e87f5a2941b259336c7ea6c5a1499ede4554a.tar.xz
linux-2f9e87f5a2941b259336c7ea6c5a1499ede4554a.zip
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230323182640.61085-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index f1889b9cab45..b59692a4d809 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -4982,9 +4982,13 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
} else {
if (fwnode_is_primary(fn)) {
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 */
- if (!(parent && fn == parent->fwnode))
- fn->secondary = NULL;
+ fn->secondary = NULL;
} else {
dev->fwnode = NULL;
}