/* ipath_destroy_srq - destroy a shared receive queue @ibsrq: the SRQ to destroy  */
int ipath_destroy_srq(struct ib_srq *ibsrq)
/* ipath_destroy_srq - destroy a shared receive queue @ibsrq: the SRQ to destroy  */
int ipath_destroy_srq(struct ib_srq *ibsrq)
{
	struct ipath_srq *srq = to_isrq(ibsrq);
	struct ipath_ibdev *dev = to_idev(ibsrq->device);
	spin_lock(&dev->n_srqs_lock);
	dev->n_srqs_allocated--;
	spin_unlock(&dev->n_srqs_lock);
	if (srq->ip)
		kref_put(&srq->ip->ref, ipath_release_mmap_info);
	else
		vfree(srq->rq.wq);
	kfree(srq);
	return 0;
}