On Mon, Jul 9, 2018 at 10:40 AM, Pingfan Liu <kernelfans@xxxxxxxxx> wrote: > On Mon, Jul 9, 2018 at 3:48 PM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote: >> >> On Mon, Jul 9, 2018 at 8:48 AM, Pingfan Liu <kernelfans@xxxxxxxxx> wrote: >> > On Sun, Jul 8, 2018 at 4:25 PM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote: [cut] >> >> I simply think that there should be one way to iterate over devices >> for both system-wide PM and shutdown. >> >> The reason why it is not like that today is because of the development >> history, but if it doesn't work and we want to fix it, let's just >> consolidate all of that. >> >> Now, system-wide suspend resume sometimes iterates the list in the >> reverse order which would be hard without having a list, wouldn't it? >> > Yes, it would be hard without having a list. I just thought to use > device tree info to build up a shadowed list, and rebuild the list > until there is new device_link_add() operation. For > device_add/_remove(), it can modify the shadowed list directly. Right, and that's the idea of dpm_list, generally speaking: It represents one of the (possibly many) orders in which devices can be suspended (or shut down) based on the information coming from the device hierarchy and device links. So it appears straightforward (even though it may be complicated because of the build-time dependencies) to start using dpm_list for shutdown too - and to ensure that it is properly maintained everywhere. Thanks, Rafael