Pull device properties framework fixes from Rafael Wysocki: "Fix the secondary firmware node handling while manipulating the primary firmware node for a given device (Andy Shevchenko)" * tag 'devprop-5.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: device property: Don't clear secondary pointer for shared primary firmware node device property: Keep secondary firmware node secondary by type
Unified · Split
| @@ -4264,6 +4264,7 @@ static inline bool fwnode_is_primary(struct fwnode_handle *fwnode) · 4263 unmodified lines | ||
| 4264 | 4264 | */ |
| 4265 | 4265 | void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode) |
| 4266 | 4266 | { |
| 4267 | + struct device *parent = dev->parent; | |
| 4267 | 4268 | struct fwnode_handle *fn = dev->fwnode; |
| 4268 | 4269 | |
| 4269 | 4270 | if (fwnode) { |
| @@ -4278,7 +4279,8 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode) · 8 unmodified lines | ||
| 4278 | 4279 | } else { |
| 4279 | 4280 | if (fwnode_is_primary(fn)) { |
| 4280 | 4281 | dev->fwnode = fn->secondary; |
| 4281 | − fn->secondary = NULL; | |
| 4282 | + if (!(parent && fn == parent->fwnode)) | |
| 4283 | + fn->secondary = ERR_PTR(-ENODEV); | |
| 4282 | 4284 | } else { |
| 4283 | 4285 | dev->fwnode = NULL; |
| 4284 | 4286 | } |