diff mbox series

[4/6] cpuidle: menu: Do not update last_state_idx in menu_select()

Message ID 1940908.mNKd7HXT40@aspire.rjw.lan (mailing list archive)
State Mainlined
Delegated to: Rafael Wysocki
Headers show
Series cpuidle: menu: Fixes, optimizations and cleanups | expand

Commit Message

Rafael J. Wysocki Oct. 2, 2018, 9:45 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

It is not necessary to update data->last_state_idx in menu_select()
as it only is used in menu_update() which only runs when
data->needs_update is set and that is set only when updating
data->last_state_idx in menu_reflect().

Accordingly, drop the update of data->last_state_idx from
menu_select() and get rid of the (now redundant) "out" label
from it.

No intentional behavior changes.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpuidle/governors/menu.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Daniel Lezcano Oct. 4, 2018, 2:57 p.m. UTC | #1
On Tue, Oct 02, 2018 at 11:45:07PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> It is not necessary to update data->last_state_idx in menu_select()
> as it only is used in menu_update() which only runs when
> data->needs_update is set and that is set only when updating
> data->last_state_idx in menu_reflect().
> 
> Accordingly, drop the update of data->last_state_idx from
> menu_select() and get rid of the (now redundant) "out" label
> from it.
> 
> No intentional behavior changes.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
diff mbox series

Patch

Index: linux-pm/drivers/cpuidle/governors/menu.c
===================================================================
--- linux-pm.orig/drivers/cpuidle/governors/menu.c
+++ linux-pm/drivers/cpuidle/governors/menu.c
@@ -398,7 +398,7 @@  static int menu_select(struct cpuidle_dr
 			    s->target_residency <= ktime_to_us(delta_next))
 				idx = i;
 
-			goto out;
+			return idx;
 		}
 		if (s->exit_latency > latency_req) {
 			/*
@@ -445,10 +445,7 @@  static int menu_select(struct cpuidle_dr
 		}
 	}
 
-out:
-	data->last_state_idx = idx;
-
-	return data->last_state_idx;
+	return idx;
 }
 
 /**