]> git.baikalelectronics.ru Git - kernel.git/commit
device property: Keep secondary firmware node secondary by type
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 22 Oct 2020 18:40:59 +0000 (21:40 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 27 Oct 2020 18:18:37 +0000 (19:18 +0100)
commit6647a7165833d94a4c92b780179873b727629184
tree1f3799d490274dfc4428f13616b0f9000398f585
parenta1fe7c755400af92f0070a66f48f00b659aeacac
device property: Keep secondary firmware node secondary by type

Behind primary and secondary we understand the type of the nodes
which might define their ordering. However, if primary node gone,
we can't maintain the ordering by definition of the linked list.
Thus, by ordering secondary node becomes first in the list.
But in this case the meaning of it is still secondary (or auxiliary).
The type of the node is maintained by the secondary pointer in it:

secondary pointer Meaning
NULL or valid primary node
ERR_PTR(-ENODEV) secondary node

So, if by some reason we do the following sequence of calls

set_primary_fwnode(dev, NULL);
set_primary_fwnode(dev, primary);

we should preserve secondary node.

This concept is supported by the description of set_primary_fwnode()
along with implementation of set_secondary_fwnode(). Hence, fix
the commit 0c3589c329b6 to follow this as well.

Fixes: 0c3589c329b6 ("device property: Fix the secondary firmware node handling in set_primary_fwnode()")
Cc: Ferry Toth <fntoth@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: Ferry Toth <fntoth@gmail.com>
Cc: 5.9+ <stable@vger.kernel.org> # 5.9+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/core.c