pmdomain core:
- Fix alloc/free in dev_pm_domain_attach|detach_list() pmdomain providers: - qcom: Fix the return of uninitialized variable pmdomain consumers: - drm/tegra/gr3d: Revert conversion to dev_pm_domain_attach|detach_list() OPP core: - Fix error code in dev_pm_opp_set_config() -----BEGIN PGP SIGNATURE----- iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmcI/SAXHHVsZi5oYW5z c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCnycg/9HUK+6lGbKmCE09MnEiN4KMoG 4km7/sZc4gmHlMto8IPiOyxgB0U5M9MwCyiUZLsut+8gmsnUcf+dHqam4LgYXopg 9rDb6DqveieNVDu8BriGfZ8oZuRgorjFG2kAx/Y+sF7aCks4WdRe4hQ+O6Hv8/bX 7WRT1nDmSm9rHpksFZGFX+5f3awjCmN1iNrfZU86oeeXZOwiUC+ID2EzWsPVfugx CnekLi4FFtvhKY0sR4n20Yn7hRZWC4gnJh90P4yN+X45vCeJgVXJwO7xLPlyo2EE vvtNUkrZrJmZmVWKO+/EgnHwa4wM6RG/xccPUaR4p2HrUty1ylmbrlCkmx+P2+47 8DbwSA2y8bI2WpgtmEDiNaRJiys7zsTtWOn8NZZsUJ4R+JZbimBKLF8KrPeVxawK Uqe56OogZCPYrmx7ad3dhz8Df8pWrK5VRuO1BickS3tPUWqDk+QAyyoIyo9cE5Re jLWrNC76Bg6AaqghPGiBkykbaDvdhZ35UVfDZ4z8mW/ECmF+VTsrs16bQ3b9Xw1u QDuIeDJcEe9TzTpxRC/h4t8gchfAUAXHnuHPoO9zJeZOJETD0wxc/0W0p0Vc1MG1 2wsjJIueMJMHGvitOq5nZ+L0JCrrOGXkNJslcZKp7O2uRfVt36qhMj/D5AqSS1gU 1PLaFknMlSIY2GF8PY8= =mDo4 -----END PGP SIGNATURE----- Merge tag 'pmdomain-v6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm Pull pmdomain fixes from Ulf Hansson: "pmdomain core: - Fix alloc/free in dev_pm_domain_attach|detach_list() pmdomain providers: - qcom: Fix the return of uninitialized variable pmdomain consumers: - drm/tegra/gr3d: Revert conversion to dev_pm_domain_attach|detach_list() OPP core: - Fix error code in dev_pm_opp_set_config()" * tag 'pmdomain-v6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm: PM: domains: Fix alloc/free in dev_pm_domain_attach|detach_list() Revert "drm/tegra: gr3d: Convert into dev_pm_domain_attach|detach_list()" pmdomain: qcom-cpr: Fix the return of uninitialized variable OPP: fix error code in dev_pm_opp_set_config()
This commit is contained in:
commit
22e6abaa72
@ -195,6 +195,7 @@ int dev_pm_domain_attach_list(struct device *dev,
|
||||
struct device *pd_dev = NULL;
|
||||
int ret, i, num_pds = 0;
|
||||
bool by_id = true;
|
||||
size_t size;
|
||||
u32 pd_flags = data ? data->pd_flags : 0;
|
||||
u32 link_flags = pd_flags & PD_FLAG_NO_DEV_LINK ? 0 :
|
||||
DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME;
|
||||
@ -217,19 +218,17 @@ int dev_pm_domain_attach_list(struct device *dev,
|
||||
if (num_pds <= 0)
|
||||
return 0;
|
||||
|
||||
pds = devm_kzalloc(dev, sizeof(*pds), GFP_KERNEL);
|
||||
pds = kzalloc(sizeof(*pds), GFP_KERNEL);
|
||||
if (!pds)
|
||||
return -ENOMEM;
|
||||
|
||||
pds->pd_devs = devm_kcalloc(dev, num_pds, sizeof(*pds->pd_devs),
|
||||
GFP_KERNEL);
|
||||
if (!pds->pd_devs)
|
||||
return -ENOMEM;
|
||||
|
||||
pds->pd_links = devm_kcalloc(dev, num_pds, sizeof(*pds->pd_links),
|
||||
GFP_KERNEL);
|
||||
if (!pds->pd_links)
|
||||
return -ENOMEM;
|
||||
size = sizeof(*pds->pd_devs) + sizeof(*pds->pd_links);
|
||||
pds->pd_devs = kcalloc(num_pds, size, GFP_KERNEL);
|
||||
if (!pds->pd_devs) {
|
||||
ret = -ENOMEM;
|
||||
goto free_pds;
|
||||
}
|
||||
pds->pd_links = (void *)(pds->pd_devs + num_pds);
|
||||
|
||||
if (link_flags && pd_flags & PD_FLAG_DEV_LINK_ON)
|
||||
link_flags |= DL_FLAG_RPM_ACTIVE;
|
||||
@ -272,6 +271,9 @@ err_attach:
|
||||
device_link_del(pds->pd_links[i]);
|
||||
dev_pm_domain_detach(pds->pd_devs[i], true);
|
||||
}
|
||||
kfree(pds->pd_devs);
|
||||
free_pds:
|
||||
kfree(pds);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dev_pm_domain_attach_list);
|
||||
@ -363,6 +365,9 @@ void dev_pm_domain_detach_list(struct dev_pm_domain_list *list)
|
||||
device_link_del(list->pd_links[i]);
|
||||
dev_pm_domain_detach(list->pd_devs[i], true);
|
||||
}
|
||||
|
||||
kfree(list->pd_devs);
|
||||
kfree(list);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dev_pm_domain_detach_list);
|
||||
|
||||
|
@ -46,7 +46,6 @@ struct gr3d {
|
||||
unsigned int nclocks;
|
||||
struct reset_control_bulk_data resets[RST_GR3D_MAX];
|
||||
unsigned int nresets;
|
||||
struct dev_pm_domain_list *pd_list;
|
||||
|
||||
DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS);
|
||||
};
|
||||
@ -370,12 +369,18 @@ static int gr3d_power_up_legacy_domain(struct device *dev, const char *name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gr3d_del_link(void *link)
|
||||
{
|
||||
device_link_del(link);
|
||||
}
|
||||
|
||||
static int gr3d_init_power(struct device *dev, struct gr3d *gr3d)
|
||||
{
|
||||
struct dev_pm_domain_attach_data pd_data = {
|
||||
.pd_names = (const char *[]) { "3d0", "3d1" },
|
||||
.num_pd_names = 2,
|
||||
};
|
||||
static const char * const opp_genpd_names[] = { "3d0", "3d1", NULL };
|
||||
const u32 link_flags = DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME;
|
||||
struct device **opp_virt_devs, *pd_dev;
|
||||
struct device_link *link;
|
||||
unsigned int i;
|
||||
int err;
|
||||
|
||||
err = of_count_phandle_with_args(dev->of_node, "power-domains",
|
||||
@ -409,10 +414,29 @@ static int gr3d_init_power(struct device *dev, struct gr3d *gr3d)
|
||||
if (dev->pm_domain)
|
||||
return 0;
|
||||
|
||||
err = dev_pm_domain_attach_list(dev, &pd_data, &gr3d->pd_list);
|
||||
if (err < 0)
|
||||
err = devm_pm_opp_attach_genpd(dev, opp_genpd_names, &opp_virt_devs);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
for (i = 0; opp_genpd_names[i]; i++) {
|
||||
pd_dev = opp_virt_devs[i];
|
||||
if (!pd_dev) {
|
||||
dev_err(dev, "failed to get %s power domain\n",
|
||||
opp_genpd_names[i]);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
link = device_link_add(dev, pd_dev, link_flags);
|
||||
if (!link) {
|
||||
dev_err(dev, "failed to link to %s\n", dev_name(pd_dev));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = devm_add_action_or_reset(dev, gr3d_del_link, link);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -503,13 +527,13 @@ static int gr3d_probe(struct platform_device *pdev)
|
||||
|
||||
err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev);
|
||||
if (err)
|
||||
goto err;
|
||||
return err;
|
||||
|
||||
err = host1x_client_register(&gr3d->client.base);
|
||||
if (err < 0) {
|
||||
dev_err(&pdev->dev, "failed to register host1x client: %d\n",
|
||||
err);
|
||||
goto err;
|
||||
return err;
|
||||
}
|
||||
|
||||
/* initialize address register map */
|
||||
@ -517,9 +541,6 @@ static int gr3d_probe(struct platform_device *pdev)
|
||||
set_bit(gr3d_addr_regs[i], gr3d->addr_regs);
|
||||
|
||||
return 0;
|
||||
err:
|
||||
dev_pm_domain_detach_list(gr3d->pd_list);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void gr3d_remove(struct platform_device *pdev)
|
||||
@ -528,7 +549,6 @@ static void gr3d_remove(struct platform_device *pdev)
|
||||
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
host1x_client_unregister(&gr3d->client.base);
|
||||
dev_pm_domain_detach_list(gr3d->pd_list);
|
||||
}
|
||||
|
||||
static int __maybe_unused gr3d_runtime_suspend(struct device *dev)
|
||||
|
@ -2630,8 +2630,10 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config)
|
||||
|
||||
/* Attach genpds */
|
||||
if (config->genpd_names) {
|
||||
if (config->required_devs)
|
||||
if (config->required_devs) {
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = _opp_attach_genpd(opp_table, dev, config->genpd_names,
|
||||
config->virt_devs);
|
||||
|
@ -1052,7 +1052,7 @@ static unsigned long cpr_get_opp_hz_for_req(struct dev_pm_opp *ref,
|
||||
of_parse_phandle(child_np, "required-opps", 0);
|
||||
|
||||
if (child_req_np == ref_np) {
|
||||
u64 rate;
|
||||
u64 rate = 0;
|
||||
|
||||
of_property_read_u64(child_np, "opp-hz", &rate);
|
||||
return (unsigned long) rate;
|
||||
|
Loading…
Reference in New Issue
Block a user