dlpar.c (c0d625cbb541ae68ca3c97fb62f5f6093d3382fa) dlpar.c (06bacefcbd5f91efb7ffedc17615fa188d6ce406)
1/*
2 * Support for dynamic reconfiguration for PCI, Memory, and CPU
3 * Hotplug and Dynamic Logical Partitioning on RPA platforms.
4 *
5 * Copyright (C) 2009 Nathan Fontenot
6 * Copyright (C) 2009 IBM Corporation
7 *
8 * This program is free software; you can redistribute it and/or

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

13#define pr_fmt(fmt) "dlpar: " fmt
14
15#include <linux/kernel.h>
16#include <linux/notifier.h>
17#include <linux/spinlock.h>
18#include <linux/cpu.h>
19#include <linux/slab.h>
20#include <linux/of.h>
1/*
2 * Support for dynamic reconfiguration for PCI, Memory, and CPU
3 * Hotplug and Dynamic Logical Partitioning on RPA platforms.
4 *
5 * Copyright (C) 2009 Nathan Fontenot
6 * Copyright (C) 2009 IBM Corporation
7 *
8 * This program is free software; you can redistribute it and/or

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

13#define pr_fmt(fmt) "dlpar: " fmt
14
15#include <linux/kernel.h>
16#include <linux/notifier.h>
17#include <linux/spinlock.h>
18#include <linux/cpu.h>
19#include <linux/slab.h>
20#include <linux/of.h>
21
22#include "of_helpers.h"
21#include "offline_states.h"
22#include "pseries.h"
23
24#include <asm/prom.h>
25#include <asm/machdep.h>
26#include <asm/uaccess.h>
27#include <asm/rtas.h>
28

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

239 dlpar_free_cc_nodes(first_dn);
240
241 return NULL;
242 }
243
244 return first_dn;
245}
246
23#include "offline_states.h"
24#include "pseries.h"
25
26#include <asm/prom.h>
27#include <asm/machdep.h>
28#include <asm/uaccess.h>
29#include <asm/rtas.h>
30

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

241 dlpar_free_cc_nodes(first_dn);
242
243 return NULL;
244 }
245
246 return first_dn;
247}
248
247static struct device_node *derive_parent(const char *path)
248{
249 struct device_node *parent;
250 char *last_slash;
251
252 last_slash = strrchr(path, '/');
253 if (last_slash == path) {
254 parent = of_find_node_by_path("/");
255 } else {
256 char *parent_path;
257 int parent_path_len = last_slash - path + 1;
258 parent_path = kmalloc(parent_path_len, GFP_KERNEL);
259 if (!parent_path)
260 return NULL;
261
262 strlcpy(parent_path, path, parent_path_len);
263 parent = of_find_node_by_path(parent_path);
264 kfree(parent_path);
265 }
266
267 return parent;
268}
269
270int dlpar_attach_node(struct device_node *dn)
271{
272 int rc;
273
249int dlpar_attach_node(struct device_node *dn)
250{
251 int rc;
252
274 dn->parent = derive_parent(dn->full_name);
275 if (!dn->parent)
276 return -ENOMEM;
253 dn->parent = pseries_of_derive_parent(dn->full_name);
254 if (IS_ERR(dn->parent))
255 return PTR_ERR(dn->parent);
277
278 rc = of_attach_node(dn);
279 if (rc) {
280 printk(KERN_ERR "Failed to add device node %s\n",
281 dn->full_name);
282 return rc;
283 }
284

--- 376 unchanged lines hidden ---
256
257 rc = of_attach_node(dn);
258 if (rc) {
259 printk(KERN_ERR "Failed to add device node %s\n",
260 dn->full_name);
261 return rc;
262 }
263

--- 376 unchanged lines hidden ---