Skip to content

Commit 663d3f7

Browse files
committed
Merge branch 'devicetree/next-overlay' into devicetree/next
Conflicts: drivers/of/testcase-data/testcases.dts
2 parents b775e64 + b6ae5dc commit 663d3f7

14 files changed

Lines changed: 1054 additions & 443 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
A DT changeset is a method which allows one to apply changes
2+
in the live tree in such a way that either the full set of changes
3+
will be applied, or none of them will be. If an error occurs partway
4+
through applying the changeset, then the tree will be rolled back to the
5+
previous state. A changeset can also be removed after it has been
6+
applied.
7+
8+
When a changeset is applied, all of the changes get applied to the tree
9+
at once before emitting OF_RECONFIG notifiers. This is so that the
10+
receiver sees a complete and consistent state of the tree when it
11+
receives the notifier.
12+
13+
The sequence of a changeset is as follows.
14+
15+
1. of_changeset_init() - initializes a changeset
16+
17+
2. A number of DT tree change calls, of_changeset_attach_node(),
18+
of_changeset_detach_node(), of_changeset_add_property(),
19+
of_changeset_remove_property, of_changeset_update_property() to prepare
20+
a set of changes. No changes to the active tree are made at this point.
21+
All the change operations are recorded in the of_changeset 'entries'
22+
list.
23+
24+
3. mutex_lock(of_mutex) - starts a changeset; The global of_mutex
25+
ensures there can only be one editor at a time.
26+
27+
4. of_changeset_apply() - Apply the changes to the tree. Either the
28+
entire changeset will get applied, or if there is an error the tree will
29+
be restored to the previous state
30+
31+
5. mutex_unlock(of_mutex) - All operations complete, release the mutex
32+
33+
If a successfully applied changeset needs to be removed, it can be done
34+
with the following sequence.
35+
36+
1. mutex_lock(of_mutex)
37+
38+
2. of_changeset_revert()
39+
40+
3. mutex_unlock(of_mutex)

‎arch/powerpc/kernel/prom.c‎

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -821,76 +821,6 @@ int cpu_to_chip_id(int cpu)
821821
}
822822
EXPORT_SYMBOL(cpu_to_chip_id);
823823

824-
#ifdef CONFIG_PPC_PSERIES
825-
/*
826-
* Fix up the uninitialized fields in a new device node:
827-
* name, type and pci-specific fields
828-
*/
829-
830-
static int of_finish_dynamic_node(struct device_node *node)
831-
{
832-
struct device_node *parent = of_get_parent(node);
833-
int err = 0;
834-
const phandle *ibm_phandle;
835-
836-
node->name = of_get_property(node, "name", NULL);
837-
node->type = of_get_property(node, "device_type", NULL);
838-
839-
if (!node->name)
840-
node->name = "<NULL>";
841-
if (!node->type)
842-
node->type = "<NULL>";
843-
844-
if (!parent) {
845-
err = -ENODEV;
846-
goto out;
847-
}
848-
849-
/* We don't support that function on PowerMac, at least
850-
* not yet
851-
*/
852-
if (machine_is(powermac))
853-
return -ENODEV;
854-
855-
/* fix up new node's phandle field */
856-
if ((ibm_phandle = of_get_property(node, "ibm,phandle", NULL)))
857-
node->phandle = *ibm_phandle;
858-
859-
out:
860-
of_node_put(parent);
861-
return err;
862-
}
863-
864-
static int prom_reconfig_notifier(struct notifier_block *nb,
865-
unsigned long action, void *node)
866-
{
867-
int err;
868-
869-
switch (action) {
870-
case OF_RECONFIG_ATTACH_NODE:
871-
err = of_finish_dynamic_node(node);
872-
if (err < 0)
873-
printk(KERN_ERR "finish_node returned %d\n", err);
874-
break;
875-
default:
876-
err = 0;
877-
break;
878-
}
879-
return notifier_from_errno(err);
880-
}
881-
882-
static struct notifier_block prom_reconfig_nb = {
883-
.notifier_call = prom_reconfig_notifier,
884-
.priority = 10, /* This one needs to run first */
885-
};
886-
887-
static int __init prom_reconfig_setup(void)
888-
{
889-
return of_reconfig_notifier_register(&prom_reconfig_nb);
890-
}
891-
__initcall(prom_reconfig_setup);
892-
#endif
893-
894824
bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
895825
{
896826
return (int)phys_id == get_hard_smp_processor_id(cpu);

‎arch/powerpc/platforms/pseries/hotplug-memory.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
194194
if (!memblock_size)
195195
return -EINVAL;
196196

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

‎drivers/crypto/nx/nx-842.c‎

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -936,28 +936,14 @@ static int nx842_OF_upd(struct property *new_prop)
936936
goto error_out;
937937
}
938938

939-
/* Set ptr to new property if provided */
940-
if (new_prop) {
941-
/* Single property */
942-
if (!strncmp(new_prop->name, "status", new_prop->length)) {
943-
status = new_prop;
944-
945-
} else if (!strncmp(new_prop->name, "ibm,max-sg-len",
946-
new_prop->length)) {
947-
maxsglen = new_prop;
948-
949-
} else if (!strncmp(new_prop->name, "ibm,max-sync-cop",
950-
new_prop->length)) {
951-
maxsyncop = new_prop;
952-
953-
} else {
954-
/*
955-
* Skip the update, the property being updated
956-
* has no impact.
957-
*/
958-
goto out;
959-
}
960-
}
939+
/*
940+
* If this is a property update, there are only certain properties that
941+
* we care about. Bail if it isn't in the below list
942+
*/
943+
if (new_prop && (strncmp(new_prop->name, "status", new_prop->length) ||
944+
strncmp(new_prop->name, "ibm,max-sg-len", new_prop->length) ||
945+
strncmp(new_prop->name, "ibm,max-sync-cop", new_prop->length)))
946+
goto out;
961947

962948
/* Perform property updates */
963949
ret = nx842_OF_upd_status(new_devdata, status);

‎drivers/of/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
obj-y = base.o device.o platform.o
2+
obj-$(CONFIG_OF_DYNAMIC) += dynamic.o
23
obj-$(CONFIG_OF_FLATTREE) += fdt.o
34
obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o
45
obj-$(CONFIG_OF_PROMTREE) += pdt.o

0 commit comments

Comments
 (0)