summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-01-08 15:45:47 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2021-01-08 15:45:47 -0800
commit78d42025e5bb83f9071e4a60edf1567dd12ed9dc (patch)
treec44988fa594998d4a896eb7f336693afbe30769f
parentfb9ca0be63b49eece304f50023e736a678cc4159 (diff)
parent3f7bddaf5d5a83aa2eb1e6d72db221d3ec43c813 (diff)
downloadlinux-78d42025e5bb83f9071e4a60edf1567dd12ed9dc.tar.bz2
Merge tag 'devprop-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull device properties framework fixes from Rafael Wysocki: "Revert a problematic commit that went in during the 5.10 cycle and improve the kerneldoc description of the function affected by it (both changes from Bard Liao)" * tag 'devprop-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: device property: add description of fwnode cases Revert "device property: Keep secondary firmware node secondary by type"
-rw-r--r--drivers/base/core.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 25e08e5f40bd..14f165816742 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -4414,6 +4414,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)
{
@@ -4432,8 +4438,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, so fn remains the primary fwnode */
if (!(parent && fn == parent->fwnode))
- fn->secondary = ERR_PTR(-ENODEV);
+ fn->secondary = NULL;
} else {
dev->fwnode = NULL;
}