diff options
author | Dave Jiang <dave.jiang@intel.com> | 2021-10-26 14:36:29 -0700 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2021-11-22 11:21:26 +0530 |
commit | bd5970a0d01f8e45af9b2e2cf1d245b84ea757ba (patch) | |
tree | 4912b0ed32cd6d6b537667c13c8f255cdbdd6a8e /drivers/dma/idxd/device.c | |
parent | 46c6df1c958e55558212cfa94cad201eae48d684 (diff) | |
download | lwn-bd5970a0d01f8e45af9b2e2cf1d245b84ea757ba.tar.gz lwn-bd5970a0d01f8e45af9b2e2cf1d245b84ea757ba.zip |
dmaengine: idxd: create locked version of idxd_quiesce() call
Add a locked version of idxd_quiesce() call so that the quiesce can be
called with a lock in situations where the lock is not held by the caller.
In the driver probe/remove path, the lock is already held, so the raw
version can be called w/o locking.
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/163528418980.3925689.5841907054957931211.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/idxd/device.c')
-rw-r--r-- | drivers/dma/idxd/device.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c index f381319615fd..943e9967627b 100644 --- a/drivers/dma/idxd/device.c +++ b/drivers/dma/idxd/device.c @@ -411,12 +411,20 @@ int idxd_wq_init_percpu_ref(struct idxd_wq *wq) return 0; } -void idxd_wq_quiesce(struct idxd_wq *wq) +void __idxd_wq_quiesce(struct idxd_wq *wq) { + lockdep_assert_held(&wq->wq_lock); percpu_ref_kill(&wq->wq_active); wait_for_completion(&wq->wq_dead); } +void idxd_wq_quiesce(struct idxd_wq *wq) +{ + mutex_lock(&wq->wq_lock); + __idxd_wq_quiesce(wq); + mutex_unlock(&wq->wq_lock); +} + /* Device control bits */ static inline bool idxd_is_enabled(struct idxd_device *idxd) { |