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 > --- > 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