[PATCH] export htab value for kexec on non-lpar - cleaned up patch

Arnd Bergmann arnd at arndb.de
Fri Aug 26 00:49:24 EST 2005


On Dunnersdag 25 August 2005 06:42, R Sharada wrote:
> Nathan,
> 	Thanks for the comments. It makes sense to make then static and more
> appropriately named.
> 	Have done the same and re-posting the patch with those minor changes
>  
> +static void __init export_htab_value(void)
> +{
> +	struct device_node *node;
> +
> +	if (systemcfg->platform == PLATFORM_PSERIES_LPAR)
> +		return;
> +
> +	node = of_find_node_by_path("/chosen");
> +	if (!node)
> +		return;
> +	htab_base_prop.name = "htab_base";
> +	htab_base_prop.length = sizeof(unsigned long);
> +	htab_base = __pa(htab_address);
> +	htab_base_prop.value = &htab_base;
> +	prom_add_property(node, &htab_base_prop);
> +	htab_size_prop.name = "htab_size";
> +	htab_size_prop.length = sizeof(unsigned long);
> +	htab_size = (htab_hash_mask + 1) * HASH_GROUP_SIZE;
> +	htab_size_prop.value = &htab_size;
> +	prom_add_property(node, &htab_size_prop);
> +	of_node_put(node);
> +}

Actually I had been thinking of something more along the lines
of 

static void __init export_htab_value(void)
+{
+	static unsigned long htab_base;
+	static struct property htab_base_prop = {
+		.name = "htab_base",
+		.length = sizeof(unsigned long),
+		.value = &htab_base,
+	};
+
+	static unsigned long htab_size;
+	static struct property htab_size_prop = {
+		.name = "htab_size",
+		.length = sizeof(unsigned long),
+		.value = &htab_size,
+	};
+
+	struct device_node *node;
+	if (systemcfg->platform == PLATFORM_PSERIES_LPAR)
+		return;
+
+	node = of_find_node_by_path("/chosen");
+	if (!node)
+		return;
+
+	htab_base = __pa(htab_address);
+	prom_add_property(node, &htab_base_prop);
+	htab_size = (htab_hash_mask + 1) * HASH_GROUP_SIZE;
+	prom_add_property(node, &htab_size_prop);
+
+	of_node_put(node);
+}

I find this easier to read and it should also result in smaller
code.

	Arnd <><




More information about the Linuxppc64-dev mailing list