lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 19 Mar 2015 15:33:09 +0100
From:	Michael Wang <yun.wang@...fitbricks.com>
To:	Roland Dreier <roland@...nel.org>,
	Sean Hefty <sean.hefty@...el.com>,
	Hal Rosenstock <hal.rosenstock@...il.com>,
	linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH RFC] IB/core: Move start_port() and end_port() to head file

start_port() and end_port() has been defined in both 'cache.c' and
'device.c' with exactly the same implementation.

This patch move them to the head file 'core_priv.h' for all the IB
core files to utilize.

Signed-off-by: Michael Wang <yun.wang@...fitbricks.com>
---
  drivers/infiniband/core/cache.c     | 11 -----------
  drivers/infiniband/core/core_priv.h | 12 ++++++++++++
  drivers/infiniband/core/device.c    | 12 ------------
  3 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/infiniband/core/cache.c 
b/drivers/infiniband/core/cache.c
index 80f6cf2..02315a1 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -58,17 +58,6 @@ struct ib_update_work {
      u8                 port_num;
  };

-static inline int start_port(struct ib_device *device)
-{
-    return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1;
-}
-
-static inline int end_port(struct ib_device *device)
-{
-    return (device->node_type == RDMA_NODE_IB_SWITCH) ?
-        0 : device->phys_port_cnt;
-}
-
  int ib_get_cached_gid(struct ib_device *device,
                u8                port_num,
                int               index,
diff --git a/drivers/infiniband/core/core_priv.h 
b/drivers/infiniband/core/core_priv.h
index 87d1936..3a74db0 100644
--- a/drivers/infiniband/core/core_priv.h
+++ b/drivers/infiniband/core/core_priv.h
@@ -51,4 +51,16 @@ void ib_cache_cleanup(void);

  int ib_resolve_eth_l2_attrs(struct ib_qp *qp,
                  struct ib_qp_attr *qp_attr, int *qp_attr_mask);
+
+static inline int start_port(struct ib_device *device)
+{
+    return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1;
+}
+
+static inline int end_port(struct ib_device *device)
+{
+    return (device->node_type == RDMA_NODE_IB_SWITCH) ?
+        0 : device->phys_port_cnt;
+}
+
  #endif /* _CORE_PRIV_H */
diff --git a/drivers/infiniband/core/device.c 
b/drivers/infiniband/core/device.c
index 18c1ece..2c29dea 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -151,18 +151,6 @@ static int alloc_name(char *name)
      return 0;
  }

-static int start_port(struct ib_device *device)
-{
-    return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1;
-}
-
-
-static int end_port(struct ib_device *device)
-{
-    return (device->node_type == RDMA_NODE_IB_SWITCH) ?
-        0 : device->phys_port_cnt;
-}
-
  /**
   * ib_alloc_device - allocate an IB device struct
   * @size:size of structure to allocate
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists