2023-10-12 15:21:56

by Ulf Hansson

[permalink] [raw]
Subject: [PATCH 0/5] PM: domains: Drop pm_genpd_opp_to_performance_state()

Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <-> level
dance"), there is no longer any users of the
pm_genpd_opp_to_performance_state() API, while a few genpd providers are still
assigning the redundant ->opp_to_performance_state() callback.

Let's clean this up so we can drop pm_genpd_opp_to_performance_state() and the
callback too.

Rafael, I would like to take this through my pmdomain tree, unless you see a
problem with it ofcourse, hence I need your ack on the last patch in the series.

Kind regards
Uffe


Ulf Hansson (5):
soc/tegra: pmc: Drop the ->opp_to_performance_state() callback
pmdomain: qcom: cpr: Drop the ->opp_to_performance_state() callback
pmdomain: qcom: rpmpd: Drop the ->opp_to_performance_state() callback
pmdomain: qcom: rpmhpd: Drop the ->opp_to_performance_state() callback
PM: domains: Drop the unused pm_genpd_opp_to_performance_state()

drivers/base/power/domain.c | 32 --------------------------------
drivers/pmdomain/qcom/cpr.c | 7 -------
drivers/pmdomain/qcom/rpmhpd.c | 7 -------
drivers/pmdomain/qcom/rpmpd.c | 7 -------
drivers/soc/tegra/pmc.c | 8 --------
include/linux/pm_domain.h | 12 ------------
6 files changed, 73 deletions(-)

--
2.34.1


2023-10-12 15:36:09

by Ulf Hansson

[permalink] [raw]
Subject: [PATCH 1/5] soc/tegra: pmc: Drop the ->opp_to_performance_state() callback

Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <->
level dance"), there is no longer any need for genpd providers to assign
the ->opp_to_performance_state(), hence let's drop it.

Cc: Thierry Reding <[email protected]>
Cc: Jonathan Hunter <[email protected]>
Cc: [email protected]
Signed-off-by: Ulf Hansson <[email protected]>
---
drivers/soc/tegra/pmc.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 162f52456f65..f432aa022ace 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -1393,13 +1393,6 @@ tegra_pmc_core_pd_set_performance_state(struct generic_pm_domain *genpd,
return 0;
}

