PM / Domains: Allow to attach a CPU via genpd_dev_pm_attach_by_id|name()
authorUlf Hansson <ulf.hansson@linaro.org>
Thu, 25 Apr 2019 09:04:13 +0000 (11:04 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 25 Apr 2019 21:18:03 +0000 (23:18 +0200)
commitf9ccd7c3a1d87cea3a6f9ed6c946dee9e7456b2e
tree8bae26fc802b059655c18897bee909b7e6dac699
parentb24e196586fecafed1c3cff9b2f87c1a64138ade
PM / Domains: Allow to attach a CPU via genpd_dev_pm_attach_by_id|name()

Attaching a device via genpd_dev_pm_attach_by_id|name() makes
genpd allocate a virtual device that it attaches instead. This
leads to a problem in case when the base device belongs to a CPU.
More precisely, it means genpd_get_cpu() compares against the
virtual device, thus it fails to find a matching CPU device.

Address this limitation by passing the base device to genpd_get_cpu()
rather than the virtual device.

Moreover, to deal with detach correctly from genpd_remove_device(),
store the CPU number in struct generic_pm_domain_data, so as to be
able to clear the corresponding bit in the cpumask for the genpd.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/domain.c
include/linux/pm_domain.h