On Mon, 2018-10-15 at 08:09 -0700, Alexander Duyck wrote:
> This patch is meant to try and consolidate all of the locking and unlocking
> of both the parent and device when attaching or removing a driver from a
> given device.
> 
> To do that I first consolidated the lock pattern into two functions
> __device_driver_lock and __device_driver_unlock. After doing that I then
> created functions specific to attaching and detaching the driver while
> acquiring this locks. By doing this I was able to reduce the number of
            ^^^^
Should "this" perhaps be changed into "these"?
 
> +/*
> + * __device_driver_lock - acquire locks needed to manipulate dev->drv
> + * @dev: Device we will update driver info for
> + * @parent: Parent device needed if the bus requires parent lock

Please consider splitting that description into two sentences to enhance
clarity, e.g. "Parent device. Needed if the bus requires parent lock."

> + * @parent: Parent device needed if the bus requires parent lock

Same comment here.

>  /**
> + * device_driver_detach - detach driver from a specific device
> + * @dev: device to detach driver from
> + *
> + * Manually detach driver from device. Will acquire both @dev lock and
> + * @dev->parent lock if needed.
> + */
> +void device_driver_detach(struct device *dev)
> +{
> +     device_release_driver_internal(dev, NULL, dev->parent);
> +}
> +
> +/**
>   * driver_detach - detach driver from all devices it controls.
>   * @drv: driver.
>   */

Elsewhere in the driver core the word "manually" only appears in comments
above exported functions and functions that implement sysfs store methods.
Since device_driver_detach() is neither, I think the word "manually" should
not be used in the comment block above that function. But since the rest of
this patch looks fine to me, feel free to add:

Reviewed-by: Bart Van Assche <[email protected]>

Reply via email to