From: Roland Dreier Date: Sat, 19 May 2007 15:51:54 +0000 (-0700) Subject: IB/core: Use start_port() and end_port() X-Git-Tag: v2.6.22-rc3~108^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1af4c435f3ab9cdf72ce86c35a455c8bef1d6536;p=platform%2Fkernel%2Flinux-3.10.git 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: Roland Dreier --- diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index b448e0b..b583196 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -569,10 +569,7 @@ int ib_query_port(struct ib_device *device, u8 port_num, struct ib_port_attr *port_attr) { - if (device->node_type == RDMA_NODE_IB_SWITCH) { - if (port_num) - return -EINVAL; - } else if (port_num < 1 || port_num > device->phys_port_cnt) + if (port_num < start_port(device) || port_num > end_port(device)) return -EINVAL; return device->query_port(device, port_num, port_attr); @@ -644,10 +641,7 @@ int ib_modify_port(struct ib_device *device, u8 port_num, int port_modify_mask, struct ib_port_modify *port_modify) { - if (device->node_type == RDMA_NODE_IB_SWITCH) { - if (port_num) - return -EINVAL; - } else if (port_num < 1 || port_num > device->phys_port_cnt) + if (port_num < start_port(device) || port_num > end_port(device)) return -EINVAL; return device->modify_port(device, port_num, port_modify_mask,