Deleted Added
full compact
livetree.c (204431) livetree.c (204433)
1/*
2 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
3 *
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.

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

288
289cell_t get_node_phandle(struct node *root, struct node *node)
290{
291 static cell_t phandle = 1; /* FIXME: ick, static local */
292
293 if ((node->phandle != 0) && (node->phandle != -1))
294 return node->phandle;
295
1/*
2 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
3 *
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.

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

288
289cell_t get_node_phandle(struct node *root, struct node *node)
290{
291 static cell_t phandle = 1; /* FIXME: ick, static local */
292
293 if ((node->phandle != 0) && (node->phandle != -1))
294 return node->phandle;
295
296 assert(! get_property(node, "linux,phandle"));
297
298 while (get_node_by_phandle(root, phandle))
299 phandle++;
300
301 node->phandle = phandle;
296 while (get_node_by_phandle(root, phandle))
297 phandle++;
298
299 node->phandle = phandle;
302 add_property(node,
303 build_property("linux,phandle",
304 data_append_cell(empty_data, phandle),
305 NULL));
306
300
301 if (!get_property(node, "linux,phandle")
302 && (phandle_format & PHANDLE_LEGACY))
303 add_property(node,
304 build_property("linux,phandle",
305 data_append_cell(empty_data, phandle),
306 NULL));
307
308 if (!get_property(node, "phandle")
309 && (phandle_format & PHANDLE_EPAPR))
310 add_property(node,
311 build_property("phandle",
312 data_append_cell(empty_data, phandle),
313 NULL));
314
315 /* If the node *does* have a phandle property, we must
316 * be dealing with a self-referencing phandle, which will be
317 * fixed up momentarily in the caller */
318
307 return node->phandle;
308}
319 return node->phandle;
320}