diff options
Diffstat (limited to 'drivers/infiniband/core/sysfs.c')
| -rw-r--r-- | drivers/infiniband/core/sysfs.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 2fe89754e592..7a599c5e455f 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
| @@ -1015,10 +1015,10 @@ err_free_stats: | |||
| 1015 | return; | 1015 | return; |
| 1016 | } | 1016 | } |
| 1017 | 1017 | ||
| 1018 | static int add_port(struct ib_core_device *coredev, | 1018 | static int add_port(struct ib_core_device *coredev, int port_num) |
| 1019 | int port_num, bool alloc_stats) | ||
| 1020 | { | 1019 | { |
| 1021 | struct ib_device *device = rdma_device_to_ibdev(&coredev->dev); | 1020 | struct ib_device *device = rdma_device_to_ibdev(&coredev->dev); |
| 1021 | bool is_full_dev = &device->coredev == coredev; | ||
| 1022 | struct ib_port *p; | 1022 | struct ib_port *p; |
| 1023 | struct ib_port_attr attr; | 1023 | struct ib_port_attr attr; |
| 1024 | int i; | 1024 | int i; |
| @@ -1057,7 +1057,7 @@ static int add_port(struct ib_core_device *coredev, | |||
| 1057 | goto err_put; | 1057 | goto err_put; |
| 1058 | } | 1058 | } |
| 1059 | 1059 | ||
| 1060 | if (device->ops.process_mad && alloc_stats) { | 1060 | if (device->ops.process_mad && is_full_dev) { |
| 1061 | p->pma_table = get_counter_table(device, port_num); | 1061 | p->pma_table = get_counter_table(device, port_num); |
| 1062 | ret = sysfs_create_group(&p->kobj, p->pma_table); | 1062 | ret = sysfs_create_group(&p->kobj, p->pma_table); |
| 1063 | if (ret) | 1063 | if (ret) |
| @@ -1113,7 +1113,7 @@ static int add_port(struct ib_core_device *coredev, | |||
| 1113 | if (ret) | 1113 | if (ret) |
| 1114 | goto err_free_pkey; | 1114 | goto err_free_pkey; |
| 1115 | 1115 | ||
| 1116 | if (device->ops.init_port) { | 1116 | if (device->ops.init_port && is_full_dev) { |
| 1117 | ret = device->ops.init_port(device, port_num, &p->kobj); | 1117 | ret = device->ops.init_port(device, port_num, &p->kobj); |
| 1118 | if (ret) | 1118 | if (ret) |
| 1119 | goto err_remove_pkey; | 1119 | goto err_remove_pkey; |
| @@ -1124,7 +1124,7 @@ static int add_port(struct ib_core_device *coredev, | |||
| 1124 | * port, so holder should be device. Therefore skip per port conunter | 1124 | * port, so holder should be device. Therefore skip per port conunter |
| 1125 | * initialization. | 1125 | * initialization. |
| 1126 | */ | 1126 | */ |
| 1127 | if (device->ops.alloc_hw_stats && port_num && alloc_stats) | 1127 | if (device->ops.alloc_hw_stats && port_num && is_full_dev) |
| 1128 | setup_hw_stats(device, p, port_num); | 1128 | setup_hw_stats(device, p, port_num); |
| 1129 | 1129 | ||
| 1130 | list_add_tail(&p->kobj.entry, &coredev->port_list); | 1130 | list_add_tail(&p->kobj.entry, &coredev->port_list); |
| @@ -1308,7 +1308,7 @@ void ib_free_port_attrs(struct ib_core_device *coredev) | |||
| 1308 | kobject_put(coredev->ports_kobj); | 1308 | kobject_put(coredev->ports_kobj); |
| 1309 | } | 1309 | } |
| 1310 | 1310 | ||
| 1311 | int ib_setup_port_attrs(struct ib_core_device *coredev, bool alloc_stats) | 1311 | int ib_setup_port_attrs(struct ib_core_device *coredev) |
| 1312 | { | 1312 | { |
| 1313 | struct ib_device *device = rdma_device_to_ibdev(&coredev->dev); | 1313 | struct ib_device *device = rdma_device_to_ibdev(&coredev->dev); |
| 1314 | unsigned int port; | 1314 | unsigned int port; |
| @@ -1320,7 +1320,7 @@ int ib_setup_port_attrs(struct ib_core_device *coredev, bool alloc_stats) | |||
| 1320 | return -ENOMEM; | 1320 | return -ENOMEM; |
| 1321 | 1321 | ||
| 1322 | rdma_for_each_port (device, port) { | 1322 | rdma_for_each_port (device, port) { |
| 1323 | ret = add_port(coredev, port, alloc_stats); | 1323 | ret = add_port(coredev, port); |
| 1324 | if (ret) | 1324 | if (ret) |
| 1325 | goto err_put; | 1325 | goto err_put; |
| 1326 | } | 1326 | } |
| @@ -1336,7 +1336,7 @@ int ib_device_register_sysfs(struct ib_device *device) | |||
| 1336 | { | 1336 | { |
| 1337 | int ret; | 1337 | int ret; |
| 1338 | 1338 | ||
| 1339 | ret = ib_setup_port_attrs(&device->coredev, true); | 1339 | ret = ib_setup_port_attrs(&device->coredev); |
| 1340 | if (ret) | 1340 | if (ret) |
| 1341 | return ret; | 1341 | return ret; |
| 1342 | 1342 | ||
