|
Takashi Iwai |
a116b8 |
From d5dcce0c414fcbfe4c2037b66ac69ea5f9b3f75c Mon Sep 17 00:00:00 2001
|
|
Takashi Iwai |
a116b8 |
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
|
Takashi Iwai |
a116b8 |
Date: Thu, 22 Oct 2020 21:40:59 +0300
|
|
Takashi Iwai |
a116b8 |
Subject: [PATCH] device property: Keep secondary firmware node secondary by type
|
|
Takashi Iwai |
a116b8 |
Git-commit: d5dcce0c414fcbfe4c2037b66ac69ea5f9b3f75c
|
|
Takashi Iwai |
a116b8 |
Patch-mainline: v5.10-rc2
|
|
Takashi Iwai |
a116b8 |
References: git-fixes
|
|
Takashi Iwai |
a116b8 |
|
|
Takashi Iwai |
a116b8 |
Behind primary and secondary we understand the type of the nodes
|
|
Takashi Iwai |
a116b8 |
which might define their ordering. However, if primary node gone,
|
|
Takashi Iwai |
a116b8 |
we can't maintain the ordering by definition of the linked list.
|
|
Takashi Iwai |
a116b8 |
Thus, by ordering secondary node becomes first in the list.
|
|
Takashi Iwai |
a116b8 |
But in this case the meaning of it is still secondary (or auxiliary).
|
|
Takashi Iwai |
a116b8 |
The type of the node is maintained by the secondary pointer in it:
|
|
Takashi Iwai |
a116b8 |
|
|
Takashi Iwai |
a116b8 |
secondary pointer Meaning
|
|
Takashi Iwai |
a116b8 |
NULL or valid primary node
|
|
Takashi Iwai |
a116b8 |
ERR_PTR(-ENODEV) secondary node
|
|
Takashi Iwai |
a116b8 |
|
|
Takashi Iwai |
a116b8 |
So, if by some reason we do the following sequence of calls
|
|
Takashi Iwai |
a116b8 |
|
|
Takashi Iwai |
a116b8 |
set_primary_fwnode(dev, NULL);
|
|
Takashi Iwai |
a116b8 |
set_primary_fwnode(dev, primary);
|
|
Takashi Iwai |
a116b8 |
|
|
Takashi Iwai |
a116b8 |
we should preserve secondary node.
|
|
Takashi Iwai |
a116b8 |
|
|
Takashi Iwai |
a116b8 |
This concept is supported by the description of set_primary_fwnode()
|
|
Takashi Iwai |
a116b8 |
along with implementation of set_secondary_fwnode(). Hence, fix
|
|
Takashi Iwai |
a116b8 |
the commit c15e1bdda436 to follow this as well.
|
|
Takashi Iwai |
a116b8 |
|
|
Takashi Iwai |
a116b8 |
Fixes: c15e1bdda436 ("device property: Fix the secondary firmware node handling in set_primary_fwnode()")
|
|
Takashi Iwai |
a116b8 |
Cc: Ferry Toth <fntoth@gmail.com>
|
|
Takashi Iwai |
a116b8 |
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
|
Takashi Iwai |
a116b8 |
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
|
|
Takashi Iwai |
a116b8 |
Tested-by: Ferry Toth <fntoth@gmail.com>
|
|
Takashi Iwai |
a116b8 |
Cc: 5.9+ <stable@vger.kernel.org> # 5.9+
|
|
Takashi Iwai |
a116b8 |
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
|
Takashi Iwai |
a116b8 |
Acked-by: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
a116b8 |
|
|
Takashi Iwai |
a116b8 |
---
|
|
Takashi Iwai |
a116b8 |
drivers/base/core.c | 2 +-
|
|
Takashi Iwai |
a116b8 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Takashi Iwai |
a116b8 |
|
|
Takashi Iwai |
a116b8 |
diff --git a/drivers/base/core.c b/drivers/base/core.c
|
|
Takashi Iwai |
a116b8 |
index c852f16c111b..41feab679fa1 100644
|
|
Takashi Iwai |
a116b8 |
--- a/drivers/base/core.c
|
|
Takashi Iwai |
a116b8 |
+++ b/drivers/base/core.c
|
|
Takashi Iwai |
a116b8 |
@@ -4278,7 +4278,7 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
|
|
Takashi Iwai |
a116b8 |
} else {
|
|
Takashi Iwai |
a116b8 |
if (fwnode_is_primary(fn)) {
|
|
Takashi Iwai |
a116b8 |
dev->fwnode = fn->secondary;
|
|
Takashi Iwai |
a116b8 |
- fn->secondary = NULL;
|
|
Takashi Iwai |
a116b8 |
+ fn->secondary = ERR_PTR(-ENODEV);
|
|
Takashi Iwai |
a116b8 |
} else {
|
|
Takashi Iwai |
a116b8 |
dev->fwnode = NULL;
|
|
Takashi Iwai |
a116b8 |
}
|
|
Takashi Iwai |
a116b8 |
--
|
|
Takashi Iwai |
a116b8 |
2.16.4
|
|
Takashi Iwai |
a116b8 |
|