mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-14 15:54:15 +08:00
device property: add description of fwnode cases
There are only four valid fwnode cases which are - primary --> secondary --> -ENODEV - primary --> NULL - secondary --> -ENODEV - NULL dev->fwnode should be converted between the 4 cases above no matter how/when set_primary_fwnode() and set_secondary_fwnode() are called. Describe it in the code so people will keep it in mind. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> [ rjw: Comment edit ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
47f4469970
commit
3f7bddaf5d
@ -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,6 +4438,7 @@ 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 = NULL;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user