public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] MIPS: Introduce set_elf_platform() helper function
@ 2011-04-18 18:37 Kevin Cernekee
  2011-05-11 19:34 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Cernekee @ 2011-04-18 18:37 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Robert Millan, David Daney, wu zhangjin, Aurelien Jarno,
	linux-mips, linux-kernel

From: Robert Millan <rmh@gnu.org>

Replace these sequences:

if (cpu == 0)
	__elf_platform = "foo";

with a trivial inline function.

Signed-off-by: Robert Millan <rmh@gnu.org>
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---

v2: Move the new function into cpu-probe.c .  Retained the "inline"
qualifier because all but one of the other helper functions in
cpu-probe.c use it.

 arch/mips/kernel/cpu-probe.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index f65d4c8..4e4a0fd 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -771,6 +771,12 @@ static void __cpuinit decode_configs(struct cpuinfo_mips *c)
 		c->core = read_c0_ebase() & 0x3ff;
 }
 
+static inline void set_elf_platform(int cpu, const char *plat)
+{
+	if (cpu == 0)
+		__elf_platform = plat;
+}
+
 static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
 {
 	decode_configs(c);
@@ -956,14 +962,12 @@ static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu)
 		c->cputype = CPU_CAVIUM_OCTEON_PLUS;
 		__cpu_name[cpu] = "Cavium Octeon+";
 platform:
-		if (cpu == 0)
-			__elf_platform = "octeon";
+		set_elf_platform(cpu, "octeon");
 		break;
 	case PRID_IMP_CAVIUM_CN63XX:
 		c->cputype = CPU_CAVIUM_OCTEON2;
 		__cpu_name[cpu] = "Cavium Octeon II";
-		if (cpu == 0)
-			__elf_platform = "octeon2";
+		set_elf_platform(cpu, "octeon2");
 		break;
 	default:
 		printk(KERN_INFO "Unknown Octeon chip!\n");
-- 
1.7.4.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] MIPS: Introduce set_elf_platform() helper function
  2011-04-18 18:37 [PATCH v2] MIPS: Introduce set_elf_platform() helper function Kevin Cernekee
@ 2011-05-11 19:34 ` Ralf Baechle
  0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2011-05-11 19:34 UTC (permalink / raw)
  To: Kevin Cernekee
  Cc: Robert Millan, David Daney, wu zhangjin, Aurelien Jarno,
	linux-mips, linux-kernel

Thanks, queued for 2.6.40.

  Ralf

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-11 19:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18 18:37 [PATCH v2] MIPS: Introduce set_elf_platform() helper function Kevin Cernekee
2011-05-11 19:34 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox