* [PATCH v2] cpuidle: Remove unnecessary wrapper cpuidle_get_last_residency()
@ 2018-09-10 19:59 ` Fieah Lim
0 siblings, 0 replies; 3+ messages in thread
From: Fieah Lim @ 2018-09-10 19:59 UTC (permalink / raw)
To: Rafael J. Wysocki, Daniel Lezcano, open list, open list:CPUIDLE DRIVERS
Cc: Fieah Lim
cpuidle_get_last_residency() is just a wrapper for retrieves
device's last_residency, it's also weirdly the only
wrapper function for accessing cpuidle_* struct member,
and my best guess is it could be a leftover from v2.x
Anyhow, since the only two users(ladder and menu governor)
can access dev->last_residency directly, and it's more intuitive,
let's just get rid of it.
This patch tidies up CPU idle driver a bit without functional changes.
Signed-off-by: Fieah Lim <kw@fieahl.im>
---
Changes from v1:
- Rewrite changelog as Rafael J. Wysocki suggested
---
drivers/cpuidle/governors/ladder.c | 2 +-
| 2 +-
include/linux/cpuidle.h | 10 ----------
3 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
index 704880a6612a..f0dddc66af26 100644
--- a/drivers/cpuidle/governors/ladder.c
+++ b/drivers/cpuidle/governors/ladder.c
@@ -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 &&
--git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index 1aef60d160eb..715520e339da 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -492,7 +492,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)
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 4325d6fdde9b..d262f620890e 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -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 *
****************************/
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2] cpuidle: Remove unnecessary wrapper cpuidle_get_last_residency()
@ 2018-09-10 19:59 ` Fieah Lim
0 siblings, 0 replies; 3+ messages in thread
From: Fieah Lim @ 2018-09-10 19:59 UTC (permalink / raw)
To: Rafael J. Wysocki, Daniel Lezcano, open list, open list:CPUIDLE DRIVERS
Cc: Fieah Lim
cpuidle_get_last_residency() is just a wrapper for retrieves
device's last_residency, it's also weirdly the only
wrapper function for accessing cpuidle_* struct member,
and my best guess is it could be a leftover from v2.x
Anyhow, since the only two users(ladder and menu governor)
can access dev->last_residency directly, and it's more intuitive,
let's just get rid of it.
This patch tidies up CPU idle driver a bit without functional changes.
Signed-off-by: Fieah Lim <kw@fieahl.im>
---
Changes from v1:
- Rewrite changelog as Rafael J. Wysocki suggested
---
drivers/cpuidle/governors/ladder.c | 2 +-
| 2 +-
include/linux/cpuidle.h | 10 ----------
3 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
index 704880a6612a..f0dddc66af26 100644
--- a/drivers/cpuidle/governors/ladder.c
+++ b/drivers/cpuidle/governors/ladder.c
@@ -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 &&
--git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index 1aef60d160eb..715520e339da 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -492,7 +492,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)
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 4325d6fdde9b..d262f620890e 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -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 *
****************************/
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] cpuidle: Remove unnecessary wrapper cpuidle_get_last_residency()
2018-09-10 19:59 ` Fieah Lim
(?)
@ 2018-10-03 9:43 ` Rafael J. Wysocki
-1 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2018-10-03 9:43 UTC (permalink / raw)
To: Fieah Lim; +Cc: Daniel Lezcano, open list, open list:CPUIDLE DRIVERS
On Monday, September 10, 2018 9:59:01 PM CEST Fieah Lim wrote:
> cpuidle_get_last_residency() is just a wrapper for retrieves
> device's last_residency, it's also weirdly the only
> wrapper function for accessing cpuidle_* struct member,
> and my best guess is it could be a leftover from v2.x
>
> Anyhow, since the only two users(ladder and menu governor)
> can access dev->last_residency directly, and it's more intuitive,
> let's just get rid of it.
>
> This patch tidies up CPU idle driver a bit without functional changes.
>
> Signed-off-by: Fieah Lim <kw@fieahl.im>
> ---
> Changes from v1:
> - Rewrite changelog as Rafael J. Wysocki suggested
> ---
> drivers/cpuidle/governors/ladder.c | 2 +-
> drivers/cpuidle/governors/menu.c | 2 +-
> include/linux/cpuidle.h | 10 ----------
> 3 files changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
> index 704880a6612a..f0dddc66af26 100644
> --- a/drivers/cpuidle/governors/ladder.c
> +++ b/drivers/cpuidle/governors/ladder.c
> @@ -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 &&
> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
> index 1aef60d160eb..715520e339da 100644
> --- a/drivers/cpuidle/governors/menu.c
> +++ b/drivers/cpuidle/governors/menu.c
> @@ -492,7 +492,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)
> diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
> index 4325d6fdde9b..d262f620890e 100644
> --- a/include/linux/cpuidle.h
> +++ b/include/linux/cpuidle.h
> @@ -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 *
> ****************************/
>
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-03 9:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-10 19:59 [PATCH v2] cpuidle: Remove unnecessary wrapper cpuidle_get_last_residency() Fieah Lim
2018-09-10 19:59 ` Fieah Lim
2018-10-03 9:43 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.