[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1539885215.81977.8.camel@acm.org>
Date: Thu, 18 Oct 2018 10:53:35 -0700
From: Bart Van Assche <bvanassche@....org>
To: Alexander Duyck <alexander.h.duyck@...ux.intel.com>,
gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org
Cc: len.brown@...el.com, rafael@...nel.org, linux-pm@...r.kernel.org,
jiangshanlai@...il.com, pavel@....cz, zwisler@...nel.org,
tj@...nel.org, akpm@...ux-foundation.org
Subject: Re: [driver-core PATCH v4 3/6] device core: Consolidate locking and
unlocking of parent and device
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 <bvanassche@....org>
Powered by blists - more mailing lists