[PATCH v5 02/23] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments

Lukasz Luba posted 23 patches 2 years ago
There is a newer version of this series
[PATCH v5 02/23] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments
Posted by Lukasz Luba 2 years ago
In order to prepare the code for the modifiable EM perf_state table,
refactor existing function em_cpufreq_update_efficiencies().

Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
 kernel/power/energy_model.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index 8b9dd4a39f63..42486674b834 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -237,10 +237,10 @@ static int em_create_pd(struct device *dev, int nr_states,
 	return 0;
 }
 
-static void em_cpufreq_update_efficiencies(struct device *dev)
+static void
+em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *table)
 {
 	struct em_perf_domain *pd = dev->em_pd;
-	struct em_perf_state *table;
 	struct cpufreq_policy *policy;
 	int found = 0;
 	int i;
@@ -254,8 +254,6 @@ static void em_cpufreq_update_efficiencies(struct device *dev)
 		return;
 	}
 
-	table = pd->table;
-
 	for (i = 0; i < pd->nr_perf_states; i++) {
 		if (!(table[i].flags & EM_PERF_STATE_INEFFICIENT))
 			continue;
@@ -397,7 +395,7 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
 
 	dev->em_pd->flags |= flags;
 
-	em_cpufreq_update_efficiencies(dev);
+	em_cpufreq_update_efficiencies(dev, dev->em_pd->table);
 
 	em_debug_create_pd(dev);
 	dev_info(dev, "EM: created perf domain\n");
-- 
2.25.1
Re: [PATCH v5 02/23] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments
Posted by Qais Yousef 2 years ago
On 11/29/23 11:08, Lukasz Luba wrote:
> In order to prepare the code for the modifiable EM perf_state table,
> refactor existing function em_cpufreq_update_efficiencies().

nit: What is being refactored here? The description is not adding much info
about the change.


Cheers

--
Qais Yousef

> 
> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
> ---
>  kernel/power/energy_model.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
> index 8b9dd4a39f63..42486674b834 100644
> --- a/kernel/power/energy_model.c
> +++ b/kernel/power/energy_model.c
> @@ -237,10 +237,10 @@ static int em_create_pd(struct device *dev, int nr_states,
>  	return 0;
>  }
>  
> -static void em_cpufreq_update_efficiencies(struct device *dev)
> +static void
> +em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *table)
>  {
>  	struct em_perf_domain *pd = dev->em_pd;
> -	struct em_perf_state *table;
>  	struct cpufreq_policy *policy;
>  	int found = 0;
>  	int i;
> @@ -254,8 +254,6 @@ static void em_cpufreq_update_efficiencies(struct device *dev)
>  		return;
>  	}
>  
> -	table = pd->table;
> -
>  	for (i = 0; i < pd->nr_perf_states; i++) {
>  		if (!(table[i].flags & EM_PERF_STATE_INEFFICIENT))
>  			continue;
> @@ -397,7 +395,7 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
>  
>  	dev->em_pd->flags |= flags;
>  
> -	em_cpufreq_update_efficiencies(dev);
> +	em_cpufreq_update_efficiencies(dev, dev->em_pd->table);
>  
>  	em_debug_create_pd(dev);
>  	dev_info(dev, "EM: created perf domain\n");
> -- 
> 2.25.1
>
Re: [PATCH v5 02/23] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments
Posted by Lukasz Luba 1 year, 12 months ago

On 12/17/23 17:58, Qais Yousef wrote:
> On 11/29/23 11:08, Lukasz Luba wrote:
>> In order to prepare the code for the modifiable EM perf_state table,
>> refactor existing function em_cpufreq_update_efficiencies().
> 
> nit: What is being refactored here? The description is not adding much info
> about the change.

The function takes the ptr to the table now as its argument. You have
missed that in the code below?

> 
> 
> Cheers
> 
> --
> Qais Yousef
> 
>>
>> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
>> ---
>>   kernel/power/energy_model.c | 8 +++-----
>>   1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
>> index 8b9dd4a39f63..42486674b834 100644
>> --- a/kernel/power/energy_model.c
>> +++ b/kernel/power/energy_model.c
>> @@ -237,10 +237,10 @@ static int em_create_pd(struct device *dev, int nr_states,
>>   	return 0;
>>   }
>>   
>> -static void em_cpufreq_update_efficiencies(struct device *dev)
>> +static void
>> +em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *table)
>>   {
>>   	struct em_perf_domain *pd = dev->em_pd;
>> -	struct em_perf_state *table;
>>   	struct cpufreq_policy *policy;
>>   	int found = 0;
>>   	int i;
>> @@ -254,8 +254,6 @@ static void em_cpufreq_update_efficiencies(struct device *dev)
>>   		return;
>>   	}
>>   
>> -	table = pd->table;
>> -
>>   	for (i = 0; i < pd->nr_perf_states; i++) {
>>   		if (!(table[i].flags & EM_PERF_STATE_INEFFICIENT))
>>   			continue;
>> @@ -397,7 +395,7 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
>>   
>>   	dev->em_pd->flags |= flags;
>>   
>> -	em_cpufreq_update_efficiencies(dev);
>> +	em_cpufreq_update_efficiencies(dev, dev->em_pd->table);
>>   
>>   	em_debug_create_pd(dev);
>>   	dev_info(dev, "EM: created perf domain\n");
>> -- 
>> 2.25.1
>>
>
Re: [PATCH v5 02/23] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments
Posted by Qais Yousef 1 year, 11 months ago
On 12/19/23 10:30, Lukasz Luba wrote:
> 
> 
> On 12/17/23 17:58, Qais Yousef wrote:
> > On 11/29/23 11:08, Lukasz Luba wrote:
> > > In order to prepare the code for the modifiable EM perf_state table,
> > > refactor existing function em_cpufreq_update_efficiencies().
> > 
> > nit: What is being refactored here? The description is not adding much info
> > about the change.
> 
> The function takes the ptr to the table now as its argument. You have
> missed that in the code below?

I meant the commit message could be more descriptive if you care to expand on
it.
Re: [PATCH v5 02/23] PM: EM: Refactor em_cpufreq_update_efficiencies() arguments
Posted by Lukasz Luba 1 year, 11 months ago

On 12/28/23 16:59, Qais Yousef wrote:
> On 12/19/23 10:30, Lukasz Luba wrote:
>>
>>
>> On 12/17/23 17:58, Qais Yousef wrote:
>>> On 11/29/23 11:08, Lukasz Luba wrote:
>>>> In order to prepare the code for the modifiable EM perf_state table,
>>>> refactor existing function em_cpufreq_update_efficiencies().
>>>
>>> nit: What is being refactored here? The description is not adding much info
>>> about the change.
>>
>> The function takes the ptr to the table now as its argument. You have
>> missed that in the code below?
> 
> I meant the commit message could be more descriptive if you care to expand on
> it.

I see, yes I will adjust the comment.