All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Peter Geis <pgwipeout@gmail.com>,
	Nicolas Chauvet <kwizart@gmail.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Kevin Hilman <khilman@kernel.org>,
	Peter De Schrijver <pdeschrijver@nvidia.com>,
	Viresh Kumar <vireshk@kernel.org>,
	Stephen Boyd <sboyd@kernel.org>, Nishanth Menon <nm@ti.com>,
	Yangtao Li <tiny.windzz@gmail.com>,
	Matt Merhar <mattmerhar@protonmail.com>,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH v4 4/4] opp: Make _set_opp_custom() work without regulators
Date: Fri, 22 Jan 2021 17:44:54 +0300	[thread overview]
Message-ID: <688c9aea-62b3-b52b-fee0-0d78cb28443d@gmail.com> (raw)
In-Reply-To: <20210122072626.mlbthef43hjldnyr@vireshk-i7>

22.01.2021 10:26, Viresh Kumar пишет:
> On 21-01-21, 01:26, Dmitry Osipenko wrote:
>> Check whether OPP table has regulators in _set_opp_custom() and set up
>> dev_pm_set_opp_data accordingly. Now _set_opp_custom() works properly,
>> i.e. it doesn't crash if OPP table doesn't have assigned regulators.
>>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
>>  drivers/opp/core.c | 26 +++++++++++++++++---------
>>  1 file changed, 17 insertions(+), 9 deletions(-)
> 
> I have applied this instead:
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 32d653774adc..805fc2602808 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -828,24 +828,31 @@ static int _set_opp_custom(const struct opp_table *opp_table,
>                            struct dev_pm_opp_supply *old_supply,
>                            struct dev_pm_opp_supply *new_supply)
>  {
> -       struct dev_pm_set_opp_data *data;
> +       struct dev_pm_set_opp_data *data = opp_table->set_opp_data;
>         int size;
>  
> -       data = opp_table->set_opp_data;
> +       /*
> +        * We support this only if dev_pm_opp_set_regulators() was called
> +        * earlier.
> +        */
> +       if (opp_table->sod_supplies) {
> +               size = sizeof(*old_supply) * opp_table->regulator_count;
> +               if (!old_supply)
> +                       memset(data->old_opp.supplies, 0, size);
> +               else
> +                       memcpy(data->old_opp.supplies, old_supply, size);
> +
> +               memcpy(data->new_opp.supplies, new_supply, size);
> +               data->regulator_count = opp_table->regulator_count;
> +       } else {
> +               data->regulator_count = 0;
> +       }
> +
>         data->regulators = opp_table->regulators;
> -       data->regulator_count = opp_table->regulator_count;
>         data->clk = opp_table->clk;
>         data->dev = dev;
> -
>         data->old_opp.rate = old_freq;
> -       size = sizeof(*old_supply) * opp_table->regulator_count;
> -       if (!old_supply)
> -               memset(data->old_opp.supplies, 0, size);
> -       else
> -               memcpy(data->old_opp.supplies, old_supply, size);
> -
>         data->new_opp.rate = freq;
> -       memcpy(data->new_opp.supplies, new_supply, size);
>  
>         return opp_table->set_opp(data);
>  }
> 
> 

I replied to the wrong email, but this also looks good :) Thanks!


  reply	other threads:[~2021-01-22 14:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 22:26 [PATCH v4 0/4] OPP API fixes and improvements Dmitry Osipenko
2021-01-20 22:26 ` [PATCH v4 1/4] opp: Export devm_pm_opp_attach_genpd() Dmitry Osipenko
2021-01-20 22:26 ` [PATCH v4 2/4] opp: Add dev_pm_opp_sync_regulators() Dmitry Osipenko
2021-01-25 22:30   ` Dmitry Osipenko
2021-01-27  4:30     ` Viresh Kumar
2021-01-20 22:26 ` [PATCH v4 3/4] opp: Add dev_pm_opp_set_voltage() Dmitry Osipenko
2021-01-20 22:26 ` [PATCH v4 4/4] opp: Make _set_opp_custom() work without regulators Dmitry Osipenko
2021-01-22  7:26   ` Viresh Kumar
2021-01-22 14:44     ` Dmitry Osipenko [this message]
2021-01-22 14:43   ` Dmitry Osipenko
2021-01-22  7:34 ` [PATCH v4 0/4] OPP API fixes and improvements Viresh Kumar
2021-01-27  6:54   ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=688c9aea-62b3-b52b-fee0-0d78cb28443d@gmail.com \
    --to=digetx@gmail.com \
    --cc=broonie@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=khilman@kernel.org \
    --cc=kwizart@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mattmerhar@protonmail.com \
    --cc=nm@ti.com \
    --cc=pdeschrijver@nvidia.com \
    --cc=pgwipeout@gmail.com \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=tiny.windzz@gmail.com \
    --cc=ulf.hansson@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=vireshk@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.