linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Wang <yun.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
To: Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Hal Rosenstock
	<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH RFC] IB/core: Move start_port() and end_port() to head file
Date: Thu, 19 Mar 2015 15:33:09 +0100	[thread overview]
Message-ID: <550ADE25.9060605@profitbricks.com> (raw)

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-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
---
  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-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

                 reply	other threads:[~2015-03-19 14:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=550ADE25.9060605@profitbricks.com \
    --to=yun.wang-eikl63zcoxah+58jc4qpia@public.gmane.org \
    --cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).