Messages in this thread | | | Date | Thu, 03 Mar 2005 19:07:43 -0500 | From | Jeff Garzik <> | Subject | Re: [PATCH][26/26] IB: MAD cancel callbacks from thread |
| |
Roland Dreier wrote: > +void cancel_sends(void *data) > +{ > + struct ib_mad_agent_private *mad_agent_priv; > + struct ib_mad_send_wr_private *mad_send_wr; > + struct ib_mad_send_wc mad_send_wc; > + unsigned long flags; > + > + mad_agent_priv = (struct ib_mad_agent_private *)data;
don't add casts to a void pointer, that's silly.
> + mad_send_wc.status = IB_WC_WR_FLUSH_ERR; > + mad_send_wc.vendor_err = 0; > + > + spin_lock_irqsave(&mad_agent_priv->lock, flags); > + while (!list_empty(&mad_agent_priv->canceled_list)) { > + mad_send_wr = list_entry(mad_agent_priv->canceled_list.next, > + struct ib_mad_send_wr_private, > + agent_list); > + > + list_del(&mad_send_wr->agent_list); > + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); > + > + mad_send_wc.wr_id = mad_send_wr->wr_id; > + mad_agent_priv->agent.send_handler(&mad_agent_priv->agent, > + &mad_send_wc); > + > + kfree(mad_send_wr); > + if (atomic_dec_and_test(&mad_agent_priv->refcount)) > + wake_up(&mad_agent_priv->wait); > + spin_lock_irqsave(&mad_agent_priv->lock, flags); > + } > + spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
dumb question... why is the lock dropped? is it just for the send_handler(), or also for wr_id assigned, kfree, and wake_up() ?
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |