diff mbox series

[2/4] interconnect: Always call pre_aggregate before aggregate

Message ID 20210625212839.24155-3-mdtipton@codeaurora.org (mailing list archive)
State Superseded, archived
Headers show
Series interconnect: Fix sync-state issues | expand

Commit Message

Mike Tipton June 25, 2021, 9:28 p.m. UTC
The pre_aggregate callback isn't called in all cases before calling
aggregate. Add the missing calls so providers can rely on consistent
framework behavior.

Fixes: d3703b3e255f ("interconnect: Aggregate before setting initial bandwidth")
Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
---
 drivers/interconnect/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Odelu Kukatla July 1, 2021, 6:55 p.m. UTC | #1
On 2021-06-26 02:58, Mike Tipton wrote:
> The pre_aggregate callback isn't called in all cases before calling
> aggregate. Add the missing calls so providers can rely on consistent
> framework behavior.
> 
> Fixes: d3703b3e255f ("interconnect: Aggregate before setting initial 
> bandwidth")
> Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
> ---
>  drivers/interconnect/core.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
> index 945121e18b5c..cfd54c90a6bb 100644
> --- a/drivers/interconnect/core.c
> +++ b/drivers/interconnect/core.c
> @@ -973,9 +973,12 @@ void icc_node_add(struct icc_node *node, struct
> icc_provider *provider)
>  	}
>  	node->avg_bw = node->init_avg;
>  	node->peak_bw = node->init_peak;
> -	if (provider->aggregate)
> +	if (provider->aggregate) {
> +		if (provider->pre_aggregate)
> +			provider->pre_aggregate(node);
nit: we can invoke pre_aggregate() out side of if (qcom_icc_aggregate).

>  		provider->aggregate(node, 0, node->init_avg, node->init_peak,
>  				    &node->avg_bw, &node->peak_bw);
> +	}
>  	provider->set(node, node);
>  	node->avg_bw = 0;
>  	node->peak_bw = 0;
Mike Tipton July 12, 2021, 3:39 p.m. UTC | #2
On 7/1/2021 11:55 AM, okukatla@codeaurora.org wrote:
> On 2021-06-26 02:58, Mike Tipton wrote:
>> The pre_aggregate callback isn't called in all cases before calling
>> aggregate. Add the missing calls so providers can rely on consistent
>> framework behavior.
>>
>> Fixes: d3703b3e255f ("interconnect: Aggregate before setting initial 
>> bandwidth")
>> Signed-off-by: Mike Tipton <mdtipton@codeaurora.org>
>> ---
>>  drivers/interconnect/core.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
>> index 945121e18b5c..cfd54c90a6bb 100644
>> --- a/drivers/interconnect/core.c
>> +++ b/drivers/interconnect/core.c
>> @@ -973,9 +973,12 @@ void icc_node_add(struct icc_node *node, struct
>> icc_provider *provider)
>>      }
>>      node->avg_bw = node->init_avg;
>>      node->peak_bw = node->init_peak;
>> -    if (provider->aggregate)
>> +    if (provider->aggregate) {
>> +        if (provider->pre_aggregate)
>> +            provider->pre_aggregate(node);
> nit: we can invoke pre_aggregate() out side of if (qcom_icc_aggregate).

Sure, will update this.

> 
>>          provider->aggregate(node, 0, node->init_avg, node->init_peak,
>>                      &node->avg_bw, &node->peak_bw);
>> +    }
>>      provider->set(node, node);
>>      node->avg_bw = 0;
>>      node->peak_bw = 0;
diff mbox series

Patch

diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index 945121e18b5c..cfd54c90a6bb 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -973,9 +973,12 @@  void icc_node_add(struct icc_node *node, struct icc_provider *provider)
 	}
 	node->avg_bw = node->init_avg;
 	node->peak_bw = node->init_peak;
-	if (provider->aggregate)
+	if (provider->aggregate) {
+		if (provider->pre_aggregate)
+			provider->pre_aggregate(node);
 		provider->aggregate(node, 0, node->init_avg, node->init_peak,
 				    &node->avg_bw, &node->peak_bw);
+	}
 	provider->set(node, node);
 	node->avg_bw = 0;
 	node->peak_bw = 0;