[PATCH] aoe: Use min() to simplify code in probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use min() to simplify probe() and improve its readability.

Signed-off-by: wangyufei <wangyufei@xxxxxxxx>
---
 drivers/block/aoe/aoecmd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 6298f8e27..d6fd83245 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -16,6 +16,7 @@
 #include <net/net_namespace.h>
 #include <linux/unaligned.h>
 #include <linux/uio.h>
+#include <linux/minmax.h>
 #include "aoe.h"
 
 #define MAXIOC (8192)	/* default meant to avoid most soft lockups */
@@ -607,10 +608,7 @@ probe(struct aoetgt *t)
 	ata_rw_frameinit(f);
 	skb = f->skb;
 	for (frag = 0, n = f->iter.bi_size; n > 0; ++frag, n -= m) {
-		if (n < PAGE_SIZE)
-			m = n;
-		else
-			m = PAGE_SIZE;
+		m = min(n, PAGE_SIZE);
 		skb_fill_page_desc(skb, frag, empty_page, 0, m);
 	}
 	skb->len += f->iter.bi_size;
-- 
2.39.0





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux