aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4/sysfs.c
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2018-10-07 12:12:39 +0300
committerDoug Ledford <dledford@redhat.com>2018-10-16 14:09:44 -0400
commit60f1fc204940fc0352394866b2af0987fd5b2563 (patch)
tree537c6c40cf9a973479a8992a627cbe49fdbf79fb /drivers/infiniband/hw/mlx4/sysfs.c
parentRDMA/nldev: Allow IB device rename through RDMA netlink (diff)
downloadlinux-dev-60f1fc204940fc0352394866b2af0987fd5b2563.tar.xz
linux-dev-60f1fc204940fc0352394866b2af0987fd5b2563.zip
IB/mlx4: Refer to the device kobject instead of ports_parent
iov sysfs tree is created under ib device at /sys/class/infiniband/mlx4_0/iov. And, ibdev->ports_parent->parent = &ibdev->dev. Therefore, refer to device's kobject directly instead of indirect access to it. Additionally, iov entries are created under device kobject and deleted before device is removed. There is no need to hold additional reference to device kobject in provider driver. Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx4/sysfs.c')
-rw-r--r--drivers/infiniband/hw/mlx4/sysfs.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/mlx4/sysfs.c b/drivers/infiniband/hw/mlx4/sysfs.c
index e219093d2764..752bdd536130 100644
--- a/drivers/infiniband/hw/mlx4/sysfs.c
+++ b/drivers/infiniband/hw/mlx4/sysfs.c
@@ -818,9 +818,7 @@ int mlx4_ib_device_register_sysfs(struct mlx4_ib_dev *dev)
if (!mlx4_is_master(dev->dev))
return 0;
- dev->iov_parent =
- kobject_create_and_add("iov",
- kobject_get(dev->ib_dev.ports_parent->parent));
+ dev->iov_parent = kobject_create_and_add("iov", &dev->ib_dev.dev.kobj);
if (!dev->iov_parent) {
ret = -ENOMEM;
goto err;
@@ -850,7 +848,6 @@ err_add_entries:
err_ports:
kobject_put(dev->iov_parent);
err:
- kobject_put(dev->ib_dev.ports_parent->parent);
pr_err("mlx4_ib_device_register_sysfs error (%d)\n", ret);
return ret;
}
@@ -886,5 +883,4 @@ void mlx4_ib_device_unregister_sysfs(struct mlx4_ib_dev *device)
kobject_put(device->ports_parent);
kobject_put(device->iov_parent);
kobject_put(device->iov_parent);
- kobject_put(device->ib_dev.ports_parent->parent);
}