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 <grant.likely@secretlab.ca>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
Dong Aisheng
2012-07-11 15:16:37 +10:00
committed by Benjamin Herrenschmidt
parent b416c9a10b
commit 475d009429
6 changed files with 25 additions and 30 deletions

View File

@@ -67,7 +67,6 @@ static int update_dt_property(struct device_node *dn, struct property **prop,
const char *name, u32 vd, char *value)
{
struct property *new_prop = *prop;
struct property *old_prop;
int more = 0;
/* A negative 'vd' value indicates that only part of the new property
@@ -117,12 +116,7 @@ static int update_dt_property(struct device_node *dn, struct property **prop,
}
if (!more) {
old_prop = of_find_property(dn, new_prop->name, NULL);
if (old_prop)
prom_update_property(dn, new_prop, old_prop);
else
prom_add_property(dn, new_prop);
prom_update_property(dn, new_prop);
new_prop = NULL;
}