Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a154142 authored by Jason Gunthorpe's avatar Jason Gunthorpe
Browse files

RDMA: Move owner into struct ib_device_ops



This more closely follows how other subsytems work, with owner being a
member of the structure containing the function pointers.

Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 72c6ec18
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2323,6 +2323,10 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
			dev_ops->driver_id != ops->driver_id);
		dev_ops->driver_id = ops->driver_id;
	}
	if (ops->owner) {
		WARN_ON(dev_ops->owner && dev_ops->owner != ops->owner);
		dev_ops->owner = ops->owner;
	}
	if (ops->uverbs_abi_ver)
		dev_ops->uverbs_abi_ver = ops->uverbs_abi_ver;

+3 −3
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ void ib_uverbs_release_file(struct kref *ref)
	ib_dev = srcu_dereference(file->device->ib_dev,
				  &file->device->disassociate_srcu);
	if (ib_dev && !ib_dev->ops.disassociate_ucontext)
		module_put(ib_dev->owner);
		module_put(ib_dev->ops.owner);
	srcu_read_unlock(&file->device->disassociate_srcu, srcu_key);

	if (atomic_dec_and_test(&file->device->refcount))
@@ -1065,7 +1065,7 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp)
	module_dependent = !(ib_dev->ops.disassociate_ucontext);

	if (module_dependent) {
		if (!try_module_get(ib_dev->owner)) {
		if (!try_module_get(ib_dev->ops.owner)) {
			ret = -ENODEV;
			goto err;
		}
@@ -1100,7 +1100,7 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp)
	return stream_open(inode, filp);

err_module:
	module_put(ib_dev->owner);
	module_put(ib_dev->ops.owner);

err:
	mutex_unlock(&dev->lists_mutex);
+1 −1
Original line number Diff line number Diff line
@@ -596,6 +596,7 @@ static void bnxt_re_unregister_ib(struct bnxt_re_dev *rdev)
}

static const struct ib_device_ops bnxt_re_dev_ops = {
	.owner = THIS_MODULE,
	.driver_id = RDMA_DRIVER_BNXT_RE,
	.uverbs_abi_ver = BNXT_RE_ABI_VERSION,

@@ -651,7 +652,6 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
	int ret;

	/* ib device init */
	ibdev->owner = THIS_MODULE;
	ibdev->node_type = RDMA_NODE_IB_CA;
	strlcpy(ibdev->node_desc, BNXT_RE_DESC " HCA",
		strlen(BNXT_RE_DESC) + 5);
+1 −1
Original line number Diff line number Diff line
@@ -1236,6 +1236,7 @@ static void get_dev_fw_ver_str(struct ib_device *ibdev, char *str)
}

static const struct ib_device_ops iwch_dev_ops = {
	.owner = THIS_MODULE,
	.driver_id = RDMA_DRIVER_CXGB3,
	.uverbs_abi_ver = IWCH_UVERBS_ABI_VERSION,

@@ -1285,7 +1286,6 @@ int iwch_register_device(struct iwch_dev *dev)
	pr_debug("%s iwch_dev %p\n", __func__, dev);
	memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid));
	memcpy(&dev->ibdev.node_guid, dev->rdev.t3cdev_p->lldev->dev_addr, 6);
	dev->ibdev.owner = THIS_MODULE;
	dev->device_cap_flags = IB_DEVICE_LOCAL_DMA_LKEY |
				IB_DEVICE_MEM_WINDOW |
				IB_DEVICE_MEM_MGT_EXTENSIONS;
+1 −1
Original line number Diff line number Diff line
@@ -489,6 +489,7 @@ static int fill_res_entry(struct sk_buff *msg, struct rdma_restrack_entry *res)
}

static const struct ib_device_ops c4iw_dev_ops = {
	.owner = THIS_MODULE,
	.driver_id = RDMA_DRIVER_CXGB4,
	.uverbs_abi_ver = C4IW_UVERBS_ABI_VERSION,

@@ -563,7 +564,6 @@ void c4iw_register_device(struct work_struct *work)
	pr_debug("c4iw_dev %p\n", dev);
	memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid));
	memcpy(&dev->ibdev.node_guid, dev->rdev.lldi.ports[0]->dev_addr, 6);
	dev->ibdev.owner = THIS_MODULE;
	dev->device_cap_flags = IB_DEVICE_LOCAL_DMA_LKEY | IB_DEVICE_MEM_WINDOW;
	if (fastreg_support)
		dev->device_cap_flags |= IB_DEVICE_MEM_MGT_EXTENSIONS;
Loading