Re: [PATCH V6 02/10] PM / Domains: Add function to get the last domain added

Thierry Reding
2016-02-29T07:04:53Z

[-- Attachment #1: Type: text/plain, Size: 1995 bytes --]

On Fri, Feb 26, 2016 at 03:48:36PM +0000, Jon Hunter wrote:
> To remove generic PM domains in a sane way, we need to remove them by
> starting from the last PM domain added. The reason for this is that a PM
> domain may be a subdomain of another and so we need to remove the child
> PM domains for a given domain first. By removing PM domains in reverse
> order we can ensure that the children are removed first.
>
> Add a new function to get the last PM domain that was added. In case PM
> domains are added by more than one device in the system (for example,
> on-chip domains and off-chip domains) add a 'owner' device structure
> to the generic PM domain structure so that the ownership of a PM domain
> can be identified by the device structure of the device that added it
> Use this 'owner' device structure to return the last PM domain added by
> this device.
>
> Note that because pm_genpd_init() simply adds each PM domain to the
> head of the gpd_list object, list_for_each_entry() will start from the
> last PM domain added.
>
> Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
> This is the outcome from a discussion I had with Ulf on how best to
> handle the removal of power-domains [0]. I opted to call the device
> structure 'owner' because 'parent' could be misleading if a power
> domain is a child of another power domain. However, open to suggestions!

I've seen "dev" used a lot in other subsystems when an entity is
provided by a specific device. "provider" might be another alternative,
but I don't have any strong objections against "owner" either.

>
> [0] http://marc.info/?l=linux-pm&m=145460070816340&w=2
>
> drivers/base/power/domain.c | 25 +++++++++++++++++++++++++
> include/linux/pm_domain.h | 7 +++++++
> 2 files changed, 32 insertions(+)

Besides the name bikeshedding, the change looks correct:

Reviewed-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]