-static unsigned int
-tegra_pmc_core_pd_opp_to_performance_state(struct generic_pm_domain *genpd,
- struct dev_pm_opp *opp)
-{
- return dev_pm_opp_get_level(opp);
-}
-
static int tegra_pmc_core_pd_add(struct tegra_pmc *pmc, struct device_node *np)
{
struct generic_pm_domain *genpd;
@@ -1412,7 +1405,6 @@ static int tegra_pmc_core_pd_add(struct tegra_pmc *pmc, struct device_node *np)

genpd->name = "core";
genpd->set_performance_state = tegra_pmc_core_pd_set_performance_state;
- genpd->opp_to_performance_state = tegra_pmc_core_pd_opp_to_performance_state;

err = devm_pm_opp_set_regulators(pmc->dev, rname);
if (err)
--
2.34.1

2023-10-12 15:36:25

by Ulf Hansson

[permalink] [raw]
Subject: [PATCH 2/5] pmdomain: qcom: cpr: Drop the ->opp_to_performance_state() callback

Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <->
level dance"), there is no longer any need for genpd providers to assign
the ->opp_to_performance_state(), hence let's drop it.

Cc: Bjorn Andersson <[email protected]>
Cc: Konrad Dybcio <[email protected]>
Cc: [email protected]
Signed-off-by: Ulf Hansson <[email protected]>
---
drivers/pmdomain/qcom/cpr.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/drivers/pmdomain/qcom/cpr.c b/drivers/pmdomain/qcom/cpr.c
index 94a3f0977212..e9dd42bded6f 100644
--- a/drivers/pmdomain/qcom/cpr.c
+++ b/drivers/pmdomain/qcom/cpr.c
@@ -1424,12 +1424,6 @@ static const struct cpr_acc_desc qcs404_cpr_acc_desc = {
.acc_desc = &qcs404_acc_desc,
};

-static unsigned int cpr_get_performance_state(struct generic_pm_domain *genpd,
- struct dev_pm_opp *opp)
-{
- return dev_pm_opp_get_level(opp);
-}
-
static int cpr_power_off(struct generic_pm_domain *domain)
{
struct cpr_drv *drv = container_of(domain, struct cpr_drv, pd);
@@ -1698,7 +1692,6 @@ static int cpr_probe(struct platform_device *pdev)
drv->pd.power_off = cpr_power_off;
drv->pd.power_on = cpr_power_on;
drv->pd.set_performance_state = cpr_set_performance_state;
- drv->pd.opp_to_performance_state = cpr_get_performance_state;
drv->pd.attach_dev = cpr_pd_attach_dev;

ret = pm_genpd_init(&drv->pd, NULL, true);
--
2.34.1

2023-10-12 15:36:33

by Ulf Hansson

[permalink] [raw]
Subject: [PATCH 4/5] pmdomain: qcom: rpmhpd: Drop the ->opp_to_performance_state() callback

Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <->
level dance"), there is no longer any need for genpd providers to assign
the ->opp_to_performance_state(), hence let's drop it.

Cc: Bjorn Andersson <[email protected]>
Cc: Konrad Dybcio <[email protected]>
Cc: [email protected]
Signed-off-by: Ulf Hansson <[email protected]>
---
drivers/pmdomain/qcom/rpmhpd.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/drivers/pmdomain/qcom/rpmhpd.c b/drivers/pmdomain/qcom/rpmhpd.c
index ec2582f7225c..a631fe1f9a06 100644
--- a/drivers/pmdomain/qcom/rpmhpd.c
+++ b/drivers/pmdomain/qcom/rpmhpd.c
@@ -743,12 +743,6 @@ static int rpmhpd_set_performance_state(struct generic_pm_domain *domain,
return ret;
}

-static unsigned int rpmhpd_get_performance_state(struct generic_pm_domain *genpd,
- struct dev_pm_opp *opp)
-{
- return dev_pm_opp_get_level(opp);
-}
-
static int rpmhpd_update_level_mapping(struct rpmhpd *rpmhpd)
{
int i;
@@ -838,7 +832,6 @@ static int rpmhpd_probe(struct platform_device *pdev)
rpmhpds[i]->pd.power_off = rpmhpd_power_off;
rpmhpds[i]->pd.power_on = rpmhpd_power_on;
rpmhpds[i]->pd.set_performance_state = rpmhpd_set_performance_state;
- rpmhpds[i]->pd.opp_to_performance_state = rpmhpd_get_performance_state;
pm_genpd_init(&rpmhpds[i]->pd, NULL, true);

data->domains[i] = &rpmhpds[i]->pd;
--
2.34.1

2023-10-12 15:36:39

by Ulf Hansson

[permalink] [raw]
Subject: [PATCH 3/5] pmdomain: qcom: rpmpd: Drop the ->opp_to_performance_state() callback

Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <->
level dance"), there is no longer any need for genpd providers to assign
the ->opp_to_performance_state(), hence let's drop it.

Cc: Bjorn Andersson <[email protected]>
Cc: Konrad Dybcio <[email protected]>
Cc: [email protected]
Signed-off-by: Ulf Hansson <[email protected]>
---
drivers/pmdomain/qcom/rpmpd.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/drivers/pmdomain/qcom/rpmpd.c b/drivers/pmdomain/qcom/rpmpd.c
index 3135dd1dafe0..524631dcab4b 100644
--- a/drivers/pmdomain/qcom/rpmpd.c
+++ b/drivers/pmdomain/qcom/rpmpd.c
@@ -908,12 +908,6 @@ static int rpmpd_set_performance(struct generic_pm_domain *domain,
return ret;
}

-static unsigned int rpmpd_get_performance(struct generic_pm_domain *genpd,
- struct dev_pm_opp *opp)
-{
- return dev_pm_opp_get_level(opp);
-}
-
static int rpmpd_probe(struct platform_device *pdev)
{
int i;
@@ -959,7 +953,6 @@ static int rpmpd_probe(struct platform_device *pdev)
rpmpds[i]->pd.power_off = rpmpd_power_off;
rpmpds[i]->pd.power_on = rpmpd_power_on;
rpmpds[i]->pd.set_performance_state = rpmpd_set_performance;
- rpmpds[i]->pd.opp_to_performance_state = rpmpd_get_performance;
pm_genpd_init(&rpmpds[i]->pd, NULL, true);

data->domains[i] = &rpmpds[i]->pd;
--
2.34.1

2023-10-12 15:36:43

by Ulf Hansson

[permalink] [raw]
Subject: [PATCH 5/5] PM: domains: Drop the unused pm_genpd_opp_to_performance_state()

Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <->
level dance"), there is no longer any users of the
pm_genpd_opp_to_performance_state() API. Let's therefore drop it and its
corresponding ->opp_to_performance_state() callback, which also no longer
has any users.

Cc: "Rafael J. Wysocki" <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
---
drivers/base/power/domain.c | 32 --------------------------------
include/linux/pm_domain.h | 12 ------------
2 files changed, 44 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 5cb2023581d4..04bd4fd82acf 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -3032,38 +3032,6 @@ int of_genpd_parse_idle_states(struct device_node *dn,
}
EXPORT_SYMBOL_GPL(of_genpd_parse_idle_states);

-/**
- * pm_genpd_opp_to_performance_state - Gets performance state of the genpd from its OPP node.
- *
- * @genpd_dev: Genpd's device for which the performance-state needs to be found.
- * @opp: struct dev_pm_opp of the OPP for which we need to find performance
- * state.
- *
- * Returns performance state encoded in the OPP of the genpd. This calls
- * platform specific genpd->opp_to_performance_state() callback to translate
- * power domain OPP to performance state.
- *
- * Returns performance state on success and 0 on failure.
- */
-unsigned int pm_genpd_opp_to_performance_state(struct device *genpd_dev,
- struct dev_pm_opp *opp)
-{
- struct generic_pm_domain *genpd = NULL;
- int state;
-
- genpd = container_of(genpd_dev, struct generic_pm_domain, dev);
-
- if (unlikely(!genpd->opp_to_performance_state))
- return 0;
-
- genpd_lock(genpd);
- state = genpd->opp_to_performance_state(genpd, opp);
- genpd_unlock(genpd);
-
- return state;
-}
-EXPORT_SYMBOL_GPL(pm_genpd_opp_to_performance_state);
-
static int __init genpd_bus_init(void)
{
return bus_register(&genpd_bus_type);
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index f776fb93eaa0..124f870f38ca 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -113,7 +113,6 @@ struct genpd_power_state {
};

struct genpd_lock_ops;
-struct dev_pm_opp;
struct opp_table;

struct generic_pm_domain {
@@ -141,8 +140,6 @@ struct generic_pm_domain {
int (*power_on)(struct generic_pm_domain *domain);
struct raw_notifier_head power_notifiers; /* Power on/off notifiers */
struct opp_table *opp_table; /* OPP table of the genpd */
- unsigned int (*opp_to_performance_state)(struct generic_pm_domain *genpd,
- struct dev_pm_opp *opp);
int (*set_performance_state)(struct generic_pm_domain *genpd,
unsigned int state);
struct gpd_dev_ops dev_ops;
@@ -343,8 +340,6 @@ int of_genpd_remove_subdomain(struct of_phandle_args *parent_spec,
struct generic_pm_domain *of_genpd_remove_last(struct device_node *np);
int of_genpd_parse_idle_states(struct device_node *dn,
struct genpd_power_state **states, int *n);
-unsigned int pm_genpd_opp_to_performance_state(struct device *genpd_dev,
- struct dev_pm_opp *opp);

int genpd_dev_pm_attach(struct device *dev);
struct device *genpd_dev_pm_attach_by_id(struct device *dev,
@@ -390,13 +385,6 @@ static inline int of_genpd_parse_idle_states(struct device_node *dn,
return -ENODEV;
}

-static inline unsigned int
-pm_genpd_opp_to_performance_state(struct device *genpd_dev,
- struct dev_pm_opp *opp)
-{
- return 0;
-}
-
static inline int genpd_dev_pm_attach(struct device *dev)
{
return 0;
--
2.34.1

2023-10-12 16:20:08

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 0/5] PM: domains: Drop pm_genpd_opp_to_performance_state()



On 10/12/23 17:21, Ulf Hansson wrote:
> Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <-> level
> dance"), there is no longer any users of the
> pm_genpd_opp_to_performance_state() API, while a few genpd providers are still
> assigning the redundant ->opp_to_performance_state() callback.
>
> Let's clean this up so we can drop pm_genpd_opp_to_performance_state() and the
> callback too.
>
> Rafael, I would like to take this through my pmdomain tree, unless you see a
> problem with it ofcourse, hence I need your ack on the last patch in the series.
>
> Kind regards
> Uffe
Reviewed-by: Konrad Dybcio <[email protected]>

Konrad

2023-10-13 11:59:42

by Thierry Reding

[permalink] [raw]
Subject: Re: (subset) [PATCH 0/5] PM: domains: Drop pm_genpd_opp_to_performance_state()

From: Thierry Reding <[email protected]>


On Thu, 12 Oct 2023 17:21:08 +0200, Ulf Hansson wrote:
> Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <-> level
> dance"), there is no longer any users of the
> pm_genpd_opp_to_performance_state() API, while a few genpd providers are still
> assigning the redundant ->opp_to_performance_state() callback.
>
> Let's clean this up so we can drop pm_genpd_opp_to_performance_state() and the
> callback too.
>
> [...]

Applied, thanks!

[1/5] soc/tegra: pmc: Drop the ->opp_to_performance_state() callback
commit: cda263907a6f88c75fb97cf7adecffaafb6237ec

Best regards,
--
Thierry Reding <[email protected]>

2023-10-16 09:57:47

by Ulf Hansson

[permalink] [raw]
Subject: Re: (subset) [PATCH 0/5] PM: domains: Drop pm_genpd_opp_to_performance_state()

On Fri, 13 Oct 2023 at 13:59, Thierry Reding <[email protected]> wrote:
>
> From: Thierry Reding <[email protected]>
>
>
> On Thu, 12 Oct 2023 17:21:08 +0200, Ulf Hansson wrote:
> > Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <-> level
> > dance"), there is no longer any users of the
> > pm_genpd_opp_to_performance_state() API, while a few genpd providers are still
> > assigning the redundant ->opp_to_performance_state() callback.
> >
> > Let's clean this up so we can drop pm_genpd_opp_to_performance_state() and the
> > callback too.
> >
> > [...]
>
> Applied, thanks!
>
> [1/5] soc/tegra: pmc: Drop the ->opp_to_performance_state() callback
> commit: cda263907a6f88c75fb97cf7adecffaafb6237ec

Thierry, I was planning to queue up the complete series through my
pmdomain tree, my apologies if that wasn't clear. I want to get rid of
the actual genpd API and the genpd callback altogether (patch5).

Would it be possible for you to drop the above patch from your tree
and provide an ack instead?

Kind regards
Uffe

2023-10-17 11:54:18

by Ulf Hansson

[permalink] [raw]
Subject: Re: (subset) [PATCH 0/5] PM: domains: Drop pm_genpd_opp_to_performance_state()

On Mon, 16 Oct 2023 at 11:57, Ulf Hansson <[email protected]> wrote:
>
> On Fri, 13 Oct 2023 at 13:59, Thierry Reding <[email protected]> wrote:
> >
> > From: Thierry Reding <[email protected]>
> >
> >
> > On Thu, 12 Oct 2023 17:21:08 +0200, Ulf Hansson wrote:
> > > Since commit 7c41cdcd3bbe ("OPP: Simplify the over-designed pstate <-> level
> > > dance"), there is no longer any users of the
> > > pm_genpd_opp_to_performance_state() API, while a few genpd providers are still
> > > assigning the redundant ->opp_to_performance_state() callback.
> > >
> > > Let's clean this up so we can drop pm_genpd_opp_to_performance_state() and the
> > > callback too.
> > >
> > > [...]
> >
> > Applied, thanks!
> >
> > [1/5] soc/tegra: pmc: Drop the ->opp_to_performance_state() callback
> > commit: cda263907a6f88c75fb97cf7adecffaafb6237ec
>
> Thierry, I was planning to queue up the complete series through my
> pmdomain tree, my apologies if that wasn't clear. I want to get rid of
> the actual genpd API and the genpd callback altogether (patch5).
>
> Would it be possible for you to drop the above patch from your tree
> and provide an ack instead?

I just noticed that the above went has also been pulled into the soc
tree from your pull-request. So nevermind, I can do the final cleanup
later on.

Kind regards
Uffe