Re: [PATCH v1 1/3] driver core: move core part of device_shutdown() to a separate function

From: Greg Kroah-Hartman
Date: Fri Nov 24 2023 - 10:07:19 EST


On Fri, Nov 24, 2023 at 03:53:36PM +0100, Oleksij Rempel wrote:
> Split the device_shutdown() as a preparation for the prioritization
> support.

Nit, this is going to need a lot more description, as at this point in
time, we do not know what "prioritization support" is.

>
> Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> ---
> drivers/base/core.c | 110 +++++++++++++++++++++++++-------------------
> 1 file changed, 63 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 67ba592afc77..0f5646a097d3 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -4719,12 +4719,73 @@ int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid)
> }
> EXPORT_SYMBOL_GPL(device_change_owner);
>
> +/**

This doesn't need kernel-doc for a static function, right?

> + * device_shutdown_one - shut down a device
> + * @dev: device to shut down
> + *
> + * It is called with the device lock held.
> + *
> + * The device must be on the devices_kset list.
> + */
> +static void device_shutdown_one_locked(struct device *dev)
> +{
> + struct device *parent;
> +
> + lockdep_assert_held(&devices_kset->list_lock);
> + /*
> + * hold reference count of device's parent to
> + * prevent it from being freed because parent's
> + * lock is to be held
> + */
> + parent = get_device(dev->parent);
> + get_device(dev);
> + /*

As you are moving the code, might as well make it a bit prettier and add
proper line breaks before the comments please.

thanks,

greg k-h