diff options
author | Dan Williams <dan.j.williams@intel.com> | 2019-07-17 18:07:53 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-31 07:25:02 +0200 |
commit | d0ed1dbc8a54bc8c527bb420fd9e7c7bee93b415 (patch) | |
tree | 2003d07e17b8d7324a751592174b86f8f25b0ce5 /include | |
parent | 32e5133912ff141128a8795ae8abb85d209dfc20 (diff) | |
download | linux-stable-d0ed1dbc8a54bc8c527bb420fd9e7c7bee93b415.tar.gz linux-stable-d0ed1dbc8a54bc8c527bb420fd9e7c7bee93b415.tar.bz2 linux-stable-d0ed1dbc8a54bc8c527bb420fd9e7c7bee93b415.zip |
drivers/base: Introduce kill_device()
commit 00289cd87676e14913d2d8492d1ce05c4baafdae upstream.
The libnvdimm subsystem arranges for devices to be destroyed as a result
of a sysfs operation. Since device_unregister() cannot be called from
an actively running sysfs attribute of the same device libnvdimm
arranges for device_unregister() to be performed in an out-of-line async
context.
The driver core maintains a 'dead' state for coordinating its own racing
async registration / de-registration requests. Rather than add local
'dead' state tracking infrastructure to libnvdimm device objects, export
the existing state tracking via a new kill_device() helper.
The kill_device() helper simply marks the device as dead, i.e. that it
is on its way to device_del(), or returns that the device was already
dead. This can be used in advance of calling device_unregister() for
subsystems like libnvdimm that might need to handle multiple user
threads racing to delete a device.
This refactoring does not change any behavior, but it is a pre-requisite
for follow-on fixes and therefore marked for -stable.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Fixes: 4d88a97aa9e8 ("libnvdimm, nvdimm: dimm driver and base libnvdimm device-driver...")
Cc: <stable@vger.kernel.org>
Tested-by: Jane Chu <jane.chu@oracle.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/156341207332.292348.14959761496009347574.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 4a295e324ac5..b12c586fae28 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1375,6 +1375,7 @@ extern int (*platform_notify_remove)(struct device *dev); */ extern struct device *get_device(struct device *dev); extern void put_device(struct device *dev); +extern bool kill_device(struct device *dev); #ifdef CONFIG_DEVTMPFS extern int devtmpfs_create_node(struct device *dev); |