Skip to content

Commit

Permalink
Merge branch 'devicetree/next-overlay' into devicetree/next
Browse files Browse the repository at this point in the history
Conflicts:
	drivers/of/testcase-data/testcases.dts
  • Loading branch information
glikely committed Aug 11, 2014
2 parents b775e64 + b6ae5dc commit 663d3f7
Show file tree
Hide file tree
Showing 14 changed files with 1,054 additions and 443 deletions.
40 changes: 40 additions & 0 deletions Documentation/devicetree/changesets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
A DT changeset is a method which allows one to apply changes
in the live tree in such a way that either the full set of changes
will be applied, or none of them will be. If an error occurs partway
through applying the changeset, then the tree will be rolled back to the
previous state. A changeset can also be removed after it has been
applied.

When a changeset is applied, all of the changes get applied to the tree
at once before emitting OF_RECONFIG notifiers. This is so that the
receiver sees a complete and consistent state of the tree when it
receives the notifier.

The sequence of a changeset is as follows.

1. of_changeset_init() - initializes a changeset

2. A number of DT tree change calls, of_changeset_attach_node(),
of_changeset_detach_node(), of_changeset_add_property(),
of_changeset_remove_property, of_changeset_update_property() to prepare
a set of changes. No changes to the active tree are made at this point.
All the change operations are recorded in the of_changeset 'entries'
list.

3. mutex_lock(of_mutex) - starts a changeset; The global of_mutex
ensures there can only be one editor at a time.

4. of_changeset_apply() - Apply the changes to the tree. Either the
entire changeset will get applied, or if there is an error the tree will
be restored to the previous state

5. mutex_unlock(of_mutex) - All operations complete, release the mutex

If a successfully applied changeset needs to be removed, it can be done
with the following sequence.

1. mutex_lock(of_mutex)

2. of_changeset_revert()

3. mutex_unlock(of_mutex)
70 changes: 0 additions & 70 deletions arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,76 +821,6 @@ int cpu_to_chip_id(int cpu)
}
EXPORT_SYMBOL(cpu_to_chip_id);

#ifdef CONFIG_PPC_PSERIES
/*
* Fix up the uninitialized fields in a new device node:
* name, type and pci-specific fields
*/

static int of_finish_dynamic_node(struct device_node *node)
{
struct device_node *parent = of_get_parent(node);
int err = 0;
const phandle *ibm_phandle;

node->name = of_get_property(node, "name", NULL);
node->type = of_get_property(node, "device_type", NULL);

if (!node->name)
node->name = "<NULL>";
if (!node->type)
node->type = "<NULL>";

if (!parent) {
err = -ENODEV;
goto out;
}

/* We don't support that function on PowerMac, at least
* not yet
*/
if (machine_is(powermac))
return -ENODEV;

/* fix up new node's phandle field */
if ((ibm_phandle = of_get_property(node, "ibm,phandle", NULL)))
node->phandle = *ibm_phandle;

out:
of_node_put(parent);
return err;
}

static int prom_reconfig_notifier(struct notifier_block *nb,
unsigned long action, void *node)
{
int err;

switch (action) {
case OF_RECONFIG_ATTACH_NODE:
err = of_finish_dynamic_node(node);
if (err < 0)
printk(KERN_ERR "finish_node returned %d\n", err);
break;
default:
err = 0;
break;
}
return notifier_from_errno(err);
}

static struct notifier_block prom_reconfig_nb = {
.notifier_call = prom_reconfig_notifier,
.priority = 10, /* This one needs to run first */
};

static int __init prom_reconfig_setup(void)
{
return of_reconfig_notifier_register(&prom_reconfig_nb);
}
__initcall(prom_reconfig_setup);
#endif

bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
{
return (int)phys_id == get_hard_smp_processor_id(cpu);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/pseries/hotplug-memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
if (!memblock_size)
return -EINVAL;

p = (u32 *)of_get_property(pr->dn, "ibm,dynamic-memory", NULL);
p = (u32 *) pr->old_prop->value;
if (!p)
return -EINVAL;

Expand Down
30 changes: 8 additions & 22 deletions drivers/crypto/nx/nx-842.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,28 +936,14 @@ static int nx842_OF_upd(struct property *new_prop)
goto error_out;
}

/* Set ptr to new property if provided */
if (new_prop) {
/* Single property */
if (!strncmp(new_prop->name, "status", new_prop->length)) {
status = new_prop;

} else if (!strncmp(new_prop->name, "ibm,max-sg-len",
new_prop->length)) {
maxsglen = new_prop;

} else if (!strncmp(new_prop->name, "ibm,max-sync-cop",
new_prop->length)) {
maxsyncop = new_prop;

} else {
/*
* Skip the update, the property being updated
* has no impact.
*/
goto out;
}
}
/*
* If this is a property update, there are only certain properties that
* we care about. Bail if it isn't in the below list
*/
if (new_prop && (strncmp(new_prop->name, "status", new_prop->length) ||
strncmp(new_prop->name, "ibm,max-sg-len", new_prop->length) ||
strncmp(new_prop->name, "ibm,max-sync-cop", new_prop->length)))
goto out;

/* Perform property updates */
ret = nx842_OF_upd_status(new_devdata, status);
Expand Down
1 change: 1 addition & 0 deletions drivers/of/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
obj-y = base.o device.o platform.o
obj-$(CONFIG_OF_DYNAMIC) += dynamic.o
obj-$(CONFIG_OF_FLATTREE) += fdt.o
obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o
obj-$(CONFIG_OF_PROMTREE) += pdt.o
Expand Down
Loading

0 comments on commit 663d3f7

Please sign in to comment.