summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhumika Goyal <bhumirks@gmail.com>2016-02-26 10:04:31 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-12 06:09:09 (GMT)
commitc754db403d740827e49f5f9dedd9594ff55ccbe7 (patch)
treef7f15fad0e832e32094057f0e00e69b6732507db
parent16ccad0475796c0acc084a51a49c9a86051586db (diff)
downloadlinux-c754db403d740827e49f5f9dedd9594ff55ccbe7.tar.xz
Staging: rdma: Use min macro instead of ternary operator
This patch replaces ternary operator with macro min as it shorter and thus increases code readability. Macro min return the minimum of the two compared values. Made a semantic patch for changes: @@ type T; T x; T y; @@ ( - x < y ? x : y + min(x,y) | - x > y ? x : y + max(x,y) ) Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/rdma/hfi1/pio_copy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/rdma/hfi1/pio_copy.c b/drivers/staging/rdma/hfi1/pio_copy.c
index ebb0baf..64bef6c2 100644
--- a/drivers/staging/rdma/hfi1/pio_copy.c
+++ b/drivers/staging/rdma/hfi1/pio_copy.c
@@ -235,7 +235,7 @@ static inline void read_extra_bytes(struct pio_buf *pbuf,
while (nbytes) {
/* find the number of bytes in this u64 */
room = 8 - off; /* this u64 has room for this many bytes */
- xbytes = nbytes > room ? room : nbytes;
+ xbytes = min(room, nbytes);
/*
* shift down to zero lower bytes, shift up to zero upper
@@ -565,7 +565,7 @@ static void mid_copy_mix(struct pio_buf *pbuf, const void *from, size_t nbytes)
/* calculate the end of data or end of block, whichever
comes first */
send = pbuf->start + PIO_BLOCK_SIZE;
- xend = send < dend ? send : dend;
+ xend = min(send, dend);
/* shift up to SOP=1 space */
dest += SOP_DISTANCE;
@@ -659,7 +659,7 @@ static void mid_copy_straight(struct pio_buf *pbuf,
/* calculate the end of data or end of block, whichever
comes first */
send = pbuf->start + PIO_BLOCK_SIZE;
- xend = send < dend ? send : dend;
+ xend = min(send, dend);
/* shift up to SOP=1 space */
dest += SOP_DISTANCE;