diff options
author | Bart Van Assche <bvanassche@acm.org> | 2024-06-05 08:51:00 -0600 |
---|---|---|
committer | Leon Romanovsky <leon@kernel.org> | 2024-06-09 11:15:27 +0300 |
commit | a1babdb5b615751ef5ace97a37f35d0ae40fbf13 (patch) | |
tree | 1b360db97dc8174ae40cbda6ccf83c7265f322bc /drivers | |
parent | e1168f09b3314992f1c5251f3793102035da7237 (diff) |
RDMA/iwcm: Simplify cm_work_handler()
Instead of complicating the code to avoid a spin_lock_irqsave() /
spin_lock_irqrestore() pair before returning, simplify the code by removing
the local variable 'empty'.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240605145117.397751-5-bvanassche@acm.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/core/iwcm.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c index 3d66aec36899..4424f430fc08 100644 --- a/drivers/infiniband/core/iwcm.c +++ b/drivers/infiniband/core/iwcm.c @@ -1017,16 +1017,13 @@ static void cm_work_handler(struct work_struct *_work) struct iw_cm_event levent; struct iwcm_id_private *cm_id_priv = work->cm_id; unsigned long flags; - int empty; int ret = 0; spin_lock_irqsave(&cm_id_priv->lock, flags); - empty = list_empty(&cm_id_priv->work_list); - while (!empty) { + while (!list_empty(&cm_id_priv->work_list)) { work = list_first_entry(&cm_id_priv->work_list, struct iwcm_work, list); list_del_init(&work->list); - empty = list_empty(&cm_id_priv->work_list); levent = work->event; put_work(work); spin_unlock_irqrestore(&cm_id_priv->lock, flags); @@ -1039,8 +1036,6 @@ static void cm_work_handler(struct work_struct *_work) pr_debug("dropping event %d\n", levent.event); if (iwcm_deref_id(cm_id_priv)) return; - if (empty) - return; spin_lock_irqsave(&cm_id_priv->lock, flags); } spin_unlock_irqrestore(&cm_id_priv->lock, flags); |