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>
This commit is contained in:
committed by
Leon Romanovsky
parent
e1168f09b3
commit
a1babdb5b6
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user