Skip to contentSkip to conversation

liquidio: standardization: use min_t instead of custom macro

PATCH Superseded Felix Manlunas 2 participants 2 messages Jun 24, 2017 – Jun 25, 2017

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 liquidio: standardization: use min_t instead of custom macro

From: Rick Farrington <[email protected]>

Replaced custom MIN macro with use of standard 'min_t'.

---
 drivers/net/ethernet/cavium/liquidio/octeon_console.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/cavium/liquidio/octeon_console.c +1 -2
index 53f38d0..2dc0e30 100644
@@ -42,7 +42,6 @@ static int octeon_console_read(struct octeon_device *oct, u32 console_num,
 MODULE_PARM_DESC(console_bitmask,
 		 "Bitmask indicating which consoles have debug output redirected to syslog.");
 
-#define MIN(a, b) min((a), (b))
 #define CAST_ULL(v) ((u64)(v))
 
 #define BOOTLOADER_PCI_READ_BUFFER_DATA_ADDR    0x0006c008
@@ -704,7 +703,7 @@ static int octeon_console_read(struct octeon_device *oct, u32 console_num,
 	if (bytes_to_read <= 0)
 		return bytes_to_read;
 
-	bytes_to_read = MIN(bytes_to_read, (s32)buf_size);
+	bytes_to_read = min_t(s32, bytes_to_read, buf_size);
 
 	/* Check to see if what we want to read is not contiguous, and limit
 	 * ourselves to the contiguous block
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 16 lines · Felix Manlunas

From: Rick Farrington <[email protected]>

Replaced custom MIN macro with use of standard 'min_t'.

---
 drivers/net/ethernet/cavium/liquidio/octeon_console.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/cavium/liquidio/octeon_console.c +0 -0
index 53f38d0..2dc0e30 100644

drivers/net/ethernet/cavium/liquidio/octeon_console.c static int octeon_console_read(struct octeon_device *oct, u32 console_num, · line 45

Quoted 5 lines
drivers/net/ethernet/cavium/liquidio/octeon_console.c +0 -1
@@ -42,7 +42,6 @@ static int octeon_console_read(struct octeon_device *oct, u32 console_num,
 MODULE_PARM_DESC(console_bitmask,
 		 "Bitmask indicating which consoles have debug output redirected to syslog.");
 
-#define MIN(a, b) min((a), (b))
 #define CAST_ULL(v) ((u64)(v))

It will be awesome to drop this macro too. It is used in one place and hides important information.

Thanks

Quoted 14 lines
drivers/net/ethernet/cavium/liquidio/octeon_console.c +1 -2
 #define BOOTLOADER_PCI_READ_BUFFER_DATA_ADDR    0x0006c008
@@ -704,7 +703,7 @@ static int octeon_console_read(struct octeon_device *oct, u32 console_num,
 	if (bytes_to_read <= 0)
 		return bytes_to_read;
 
-	bytes_to_read = MIN(bytes_to_read, (s32)buf_size);
+	bytes_to_read = min_t(s32, bytes_to_read, buf_size);
 
 	/* Check to see if what we want to read is not contiguous, and limit
 	 * ourselves to the contiguous block
--

1.8.3.1