diff options
author | Alexander Duyck <alexander.h.duyck@linux.intel.com> | 2019-01-22 19:39:16 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-31 14:20:53 +0100 |
commit | ed88747c6c4a2fc2f961a36d4c50cb0868c30229 (patch) | |
tree | 482ff0b5ec8f143ea79914d2029fae63ce407e7b /drivers/base/base.h | |
parent | driver core: Establish order of operations for device_add and device_del via ... (diff) | |
download | linux-ed88747c6c4a2fc2f961a36d4c50cb0868c30229.tar.xz linux-ed88747c6c4a2fc2f961a36d4c50cb0868c30229.zip |
device core: Consolidate locking and unlocking of parent and device
Try to 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 these locks. By doing this I was able to reduce the number of
spots where we touch need_parent_lock from 12 down to 4.
This patch should produce no functional changes, it is meant to be a code
clean-up/consolidation only.
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/base.h')
-rw-r--r-- | drivers/base/base.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h index 7ca475af8953..b6966511b0ca 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h @@ -132,6 +132,8 @@ extern int driver_add_groups(struct device_driver *drv, const struct attribute_group **groups); extern void driver_remove_groups(struct device_driver *drv, const struct attribute_group **groups); +int device_driver_attach(struct device_driver *drv, struct device *dev); +void device_driver_detach(struct device *dev); extern char *make_class_name(const char *name, struct kobject *kobj); |