Thread (7 messages) flat view 7 messages, 2 authors, 2013-06-03
STALE4845d

[PATCH 2/4] ARM: tegra: hook tegra_tear_down_cpu function in the PM suspend init function

From: Stephen Warren <hidden>
Date: 2013-06-03 20:31:26
Also in: linux-tegra

On 06/03/2013 05:17 AM, Joseph Lo wrote:
The tegra_tear_down_cpu was used to cut off the CPU rail for various Tegra
SoCs. Hooking it in the PM suspend init function and making the CPUidle
driver more generic.
quoted hunk ↗ jump to hunk
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
+static void tegra_tear_down_cpu_init(void)
+{
+	if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20)
+		tegra_tear_down_cpu = tegra20_tear_down_cpu;
+	if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30)
+		tegra_tear_down_cpu = tegra30_tear_down_cpu;
+}
I think you should use a switch statement there instead:

switch (tegra_chip_id) {
case TEGRA20:
	if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
		tegra_tear_down_cpu = tegra20_tear_down_cpu;
	break;
...

Similar for patch 3/4. This makes it a lot more obvious that it's
selecting an option based on the runtime SoC, rather than just a bunch
of if conditions that each may or may-not be doing similar things.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help