iommu/amd: Use wait_event in put_pasid_state_wait
authorJoerg Roedel <jroedel@suse.de>
Wed, 4 Feb 2015 14:50:38 +0000 (15:50 +0100)
committerJoerg Roedel <jroedel@suse.de>
Wed, 4 Feb 2015 14:50:51 +0000 (15:50 +0100)
Now that I learned about possible spurious wakeups this
place needs fixing too. Replace the self-coded sleep variant
with the generic wait_event() helper.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd_iommu_v2.c

index b6398d7285f707ca67214b56e4db727d0bcd0926..5cc140969b4321ad1255496e77b85f1e9f1f6d46 100644 (file)
@@ -266,14 +266,7 @@ static void put_pasid_state(struct pasid_state *pasid_state)
 
 static void put_pasid_state_wait(struct pasid_state *pasid_state)
 {
-       DEFINE_WAIT(wait);
-
-       prepare_to_wait(&pasid_state->wq, &wait, TASK_UNINTERRUPTIBLE);
-
-       if (!atomic_dec_and_test(&pasid_state->count))
-               schedule();
-
-       finish_wait(&pasid_state->wq, &wait);
+       wait_event(pasid_state->wq, !atomic_read(&pasid_state->count));
        free_pasid_state(pasid_state);
 }