Michael S. Tsirkin wrote:
void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
                    enum ib_event_type event_type)
{
        struct mthca_cq *cq;
        struct ib_event event;

        spin_lock(&dev->cq_table.lock);

        cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 
1));

        if (!cq) {
                mthca_warn(dev, "Async event for bogus CQ %08x\n", cqn);
                goto unlock;
        }

        event.device      = &dev->ib_dev;
        event.event       = event_type;
        event.element.cq  = &cq->ibcq;
        if (cq->ibcq.event_handler)
                cq->ibcq.event_handler(&event, cq->ibcq.cq_context);

unlock:
        spin_unlock(&dev->cq_table.lock);
}

As a general rule, I always avoid holding a lock around a user's callback. It restricts what a user can do too much.

- Sean
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to