diff mbox

cpu: cpufreq: make small one-line helper functions inline

Message ID 20170510092700.18357-1-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King May 10, 2017, 9:27 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

We may as way hint to the compiler that the tiny one-line helper
functions cpu_set_lowest_frequency and cpu_set_highest_frequency
can be inlined. They probably are already, but hinting it may be
useful.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/cpu/cpufreq/cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alex Hung May 11, 2017, 1:24 a.m. UTC | #1
On 2017-05-10 02:27 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> We may as way hint to the compiler that the tiny one-line helper
> functions cpu_set_lowest_frequency and cpu_set_highest_frequency
> can be inlined. They probably are already, but hinting it may be
> useful.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/cpu/cpufreq/cpufreq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index 1cfac3aa..630d0cdf 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -136,12 +136,12 @@ out:
>  	return rc;
>  }
>
> -static int cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu)
> +static inline int cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu)
>  {
>  	return cpu_set_frequency(fw, cpu, cpu->freqs[0].Hz);
>  }
>
> -static int cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu)
> +static inline int cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu)
>  {
>  	return cpu_set_frequency(fw, cpu, cpu->freqs[cpu->n_freqs-1].Hz);
>  }
>

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu May 23, 2017, 6:50 a.m. UTC | #2
On 05/10/2017 05:27 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> We may as way hint to the compiler that the tiny one-line helper
> functions cpu_set_lowest_frequency and cpu_set_highest_frequency
> can be inlined. They probably are already, but hinting it may be
> useful.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/cpu/cpufreq/cpufreq.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index 1cfac3aa..630d0cdf 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -136,12 +136,12 @@ out:
>   	return rc;
>   }
>   
> -static int cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu)
> +static inline int cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu)
>   {
>   	return cpu_set_frequency(fw, cpu, cpu->freqs[0].Hz);
>   }
>   
> -static int cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu)
> +static inline int cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu)
>   {
>   	return cpu_set_frequency(fw, cpu, cpu->freqs[cpu->n_freqs-1].Hz);
>   }

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox

Patch

diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
index 1cfac3aa..630d0cdf 100644
--- a/src/cpu/cpufreq/cpufreq.c
+++ b/src/cpu/cpufreq/cpufreq.c
@@ -136,12 +136,12 @@  out:
 	return rc;
 }
 
-static int cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu)
+static inline int cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu)
 {
 	return cpu_set_frequency(fw, cpu, cpu->freqs[0].Hz);
 }
 
-static int cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu)
+static inline int cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu)
 {
 	return cpu_set_frequency(fw, cpu, cpu->freqs[cpu->n_freqs-1].Hz);
 }