Commit ab8be619 authored by Ira Weiny's avatar Ira Weiny Committed by Doug Ledford

IB/user_mad: Use new start/end port functions

Use the new common rdma_[start|end]_port functions instead of using
local variables and figuring it out on the fly.
Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 0cf18d77
...@@ -99,7 +99,6 @@ struct ib_umad_port { ...@@ -99,7 +99,6 @@ struct ib_umad_port {
}; };
struct ib_umad_device { struct ib_umad_device {
int start_port, end_port;
struct kobject kobj; struct kobject kobj;
struct ib_umad_port port[0]; struct ib_umad_port port[0];
}; };
...@@ -1275,12 +1274,8 @@ static void ib_umad_add_one(struct ib_device *device) ...@@ -1275,12 +1274,8 @@ static void ib_umad_add_one(struct ib_device *device)
int s, e, i; int s, e, i;
int count = 0; int count = 0;
if (device->node_type == RDMA_NODE_IB_SWITCH) s = rdma_start_port(device);
s = e = 0; e = rdma_end_port(device);
else {
s = 1;
e = device->phys_port_cnt;
}
umad_dev = kzalloc(sizeof *umad_dev + umad_dev = kzalloc(sizeof *umad_dev +
(e - s + 1) * sizeof (struct ib_umad_port), (e - s + 1) * sizeof (struct ib_umad_port),
...@@ -1290,9 +1285,6 @@ static void ib_umad_add_one(struct ib_device *device) ...@@ -1290,9 +1285,6 @@ static void ib_umad_add_one(struct ib_device *device)
kobject_init(&umad_dev->kobj, &ib_umad_dev_ktype); kobject_init(&umad_dev->kobj, &ib_umad_dev_ktype);
umad_dev->start_port = s;
umad_dev->end_port = e;
for (i = s; i <= e; ++i) { for (i = s; i <= e; ++i) {
if (!rdma_cap_ib_mad(device, i)) if (!rdma_cap_ib_mad(device, i))
continue; continue;
...@@ -1332,7 +1324,7 @@ static void ib_umad_remove_one(struct ib_device *device) ...@@ -1332,7 +1324,7 @@ static void ib_umad_remove_one(struct ib_device *device)
if (!umad_dev) if (!umad_dev)
return; return;
for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i) { for (i = 0; i <= rdma_end_port(device) - rdma_start_port(device); ++i) {
if (rdma_cap_ib_mad(device, i)) if (rdma_cap_ib_mad(device, i))
ib_umad_kill_port(&umad_dev->port[i]); ib_umad_kill_port(&umad_dev->port[i]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment