diff options
author | Parav Pandit <parav@mellanox.com> | 2018-07-29 11:53:10 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-07-30 20:49:04 -0600 |
commit | 2df7dba855e10cca8eddcd38bca825446ea10e1d (patch) | |
tree | 3d93619a1c5ac1153be6d3026831c69c45042bb3 /drivers/infiniband/core/cma.c | |
parent | 219d2e9dfda9431b808c28d5efc74b404b95b638 (diff) | |
download | linux-stable-2df7dba855e10cca8eddcd38bca825446ea10e1d.tar.gz linux-stable-2df7dba855e10cca8eddcd38bca825446ea10e1d.tar.bz2 linux-stable-2df7dba855e10cca8eddcd38bca825446ea10e1d.zip |
RDMA/core: Constify dst_addr argument
Following APIs are not supposed to modify addr or dest_addr contents.
Therefore make those function argument const for better code
readability.
1. rdma_resolve_ip()
2. rdma_addr_size()
3. rdma_resolve_addr()
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/cma.c')
-rw-r--r-- | drivers/infiniband/core/cma.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 0794b99d2507..f326965a0616 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -1046,7 +1046,7 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr, } EXPORT_SYMBOL(rdma_init_qp_attr); -static inline int cma_zero_addr(struct sockaddr *addr) +static inline int cma_zero_addr(const struct sockaddr *addr) { switch (addr->sa_family) { case AF_INET: @@ -1060,7 +1060,7 @@ static inline int cma_zero_addr(struct sockaddr *addr) } } -static inline int cma_loopback_addr(struct sockaddr *addr) +static inline int cma_loopback_addr(const struct sockaddr *addr) { switch (addr->sa_family) { case AF_INET: @@ -1074,7 +1074,7 @@ static inline int cma_loopback_addr(struct sockaddr *addr) } } -static inline int cma_any_addr(struct sockaddr *addr) +static inline int cma_any_addr(const struct sockaddr *addr) { return cma_zero_addr(addr) || cma_loopback_addr(addr); } @@ -1097,7 +1097,7 @@ static int cma_addr_cmp(struct sockaddr *src, struct sockaddr *dst) } } -static __be16 cma_port(struct sockaddr *addr) +static __be16 cma_port(const struct sockaddr *addr) { struct sockaddr_ib *sib; @@ -1115,7 +1115,7 @@ static __be16 cma_port(struct sockaddr *addr) } } -static inline int cma_any_port(struct sockaddr *addr) +static inline int cma_any_port(const struct sockaddr *addr) { return !cma_port(addr); } @@ -2944,7 +2944,7 @@ err: } static int cma_bind_addr(struct rdma_cm_id *id, struct sockaddr *src_addr, - struct sockaddr *dst_addr) + const struct sockaddr *dst_addr) { if (!src_addr || !src_addr->sa_family) { src_addr = (struct sockaddr *) &id->route.addr.src_addr; @@ -2965,7 +2965,7 @@ static int cma_bind_addr(struct rdma_cm_id *id, struct sockaddr *src_addr, } int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr, - struct sockaddr *dst_addr, int timeout_ms) + const struct sockaddr *dst_addr, int timeout_ms) { struct rdma_id_private *id_priv; int ret; |