Re: [PATCHv3 3/4] drivers/base: clean up the usage of devices_kset_move_last()

From: Rafael J. Wysocki
Date: Tue Jul 03 2018 - 10:28:11 EST


On Tuesday, July 3, 2018 8:50:41 AM CEST Pingfan Liu wrote:
> Clean up the referring to the code in commit 52cdbdd49853 ("driver core:
> correct device's shutdown order"). So later we can revert it safely.
>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> Cc: Grygorii Strashko <grygorii.strashko@xxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
> Cc: Bjorn Helgaas <helgaas@xxxxxxxxxx>
> Cc: Dave Young <dyoung@xxxxxxxxxx>
> Cc: linux-pci@xxxxxxxxxxxxxxx
> Cc: linuxppc-dev@xxxxxxxxxxxxxxxx
> Signed-off-by: Pingfan Liu <kernelfans@xxxxxxxxx>
> ---
> drivers/base/core.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 684b994..db3deb8 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -127,13 +127,6 @@ static int device_reorder_to_tail(struct device *dev, void *not_used)
> {
> struct device_link *link;
>
> - /*
> - * Devices that have not been registered yet will be put to the ends
> - * of the lists during the registration, so skip them here.
> - */
> - if (device_is_registered(dev))
> - devices_kset_move_last(dev);
> -
> if (device_pm_initialized(dev))
> device_pm_move_last(dev);

You can't do this.

If you do it, that will break power management in some situations.

Thanks,
Rafael