Commit 1af4c435 authored by Roland Dreier's avatar Roland Dreier

IB/core: Use start_port() and end_port()

Clean up ib_query_port() and ib_modify_port() slightly by using the 
just-added start_port() and end_port() helpers.
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 5eb620c8
...@@ -569,10 +569,7 @@ int ib_query_port(struct ib_device *device, ...@@ -569,10 +569,7 @@ int ib_query_port(struct ib_device *device,
u8 port_num, u8 port_num,
struct ib_port_attr *port_attr) struct ib_port_attr *port_attr)
{ {
if (device->node_type == RDMA_NODE_IB_SWITCH) { if (port_num < start_port(device) || port_num > end_port(device))
if (port_num)
return -EINVAL;
} else if (port_num < 1 || port_num > device->phys_port_cnt)
return -EINVAL; return -EINVAL;
return device->query_port(device, port_num, port_attr); return device->query_port(device, port_num, port_attr);
...@@ -644,10 +641,7 @@ int ib_modify_port(struct ib_device *device, ...@@ -644,10 +641,7 @@ int ib_modify_port(struct ib_device *device,
u8 port_num, int port_modify_mask, u8 port_num, int port_modify_mask,
struct ib_port_modify *port_modify) struct ib_port_modify *port_modify)
{ {
if (device->node_type == RDMA_NODE_IB_SWITCH) { if (port_num < start_port(device) || port_num > end_port(device))
if (port_num)
return -EINVAL;
} else if (port_num < 1 || port_num > device->phys_port_cnt)
return -EINVAL; return -EINVAL;
return device->modify_port(device, port_num, port_modify_mask, return device->modify_port(device, port_num, port_modify_mask,
......
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