mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
of: Improve prom_update_property() function
prom_update_property() currently fails if the property doesn't actually exist yet which isn't what we want. Change to add-or-update instead of update-only, then we can remove a lot duplicated lines. Suggested-by: Grant Likely <[email protected]> Signed-off-by: Dong Aisheng <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
This commit is contained in:
parent
b416c9a10b
commit
475d009429
6 changed files with 25 additions and 30 deletions
|
|
@ -1073,7 +1073,8 @@ int prom_remove_property(struct device_node *np, struct property *prop)
|
|||
}
|
||||
|
||||
/*
|
||||
* prom_update_property - Update a property in a node.
|
||||
* prom_update_property - Update a property in a node, if the property does
|
||||
* not exist, add it.
|
||||
*
|
||||
* Note that we don't actually remove it, since we have given out
|
||||
* who-knows-how-many pointers to the data using get-property.
|
||||
|
|
@ -1081,13 +1082,19 @@ int prom_remove_property(struct device_node *np, struct property *prop)
|
|||
* and add the new property to the property list
|
||||
*/
|
||||
int prom_update_property(struct device_node *np,
|
||||
struct property *newprop,
|
||||
struct property *oldprop)
|
||||
struct property *newprop)
|
||||
{
|
||||
struct property **next;
|
||||
struct property **next, *oldprop;
|
||||
unsigned long flags;
|
||||
int found = 0;
|
||||
|
||||
if (!newprop->name)
|
||||
return -EINVAL;
|
||||
|
||||
oldprop = of_find_property(np, newprop->name, NULL);
|
||||
if (!oldprop)
|
||||
return prom_add_property(np, newprop);
|
||||
|
||||
write_lock_irqsave(&devtree_lock, flags);
|
||||
next = &np->properties;
|
||||
while (*next) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue