mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/1] driver core: Add a comment to set_primary_fwnode() on nullifying
@ 2023-03-23 18:26 Andy Shevchenko
  0 siblings, 0 replies; only message in thread
From: Andy Shevchenko @ 2023-03-23 18:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Saravana Kannan, linux-kernel
  Cc: Rafael J. Wysocki, Andy Shevchenko

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>
---
 drivers/base/core.c | 8 ++++++--
 1 file 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;
 		}
-- 
2.40.0.1.gaa8946217a0b


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-23 18:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 18:26 [PATCH v1 1/1] driver core: Add a comment to set_primary_fwnode() on nullifying Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®