On 12/09/16 08:21, Ulf Hansson wrote: > On 9 September 2016 at 17:17, Jon Hunter <jonathanh@xxxxxxxxxx> wrote: >> >> On 09/09/16 14:54, Jon Hunter wrote: >>> On 08/09/16 12:49, Ulf Hansson wrote: >>>> On 16 August 2016 at 11:49, Jon Hunter <jonathanh@xxxxxxxxxx> wrote: >>>>> The genpd framework allows users to add PM domains via the pm_genpd_init() >>>>> function, however, there is no corresponding function to remove a PM >>>>> domain. For most devices this may be fine as the PM domains are never >>>>> removed, however, for devices that wish to populate the PM domains from >>>>> within a driver, having the ability to remove a PM domain if the probing >>>>> of the device fails or the driver is unloaded is necessary. >>>>> >>>>> Add the function pm_genpd_remove() to remove a PM domain by referencing >>>>> it's generic_pm_domain structure. >>>>> >>>>> PM domains can only be removed if they are not a parent domain to >>>>> another PM domain and have no devices associated with them. >>>> >>>> I think we should also check if the there's is a provider registered >>>> for the genpd, as it should also prevent the genpd from being removed. >>>> Right? >>> >>> Yes I would agree. I had thought that after patch #4 of this series that >>> only the provider itself would be able to call this. However, we should >>> probably still verify that the provider has correctly remove itself. >> >> So now I have the following. I am still not 100% happy. I cannot clear >> the ->provider when calling of_genpd_del_provider() and so I cannot use >> this to verify if the provider is present and so I need to check the >> list of providers and it gets a bit messy. I have been wracking my >> brains to find a better alternative (including a single function to >> remove the provider and domains at once but there are issues with that >> as well). > > Instead of using the ->provider pointer to know whether the genpd has > a valid provider, why not just add an additional ->has_provider bool > flag in the genpd struct? > > Simply set the flag when adding the provider and reset it when > removing it. Wouldn't that work? Yes. I was trying not to add to much clutter to the struct. However, may be this is the best option. Cheers Jon -- nvpublic -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html