]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
cpuidle: Remove unnecessary wrapper cpuidle_get_last_residency()
authorFieah Lim <kw@fieahl.im>
Mon, 10 Sep 2018 19:59:01 +0000 (03:59 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 18 Sep 2018 07:24:44 +0000 (09:24 +0200)
cpuidle_get_last_residency() is just a wrapper for retrieving
the last_residency member of struct cpuidle_device.  It's also
weirdly the only wrapper function for accessing cpuidle_* struct
member (by my best guess is it could be a leftover from v2.x).

Anyhow, since the only two users (the ladder and menu governors)
can access dev->last_residency directly, and it's more intuitive to
do it that way, let's just get rid of the wrapper.

This patch tidies up CPU idle code a bit without functional changes.

Signed-off-by: Fieah Lim <kw@fieahl.im>
[ rjw: Changelog cleanup ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/governors/ladder.c
drivers/cpuidle/governors/menu.c
include/linux/cpuidle.h

index 704880a6612a76341b4f6746fd109366c940e41d..f0dddc66af26087b8d0c380fab157946058bc612 100644 (file)
@@ -80,7 +80,7 @@ static int ladder_select_state(struct cpuidle_driver *drv,
 
        last_state = &ldev->states[last_idx];
 
-       last_residency = cpuidle_get_last_residency(dev) - drv->states[last_idx].exit_latency;
+       last_residency = dev->last_residency - drv->states[last_idx].exit_latency;
 
        /* consider promotion */
        if (last_idx < drv->state_count - 1 &&
index e26a40971b263ed5f5cb113c938f4d9f84109862..021b08dd139c53240877bbe56faa47299e2b5f98 100644 (file)
@@ -514,7 +514,7 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
                measured_us = 9 * MAX_INTERESTING / 10;
        } else {
                /* measured value */
-               measured_us = cpuidle_get_last_residency(dev);
+               measured_us = dev->last_residency;
 
                /* Deduct exit latency */
                if (measured_us > 2 * target->exit_latency)
index 4325d6fdde9b6404b802a320f46678c9918de943..d262f620890efc300712517bb7fb881da415b138 100644 (file)
@@ -99,16 +99,6 @@ struct cpuidle_device {
 DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
 DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev);
 
-/**
- * cpuidle_get_last_residency - retrieves the last state's residency time
- * @dev: the target CPU
- */
-static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
-{
-       return dev->last_residency;
-}
-
-
 /****************************
  * CPUIDLE DRIVER INTERFACE *
  ****************************/