diff options
author | Parav Pandit <parav@mellanox.com> | 2018-12-18 07:28:30 -0500 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-01-14 15:05:14 -0500 |
commit | ea4baf7f116a18382df331db2123d98bc1c3cd83 (patch) | |
tree | eda84e63f296b43e6132b1924b9887617e639714 /drivers/infiniband/core/sysfs.c | |
parent | 081de9495c7a90560e9cc264cdcc2ff39b705843 (diff) |
RDMA: Rename port_callback to init_port
Most provider routines are callback routines which ib core invokes.
_callback suffix doesn't convey information about when such callback is
invoked. Therefore, rename port_callback to init_port.
Additionally, store the init_port function pointer in ib_device_ops, so
that it can be accessed in subsequent patches when binding rdma device to
net namespace.
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/sysfs.c')
-rw-r--r-- | drivers/infiniband/core/sysfs.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 80f68eb0ba5c..7a5679933df6 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -1015,9 +1015,7 @@ err_free_stats: | |||
1015 | return; | 1015 | return; |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | static int add_port(struct ib_device *device, int port_num, | 1018 | static int add_port(struct ib_device *device, int port_num) |
1019 | int (*port_callback)(struct ib_device *, | ||
1020 | u8, struct kobject *)) | ||
1021 | { | 1019 | { |
1022 | struct ib_port *p; | 1020 | struct ib_port *p; |
1023 | struct ib_port_attr attr; | 1021 | struct ib_port_attr attr; |
@@ -1113,8 +1111,8 @@ static int add_port(struct ib_device *device, int port_num, | |||
1113 | if (ret) | 1111 | if (ret) |
1114 | goto err_free_pkey; | 1112 | goto err_free_pkey; |
1115 | 1113 | ||
1116 | if (port_callback) { | 1114 | if (device->ops.init_port) { |
1117 | ret = port_callback(device, port_num, &p->kobj); | 1115 | ret = device->ops.init_port(device, port_num, &p->kobj); |
1118 | if (ret) | 1116 | if (ret) |
1119 | goto err_remove_pkey; | 1117 | goto err_remove_pkey; |
1120 | } | 1118 | } |
@@ -1308,9 +1306,7 @@ static void free_port_list_attributes(struct ib_device *device) | |||
1308 | kobject_put(device->ports_kobj); | 1306 | kobject_put(device->ports_kobj); |
1309 | } | 1307 | } |
1310 | 1308 | ||
1311 | int ib_device_register_sysfs(struct ib_device *device, | 1309 | int ib_device_register_sysfs(struct ib_device *device) |
1312 | int (*port_callback)(struct ib_device *, | ||
1313 | u8, struct kobject *)) | ||
1314 | { | 1310 | { |
1315 | struct device *class_dev = &device->dev; | 1311 | struct device *class_dev = &device->dev; |
1316 | int ret; | 1312 | int ret; |
@@ -1330,12 +1326,12 @@ int ib_device_register_sysfs(struct ib_device *device, | |||
1330 | } | 1326 | } |
1331 | 1327 | ||
1332 | if (rdma_cap_ib_switch(device)) { | 1328 | if (rdma_cap_ib_switch(device)) { |
1333 | ret = add_port(device, 0, port_callback); | 1329 | ret = add_port(device, 0); |
1334 | if (ret) | 1330 | if (ret) |
1335 | goto err_put; | 1331 | goto err_put; |
1336 | } else { | 1332 | } else { |
1337 | for (i = 1; i <= device->phys_port_cnt; ++i) { | 1333 | for (i = 1; i <= device->phys_port_cnt; ++i) { |
1338 | ret = add_port(device, i, port_callback); | 1334 | ret = add_port(device, i); |
1339 | if (ret) | 1335 | if (ret) |
1340 | goto err_put; | 1336 | goto err_put; |
1341 | } | 1337 | } |