diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-03-02 08:05:45 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-03-02 08:05:45 +0100 |
commit | 9d020d33fc1b2faa0eb35859df1381ca5dc94ffe (patch) | |
tree | adcd4356b93b17b42c9e4ef95c3fea3afa52f3ee /drivers/misc/cxl/pci.c | |
parent | 6b0b7551428e4caae1e2c023a529465a9a9ae2d4 (diff) | |
parent | 4977ab6e92e267afe9d8f78438c3db330ca8434c (diff) |
Merge branch 'linus' into perf/urgent, to resolve conflict
Conflicts:
arch/powerpc/configs/85xx/kmp204x_defconfig
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/misc/cxl/pci.c')
-rw-r--r-- | drivers/misc/cxl/pci.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c index cca938845ffd..91f645992c94 100644 --- a/drivers/misc/cxl/pci.c +++ b/drivers/misc/cxl/pci.c @@ -1129,7 +1129,7 @@ static int pci_configure_afu(struct cxl_afu *afu, struct cxl *adapter, struct pc if ((rc = cxl_native_register_psl_irq(afu))) goto err2; - up_write(&afu->configured_rwsem); + atomic_set(&afu->configured_state, 0); return 0; err2: @@ -1142,7 +1142,14 @@ err1: static void pci_deconfigure_afu(struct cxl_afu *afu) { - down_write(&afu->configured_rwsem); + /* + * It's okay to deconfigure when AFU is already locked, otherwise wait + * until there are no readers + */ + if (atomic_read(&afu->configured_state) != -1) { + while (atomic_cmpxchg(&afu->configured_state, 0, -1) != -1) + schedule(); + } cxl_native_release_psl_irq(afu); if (afu->adapter->native->sl_ops->release_serr_irq) afu->adapter->native->sl_ops->release_serr_irq(afu); |