linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: benh@kernel.crashing.org, rusty@rustcorp.com.au
Cc: linuxppc-dev@ozlabs.org
Subject: [patch 08/15] powerpc: cpumask: Refactor /proc/cpuinfo code
Date: Tue, 27 Apr 2010 11:32:39 +1000	[thread overview]
Message-ID: <20100427013432.277400577@samba.org> (raw)
In-Reply-To: 20100427013231.510168034@samba.org

This separates the per cpu output from the summary output at the end of the
file, making it easier to convert to the new cpumask API in a subsequent
patch.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-cpumask/arch/powerpc/kernel/setup-common.c
===================================================================
--- linux-cpumask.orig/arch/powerpc/kernel/setup-common.c	2010-04-08 19:46:03.999199713 +1000
+++ linux-cpumask/arch/powerpc/kernel/setup-common.c	2010-04-22 13:03:19.866696740 +1000
@@ -161,43 +161,47 @@ extern u32 cpu_temp_both(unsigned long c
 DEFINE_PER_CPU(unsigned int, cpu_pvr);
 #endif
 
-static int show_cpuinfo(struct seq_file *m, void *v)
+static void show_cpuinfo_summary(struct seq_file *m)
 {
-	unsigned long cpu_id = (unsigned long)v - 1;
-	unsigned int pvr;
-	unsigned short maj;
-	unsigned short min;
-
-	if (cpu_id == NR_CPUS) {
-		struct device_node *root;
-		const char *model = NULL;
+	struct device_node *root;
+	const char *model = NULL;
 #if defined(CONFIG_SMP) && defined(CONFIG_PPC32)
-		unsigned long bogosum = 0;
-		int i;
-		for_each_online_cpu(i)
-			bogosum += loops_per_jiffy;
-		seq_printf(m, "total bogomips\t: %lu.%02lu\n",
-			   bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
+	unsigned long bogosum = 0;
+	int i;
+	for_each_online_cpu(i)
+		bogosum += loops_per_jiffy;
+	seq_printf(m, "total bogomips\t: %lu.%02lu\n",
+		   bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
 #endif /* CONFIG_SMP && CONFIG_PPC32 */
-		seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq);
-		if (ppc_md.name)
-			seq_printf(m, "platform\t: %s\n", ppc_md.name);
-		root = of_find_node_by_path("/");
-		if (root)
-			model = of_get_property(root, "model", NULL);
-		if (model)
-			seq_printf(m, "model\t\t: %s\n", model);
-		of_node_put(root);
+	seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq);
+	if (ppc_md.name)
+		seq_printf(m, "platform\t: %s\n", ppc_md.name);
+	root = of_find_node_by_path("/");
+	if (root)
+		model = of_get_property(root, "model", NULL);
+	if (model)
+		seq_printf(m, "model\t\t: %s\n", model);
+	of_node_put(root);
 
-		if (ppc_md.show_cpuinfo != NULL)
-			ppc_md.show_cpuinfo(m);
+	if (ppc_md.show_cpuinfo != NULL)
+		ppc_md.show_cpuinfo(m);
 
 #ifdef CONFIG_PPC32
-		/* Display the amount of memory */
-		seq_printf(m, "Memory\t\t: %d MB\n",
-			   (unsigned int)(total_memory / (1024 * 1024)));
+	/* Display the amount of memory */
+	seq_printf(m, "Memory\t\t: %d MB\n",
+		   (unsigned int)(total_memory / (1024 * 1024)));
 #endif
+}
 
+static int show_cpuinfo(struct seq_file *m, void *v)
+{
+	unsigned long cpu_id = (unsigned long)v - 1;
+	unsigned int pvr;
+	unsigned short maj;
+	unsigned short min;
+
+	if (cpu_id == NR_CPUS) {
+		show_cpuinfo_summary(m);
 		return 0;
 	}
 

  parent reply	other threads:[~2010-04-27  1:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-27  1:32 [patch 00/15] PowerPC cpumask patches Anton Blanchard
2010-04-27  1:32 ` [patch 01/15] powerpc: cpumask: Use cpu_online_mask Anton Blanchard
2010-04-27  1:32 ` [patch 02/15] powerpc: cpumask: Convert rtasd to new cpumask API Anton Blanchard
2010-04-27  1:32 ` [patch 03/15] powerpc: cpumask: Convert smp_cpus_done " Anton Blanchard
2010-04-28  2:09   ` Stephen Rothwell
2010-04-27  1:32 ` [patch 04/15] powerpc: cpumask: Convert fixup_irqs " Anton Blanchard
2010-04-27  1:32 ` [patch 05/15] powerpc: cpumask: Convert iseries SMP code " Anton Blanchard
2010-04-27  1:32 ` [patch 06/15] powerpc: cpumask: Convert pseries " Anton Blanchard
2010-04-27  1:32 ` [patch 07/15] powerpc: cpumask: Convert xics driver " Anton Blanchard
2010-04-27  1:32 ` Anton Blanchard [this message]
2010-04-27  1:32 ` [patch 09/15] powerpc: cpumask: Convert /proc/cpuinfo " Anton Blanchard
2010-04-27  1:32 ` [patch 10/15] powerpc: cpumask: Dynamically allocate cpu_sibling_map and cpu_core_map cpumasks Anton Blanchard
2010-04-27  1:32 ` [patch 11/15] powerpc: cpumask: Convert hotplug-cpu code to new cpumask API Anton Blanchard
2010-04-27  1:32 ` [patch 12/15] powerpc: cpumask: Convert NUMA " Anton Blanchard
2010-04-27  1:32 ` [patch 13/15] powerpc: cpumask: Update some comments Anton Blanchard
2010-04-27  1:32 ` [patch 14/15] powerpc: cpumask: Convert mpic driver to new cpumask API Anton Blanchard
2010-04-27  1:32 ` [patch 15/15] powerpc: cpumask: Add DEBUG_PER_CPU_MAPS option Anton Blanchard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100427013432.277400577@samba.org \
    --to=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).