|
@@ -1744,6 +1744,41 @@ out:
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(of_genpd_add_subdomain);
|
|
|
|
|
|
+/**
|
|
|
+ * of_genpd_remove_last - Remove the last PM domain registered for a provider
|
|
|
+ * @provider: Pointer to device structure associated with provider
|
|
|
+ *
|
|
|
+ * Find the last PM domain that was added by a particular provider and
|
|
|
+ * remove this PM domain from the list of PM domains. The provider is
|
|
|
+ * identified by the 'provider' device structure that is passed. The PM
|
|
|
+ * domain will only be removed, if the provider associated with domain
|
|
|
+ * has been removed.
|
|
|
+ *
|
|
|
+ * Returns a valid pointer to struct generic_pm_domain on success or
|
|
|
+ * ERR_PTR() on failure.
|
|
|
+ */
|
|
|
+struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
|
|
|
+{
|
|
|
+ struct generic_pm_domain *gpd, *genpd = ERR_PTR(-ENOENT);
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ if (IS_ERR_OR_NULL(np))
|
|
|
+ return ERR_PTR(-EINVAL);
|
|
|
+
|
|
|
+ mutex_lock(&gpd_list_lock);
|
|
|
+ list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
|
|
|
+ if (gpd->provider == &np->fwnode) {
|
|
|
+ ret = genpd_remove(gpd);
|
|
|
+ genpd = ret ? ERR_PTR(ret) : gpd;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mutex_unlock(&gpd_list_lock);
|
|
|
+
|
|
|
+ return genpd;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(of_genpd_remove_last);
|
|
|
+
|
|
|
/**
|
|
|
* genpd_dev_pm_detach - Detach a device from its PM domain.
|
|
|
* @dev: Device to detach.
|