History

PM / Domains: Introduce a genpd OF helper that removes a subdomain

We already have the of_genpd_add_subdomain() helper, but no corresponding of_genpd_remove_subdomain(), so let's add it. Subsequent changes starts to make use of it.

Ulf Hansson committed 6 years ago

Commit dedd1491 parent 9c6ceec2 files · +46 −0Browse files

Unified · Split

2 files
  1. drivers/base/power/domain.c +38 −0
  2. include/linux/pm_domain.h +8 −0
drivers/base/power/domain.c+38−0
@@ -2302,6 +2302,44 @@ out: · 2301 unmodified lines
2302}2302}
2303EXPORT_SYMBOL_GPL(of_genpd_add_subdomain);2303EXPORT_SYMBOL_GPL(of_genpd_add_subdomain);
2304 2304
2305/**
2306 * of_genpd_remove_subdomain - Remove a subdomain from an I/O PM domain.
2307 * @parent_spec: OF phandle args to use for parent PM domain look-up
2308 * @subdomain_spec: OF phandle args to use for subdomain look-up
2309 *
2310 * Looks-up a parent PM domain and subdomain based upon phandle args
2311 * provided and removes the subdomain from the parent PM domain. Returns a
2312 * negative error code on failure.
2313 */
2314int of_genpd_remove_subdomain(struct of_phandle_args *parent_spec,
2315 struct of_phandle_args *subdomain_spec)
2316{
2317 struct generic_pm_domain *parent, *subdomain;
2318 int ret;
2319
2320 mutex_lock(&gpd_list_lock);
2321
2322 parent = genpd_get_from_provider(parent_spec);
2323 if (IS_ERR(parent)) {
2324 ret = PTR_ERR(parent);
2325 goto out;
2326 }
2327
2328 subdomain = genpd_get_from_provider(subdomain_spec);
2329 if (IS_ERR(subdomain)) {
2330 ret = PTR_ERR(subdomain);
2331 goto out;
2332 }
2333
2334 ret = pm_genpd_remove_subdomain(parent, subdomain);
2335
2336out:
2337 mutex_unlock(&gpd_list_lock);
2338
2339 return ret;
2340}
2341EXPORT_SYMBOL_GPL(of_genpd_remove_subdomain);
2342
2305/**2343/**
2306 * of_genpd_remove_last - Remove the last PM domain registered for a provider2344 * of_genpd_remove_last - Remove the last PM domain registered for a provider
2307 * @provider: Pointer to device structure associated with provider2345 * @provider: Pointer to device structure associated with provider
include/linux/pm_domain.h+8−0
@@ -284,6 +284,8 @@ void of_genpd_del_provider(struct device_node *np); · 283 unmodified lines
284int of_genpd_add_device(struct of_phandle_args *args, struct device *dev);284int of_genpd_add_device(struct of_phandle_args *args, struct device *dev);
285int of_genpd_add_subdomain(struct of_phandle_args *parent_spec,285int of_genpd_add_subdomain(struct of_phandle_args *parent_spec,
286 struct of_phandle_args *subdomain_spec);286 struct of_phandle_args *subdomain_spec);
287int of_genpd_remove_subdomain(struct of_phandle_args *parent_spec,
288 struct of_phandle_args *subdomain_spec);
287struct generic_pm_domain *of_genpd_remove_last(struct device_node *np);289struct generic_pm_domain *of_genpd_remove_last(struct device_node *np);
288int of_genpd_parse_idle_states(struct device_node *dn,290int of_genpd_parse_idle_states(struct device_node *dn,
289 struct genpd_power_state **states, int *n);291 struct genpd_power_state **states, int *n);
@@ -322,6 +324,12 @@ static inline int of_genpd_add_subdomain(struct of_phandle_args *parent_spec, · 32 unmodified lines
322 return -ENODEV;324 return -ENODEV;
323}325}
324 326
327static inline int of_genpd_remove_subdomain(struct of_phandle_args *parent_spec,
328 struct of_phandle_args *subdomain_spec)
329{
330 return -ENODEV;
331}
332
325static inline int of_genpd_parse_idle_states(struct device_node *dn,333static inline int of_genpd_parse_idle_states(struct device_node *dn,
326 struct genpd_power_state **states, int *n)334 struct genpd_power_state **states, int *n)
327{335{