Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35f80deb authored by Nathan Fontenot's avatar Nathan Fontenot Committed by Michael Ellerman
Browse files

powerpc/numa: Look up device node in of_get_assoc_arrays()



Look up the device node for the associativity array property instead
of having it passed in as a parameter. This changes precedes an update
in which the calling routines for of_get_assoc_arrays() will not have
the device node pointer to pass in.

Signed-off-by: default avatarNathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 6ed36158
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -466,19 +466,27 @@ struct assoc_arrays {
 * indicating the size of each associativity array, followed by a list
 * of N associativity arrays.
 */
static int of_get_assoc_arrays(struct device_node *memory,
			       struct assoc_arrays *aa)
static int of_get_assoc_arrays(struct assoc_arrays *aa)
{
	struct device_node *memory;
	const __be32 *prop;
	u32 len;

	memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
	if (!memory)
		return -1;

	prop = of_get_property(memory, "ibm,associativity-lookup-arrays", &len);
	if (!prop || len < 2 * sizeof(unsigned int))
	if (!prop || len < 2 * sizeof(unsigned int)) {
		of_node_put(memory);
		return -1;
	}

	aa->n_arrays = of_read_number(prop++, 1);
	aa->array_sz = of_read_number(prop++, 1);

	of_node_put(memory);

	/* Now that we know the number of arrays and size of each array,
	 * revalidate the size of the property read in.
	 */
@@ -661,7 +669,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
	if (!lmb_size)
		return;

	rc = of_get_assoc_arrays(memory, &aa);
	rc = of_get_assoc_arrays(&aa);
	if (rc)
		return;

@@ -996,7 +1004,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
	if (!lmb_size)
		return -1;

	rc = of_get_assoc_arrays(memory, &aa);
	rc = of_get_assoc_arrays(&aa);
	if (rc)
		return -1;