[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <423a76300ccc9a8fa9e825cab56d4d36@codeaurora.org>
Date: Fri, 29 May 2020 17:09:51 +0530
From: Sibi Sankar <sibis@...eaurora.org>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Georgi Djakov <georgi.djakov@...aro.org>, vireshk@...nel.org,
nm@...com, sboyd@...nel.org, rjw@...ysocki.net,
saravanak@...gle.com, mka@...omium.org, robh+dt@...nel.org,
rnayak@...eaurora.org, bjorn.andersson@...aro.org,
vincent.guittot@...aro.org, jcrouse@...eaurora.org,
evgreen@...omium.org, linux-pm@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 04/10] OPP: Add support for parsing interconnect
bandwidth
On 2020-05-29 10:14, Viresh Kumar wrote:
> On 12-05-20, 15:53, Georgi Djakov wrote:
>> struct dev_pm_opp *_opp_allocate(struct opp_table *table)
>> {
>> struct dev_pm_opp *opp;
>> - int count, supply_size;
>> + int supply_count, supply_size, icc_size;
>>
>> /* Allocate space for at least one supply */
>> - count = table->regulator_count > 0 ? table->regulator_count : 1;
>> - supply_size = sizeof(*opp->supplies) * count;
>> + supply_count = table->regulator_count > 0 ? table->regulator_count :
>> 1;
>> + supply_size = sizeof(*opp->supplies) * supply_count;
>> + icc_size = sizeof(*opp->bandwidth) * table->path_count;
>>
>> /* allocate new OPP node and supplies structures */
>> - opp = kzalloc(sizeof(*opp) + supply_size, GFP_KERNEL);
>> + opp = kzalloc(sizeof(*opp) + supply_size + icc_size, GFP_KERNEL);
>> +
>> if (!opp)
>> return NULL;
>>
>> /* Put the supplies at the end of the OPP structure as an empty
>> array */
>> opp->supplies = (struct dev_pm_opp_supply *)(opp + 1);
>> + opp->bandwidth = (struct dev_pm_opp_icc_bw *)(opp->supplies +
>> supply_count);
>> INIT_LIST_HEAD(&opp->node);
>
> Added this delta here.
>
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 7302f2631f8d..dfbd3d10410c 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -1330,7 +1330,8 @@ struct dev_pm_opp *_opp_allocate(struct opp_table
> *table)
>
> /* Put the supplies at the end of the OPP structure as an empty
> array */
> opp->supplies = (struct dev_pm_opp_supply *)(opp + 1);
> - opp->bandwidth = (struct dev_pm_opp_icc_bw *)(opp->supplies +
> supply_count);
> + if (icc_size)
> + opp->bandwidth = (struct dev_pm_opp_icc_bw
> *)(opp->supplies + supply_count);
nice catch!
Reviewed-by: Sibi Sankar <sibis@...eaurora.org>
> INIT_LIST_HEAD(&opp->node);
>
> return opp;
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
Powered by blists - more mailing lists