reconfig.c (2d8ad8719591fa803b0d589ed057fa46f49b7155) reconfig.c (3aef19f0a10d1c274a15191766b627fe550d456e)
1/*
2 * pSeries_reconfig.c - support for dynamic reconfiguration (including PCI
3 * Hotplug and Dynamic Logical Partitioning on RPA platforms).
4 *
5 * Copyright (C) 2005 Nathan Lynch
6 * Copyright (C) 2005 IBM Corporation
7 *
8 *

--- 83 unchanged lines hidden (view full) ---

92 parent = of_find_node_by_path(parent_path);
93 if (!parent)
94 return ERR_PTR(-EINVAL);
95 if (strcmp(parent_path, "/"))
96 kfree(parent_path);
97 return parent;
98}
99
1/*
2 * pSeries_reconfig.c - support for dynamic reconfiguration (including PCI
3 * Hotplug and Dynamic Logical Partitioning on RPA platforms).
4 *
5 * Copyright (C) 2005 Nathan Lynch
6 * Copyright (C) 2005 IBM Corporation
7 *
8 *

--- 83 unchanged lines hidden (view full) ---

92 parent = of_find_node_by_path(parent_path);
93 if (!parent)
94 return ERR_PTR(-EINVAL);
95 if (strcmp(parent_path, "/"))
96 kfree(parent_path);
97 return parent;
98}
99
100BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
100static BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
101
102int pSeries_reconfig_notifier_register(struct notifier_block *nb)
103{
104 return blocking_notifier_chain_register(&pSeries_reconfig_chain, nb);
105}
106
107void pSeries_reconfig_notifier_unregister(struct notifier_block *nb)
108{
109 blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb);
110}
111
101
102int pSeries_reconfig_notifier_register(struct notifier_block *nb)
103{
104 return blocking_notifier_chain_register(&pSeries_reconfig_chain, nb);
105}
106
107void pSeries_reconfig_notifier_unregister(struct notifier_block *nb)
108{
109 blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb);
110}
111
112int pSeries_reconfig_notify(unsigned long action, void *p)
113{
114 int err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
115 action, p);
116
117 if (err == NOTIFY_BAD)
118 return -ENOMEM; /* For now, safe to assume kmalloc failure */
119 return 0;
120}
121
112static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
113{
114 struct device_node *np;
115 int err = -ENOMEM;
116
117 np = kzalloc(sizeof(*np), GFP_KERNEL);
118 if (!np)
119 goto out_err;

--- 7 unchanged lines hidden (view full) ---

127 kref_init(&np->kref);
128
129 np->parent = derive_parent(path);
130 if (IS_ERR(np->parent)) {
131 err = PTR_ERR(np->parent);
132 goto out_err;
133 }
134
122static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
123{
124 struct device_node *np;
125 int err = -ENOMEM;
126
127 np = kzalloc(sizeof(*np), GFP_KERNEL);
128 if (!np)
129 goto out_err;

--- 7 unchanged lines hidden (view full) ---

137 kref_init(&np->kref);
138
139 np->parent = derive_parent(path);
140 if (IS_ERR(np->parent)) {
141 err = PTR_ERR(np->parent);
142 goto out_err;
143 }
144
135 err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
136 PSERIES_RECONFIG_ADD, np);
137 if (err == NOTIFY_BAD) {
145 err = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, np);
146 if (err) {
138 printk(KERN_ERR "Failed to add device node %s\n", path);
147 printk(KERN_ERR "Failed to add device node %s\n", path);
139 err = -ENOMEM; /* For now, safe to assume kmalloc failure */
140 goto out_err;
141 }
142
143 of_attach_node(np);
144
145 add_node_proc_entries(np);
146
147 of_node_put(np->parent);

--- 20 unchanged lines hidden (view full) ---

168 if ((child = of_get_next_child(np, NULL))) {
169 of_node_put(child);
170 of_node_put(parent);
171 return -EBUSY;
172 }
173
174 remove_node_proc_entries(np);
175
148 goto out_err;
149 }
150
151 of_attach_node(np);
152
153 add_node_proc_entries(np);
154
155 of_node_put(np->parent);

--- 20 unchanged lines hidden (view full) ---

176 if ((child = of_get_next_child(np, NULL))) {
177 of_node_put(child);
178 of_node_put(parent);
179 return -EBUSY;
180 }
181
182 remove_node_proc_entries(np);
183
176 blocking_notifier_call_chain(&pSeries_reconfig_chain,
177 PSERIES_RECONFIG_REMOVE, np);
184 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, np);
178 of_detach_node(np);
179
180 of_node_put(parent);
181 of_node_put(np); /* Must decrement the refcount */
182 return 0;
183}
184
185/*

--- 281 unchanged lines hidden (view full) ---

467 if (!next_prop)
468 return -EINVAL;
469
470 if (!strcmp(name, "add"))
471 action = PSERIES_DRCONF_MEM_ADD;
472 else
473 action = PSERIES_DRCONF_MEM_REMOVE;
474
185 of_detach_node(np);
186
187 of_node_put(parent);
188 of_node_put(np); /* Must decrement the refcount */
189 return 0;
190}
191
192/*

--- 281 unchanged lines hidden (view full) ---

474 if (!next_prop)
475 return -EINVAL;
476
477 if (!strcmp(name, "add"))
478 action = PSERIES_DRCONF_MEM_ADD;
479 else
480 action = PSERIES_DRCONF_MEM_REMOVE;
481
475 rc = blocking_notifier_call_chain(&pSeries_reconfig_chain,
476 action, value);
477 if (rc == NOTIFY_BAD) {
478 rc = prom_update_property(np, oldprop, newprop);
479 return -ENOMEM;
482 rc = pSeries_reconfig_notify(action, value);
483 if (rc) {
484 prom_update_property(np, oldprop, newprop);
485 return rc;
480 }
481 }
482
483 return 0;
484}
485
486/**
487 * ofdt_write - perform operations on the Open Firmware device tree

--- 73 unchanged lines hidden ---
486 }
487 }
488
489 return 0;
490}
491
492/**
493 * ofdt_write - perform operations on the Open Firmware device tree

--- 73 unchanged lines hidden ---