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: Jason Gunthorpe <jgg@mellanox.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user