RDMA/netlink: Simplify and rename ibnl_chk_listeners
authorLeon Romanovsky <leonro@mellanox.com>
Sun, 18 Jun 2017 12:51:16 +0000 (15:51 +0300)
committerLeon Romanovsky <leon@kernel.org>
Thu, 10 Aug 2017 10:19:03 +0000 (13:19 +0300)
Make ibnl_chk_listeners function to be one line by removing
unneeded comparison.

Rename that function to be complaint to other functions in RDMA netlink.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
drivers/infiniband/core/addr.c
drivers/infiniband/core/netlink.c
drivers/infiniband/core/sa_query.c
include/rdma/rdma_netlink.h

index 30cf764824ecf976f4fdbc23c75cb8acb596e1bc..7310ece99cd90f8bfc26f168077b9463b2544315 100644 (file)
@@ -325,7 +325,7 @@ static void queue_req(struct addr_req *req)
 static int ib_nl_fetch_ha(struct dst_entry *dst, struct rdma_dev_addr *dev_addr,
                          const void *daddr, u32 seq, u16 family)
 {
-       if (ibnl_chk_listeners(RDMA_NL_GROUP_LS))
+       if (rdma_nl_chk_listeners(RDMA_NL_GROUP_LS))
                return -EADDRNOTAVAIL;
 
        /* We fill in what we can, the response will fill the rest */
index 5c627d1fbaa9b17ba394cf78bb08ad0c51f7e611..514959ccaf2de5d80b430201ce507afe00d129e8 100644 (file)
@@ -47,12 +47,11 @@ static struct {
        const struct ibnl_client_cbs   *cb_table;
 } rdma_nl_types[RDMA_NL_NUM_CLIENTS];
 
-int ibnl_chk_listeners(unsigned int group)
+int rdma_nl_chk_listeners(unsigned int group)
 {
-       if (netlink_has_listeners(nls, group) == 0)
-               return -1;
-       return 0;
+       return (netlink_has_listeners(nls, group)) ? 0 : -1;
 }
+EXPORT_SYMBOL(rdma_nl_chk_listeners);
 
 static bool is_nl_msg_valid(unsigned int type, unsigned int op)
 {
index 977f64d0e98392d0d56c0088a151f3115cfb44e4..2cc85c2b74b71f0a0fd550ea2387e7dd7a0f634b 100644 (file)
@@ -1418,7 +1418,7 @@ static int send_mad(struct ib_sa_query *query, int timeout_ms, gfp_t gfp_mask)
 
        if ((query->flags & IB_SA_ENABLE_LOCAL_SERVICE) &&
            (!(query->flags & IB_SA_QUERY_OPA))) {
-               if (!ibnl_chk_listeners(RDMA_NL_GROUP_LS)) {
+               if (!rdma_nl_chk_listeners(RDMA_NL_GROUP_LS)) {
                        if (!ib_nl_make_request(query, gfp_mask))
                                return id;
                }
index 16a94c425938e898ebab9e7dcec6d6ed4c1e7a56..348e0bbe0fc94624b6243611210a3185c91bc20a 100644 (file)
@@ -78,4 +78,10 @@ int rdma_nl_unicast_wait(struct sk_buff *skb, __u32 pid);
  */
 int rdma_nl_multicast(struct sk_buff *skb, unsigned int group, gfp_t flags);
 
+/**
+ * Check if there are any listeners to the netlink group
+ * @group: the netlink group ID
+ * Returns 0 on success or a negative for no listeners.
+ */
+int rdma_nl_chk_listeners(unsigned int group);
 #endif /* _RDMA_NETLINK_H */