Commit b44290a0 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pm-5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
 "These rearrange some code in the generic power domains (genpd)
  framework to avoid a potential deadlock and make the turbostat utility
  behave more as expected.

  Specifics:

   - Rearrange the generic power domains (genpd) code to avoid a
     potential deadlock possible due to its interactions with the clock
     framework (Jiada Wang)

   - Make turbostat return the exit status of the command run under it
     if that command fails (David Arcari)"

* tag 'pm-5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  PM / Domains: Avoid a potential deadlock
  tools/power turbostat: return the exit status of a command
parents 599beede 112a04f6
...@@ -1469,12 +1469,12 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, ...@@ -1469,12 +1469,12 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
if (IS_ERR(gpd_data)) if (IS_ERR(gpd_data))
return PTR_ERR(gpd_data); return PTR_ERR(gpd_data);
genpd_lock(genpd);
ret = genpd->attach_dev ? genpd->attach_dev(genpd, dev) : 0; ret = genpd->attach_dev ? genpd->attach_dev(genpd, dev) : 0;
if (ret) if (ret)
goto out; goto out;
genpd_lock(genpd);
dev_pm_domain_set(dev, &genpd->domain); dev_pm_domain_set(dev, &genpd->domain);
genpd->device_count++; genpd->device_count++;
...@@ -1482,9 +1482,8 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, ...@@ -1482,9 +1482,8 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
list_add_tail(&gpd_data->base.list_node, &genpd->dev_list); list_add_tail(&gpd_data->base.list_node, &genpd->dev_list);
out:
genpd_unlock(genpd); genpd_unlock(genpd);
out:
if (ret) if (ret)
genpd_free_dev_data(dev, gpd_data); genpd_free_dev_data(dev, gpd_data);
else else
...@@ -1533,15 +1532,15 @@ static int genpd_remove_device(struct generic_pm_domain *genpd, ...@@ -1533,15 +1532,15 @@ static int genpd_remove_device(struct generic_pm_domain *genpd,
genpd->device_count--; genpd->device_count--;
genpd->max_off_time_changed = true; genpd->max_off_time_changed = true;
if (genpd->detach_dev)
genpd->detach_dev(genpd, dev);
dev_pm_domain_set(dev, NULL); dev_pm_domain_set(dev, NULL);
list_del_init(&pdd->list_node); list_del_init(&pdd->list_node);
genpd_unlock(genpd); genpd_unlock(genpd);
if (genpd->detach_dev)
genpd->detach_dev(genpd, dev);
genpd_free_dev_data(dev, gpd_data); genpd_free_dev_data(dev, gpd_data);
return 0; return 0;
......
...@@ -5077,6 +5077,9 @@ int fork_it(char **argv) ...@@ -5077,6 +5077,9 @@ int fork_it(char **argv)
signal(SIGQUIT, SIG_IGN); signal(SIGQUIT, SIG_IGN);
if (waitpid(child_pid, &status, 0) == -1) if (waitpid(child_pid, &status, 0) == -1)
err(status, "waitpid"); err(status, "waitpid");
if (WIFEXITED(status))
status = WEXITSTATUS(status);
} }
/* /*
* n.b. fork_it() does not check for errors from for_all_cpus() * n.b. fork_it() does not check for errors from for_all_cpus()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment