aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/domain.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/power/domain.c')
-rw-r--r--drivers/base/power/domain.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index ac06d0280b42..cddf818f493c 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1584,7 +1584,8 @@ int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
1584 struct gpd_link *link; 1584 struct gpd_link *link;
1585 int ret = 0; 1585 int ret = 0;
1586 1586
1587 if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain)) 1587 if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain)
1588 || genpd == subdomain)
1588 return -EINVAL; 1589 return -EINVAL;
1589 1590
1590 start: 1591 start:
@@ -1631,6 +1632,35 @@ int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
1631} 1632}
1632 1633
1633/** 1634/**
1635 * pm_genpd_add_subdomain_names - Add a subdomain to an I/O PM domain.
1636 * @master_name: Name of the master PM domain to add the subdomain to.
1637 * @subdomain_name: Name of the subdomain to be added.
1638 */
1639int pm_genpd_add_subdomain_names(const char *master_name,
1640 const char *subdomain_name)
1641{
1642 struct generic_pm_domain *master = NULL, *subdomain = NULL, *gpd;
1643
1644 if (IS_ERR_OR_NULL(master_name) || IS_ERR_OR_NULL(subdomain_name))
1645 return -EINVAL;
1646
1647 mutex_lock(&gpd_list_lock);
1648 list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
1649 if (!master && !strcmp(gpd->name, master_name))
1650 master = gpd;
1651
1652 if (!subdomain && !strcmp(gpd->name, subdomain_name))
1653 subdomain = gpd;
1654
1655 if (master && subdomain)
1656 break;
1657 }
1658 mutex_unlock(&gpd_list_lock);
1659
1660 return pm_genpd_add_subdomain(master, subdomain);
1661}
1662
1663/**
1634 * pm_genpd_remove_subdomain - Remove a subdomain from an I/O PM domain. 1664 * pm_genpd_remove_subdomain - Remove a subdomain from an I/O PM domain.
1635 * @genpd: Master PM domain to remove the subdomain from. 1665 * @genpd: Master PM domain to remove the subdomain from.
1636 * @subdomain: Subdomain to be removed. 1666 * @subdomain: Subdomain to be removed.