[PATCH v8 02/26] memory: tegra20-emc: Use dev_pm_opp_set_clkname()

Viresh Kumar viresh.kumar at linaro.org
Wed Nov 11 05:54:00 UTC 2020


On 11-11-20, 11:15, Viresh Kumar wrote:
> On 11-11-20, 04:14, Dmitry Osipenko wrote:
> > The dev_pm_opp_get_opp_table() shouldn't be used by drivers, use
> > dev_pm_opp_set_clkname() instead.
> > 
> > Suggested-by: Viresh Kumar <viresh.kumar at linaro.org>
> > Signed-off-by: Dmitry Osipenko <digetx at gmail.com>
> > ---
> >  drivers/memory/tegra/tegra20-emc.c | 30 +++++++++++++++++++-----------
> >  1 file changed, 19 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c
> > index 5e10aa97809f..bb3f315c9587 100644
> > --- a/drivers/memory/tegra/tegra20-emc.c
> > +++ b/drivers/memory/tegra/tegra20-emc.c
> > @@ -902,7 +902,7 @@ static int tegra_emc_interconnect_init(struct tegra_emc *emc)
> >  
> >  static int tegra_emc_opp_table_init(struct tegra_emc *emc)
> >  {
> > -	struct opp_table *opp_table;
> > +	struct opp_table *reg_opp_table = NULL, *clk_opp_table;
> >  	const char *rname = "core";
> >  	int err;
> >  
> > @@ -917,19 +917,24 @@ static int tegra_emc_opp_table_init(struct tegra_emc *emc)
> >  	}
> >  
> >  	/* voltage scaling is optional */
> > -	if (device_property_present(emc->dev, "core-supply"))
> > -		opp_table = dev_pm_opp_set_regulators(emc->dev, &rname, 1);
> > -	else
> > -		opp_table = dev_pm_opp_get_opp_table(emc->dev);
> > +	if (device_property_present(emc->dev, "core-supply")) {
> > +		reg_opp_table = dev_pm_opp_set_regulators(emc->dev, &rname, 1);
> > +		if (IS_ERR(reg_opp_table))
> > +			return dev_err_probe(emc->dev, PTR_ERR(reg_opp_table),
> > +					     "failed to set OPP regulator\n");
> > +	}
> >  
> > -	if (IS_ERR(opp_table))
> > -		return dev_err_probe(emc->dev, PTR_ERR(opp_table),
> > -				     "failed to prepare OPP table\n");
> > +	clk_opp_table = dev_pm_opp_set_clkname(emc->dev, NULL);
> > +	err = PTR_ERR_OR_ZERO(clk_opp_table);
> 
> Don't check for NULL here.

My bad. You aren't checking but just converting to err. Its fine.

-- 
viresh


More information about the dri-devel mailing list