Skip to contentSkip to conversation

block/partitions/acorn: use min in {riscix,linux}_partition

PATCH Applied Thorsten Blum 3 participants 3 messages Jun 2 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/partitions/acorn: use min in {riscix,linux}_partition

Use min() to replace the open-coded implementations and to simplify riscix_partition() and linux_partition().

---
 block/partitions/acorn.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
block/partitions/acorn.c +3 -2
index 9f7389f174d0..067d6a27a3bd 100644
@@ -9,6 +9,7 @@
  */
 #include <linux/buffer_head.h>
 #include <linux/adfs_fs.h>
+#include <linux/minmax.h>
 
 #include "check.h"
 
@@ -80,7 +81,7 @@ static int riscix_partition(struct parsed_partitions *state,
 
 
 	if (rr->magic == RISCIX_MAGIC) {
-		unsigned long size = nr_sects > 2 ? 2 : nr_sects;
+		unsigned long size = min(nr_sects, 2);
 		int part;
 
 		seq_buf_puts(&state->pp_buf, " <");
@@ -124,7 +125,7 @@ static int linux_partition(struct parsed_partitions *state,
 {
 	Sector sect;
 	struct linux_part *linuxp;
-	unsigned long size = nr_sects > 2 ? 2 : nr_sects;
+	unsigned long size = min(nr_sects, 2);
 
 	seq_buf_puts(&state->pp_buf, " [Linux]");
 
maintainer Applied
#2 lore raw
In reply to Thorsten Blum
Quoted 2 lines · Thorsten Blum

Use min() to replace the open-coded implementations and to simplify riscix_partition() and linux_partition().

Applied, thanks!

[1/1] block/partitions/acorn: use min in {riscix,linux}_partition

      commit: aa528cd12ca6e7fda15f855b6d2095fd34d167e0

Best regards,

Signature · 1 line
Jens Axboe