netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] liquidio: standardization: use min_t instead of custom macro
@ 2017-06-24 11:31 Felix Manlunas
  2017-06-25  6:09 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Manlunas @ 2017-06-24 11:31 UTC (permalink / raw)
  To: davem
  Cc: netdev, raghu.vatsavayi, derek.chickles, satananda.burla,
	ricardo.farrington

From: Rick Farrington <ricardo.farrington@cavium.com>

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

Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com>
Signed-off-by: Derek Chickles <derek.chickles@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
---
 drivers/net/ethernet/cavium/liquidio/octeon_console.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_console.c b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
index 53f38d0..2dc0e30 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_console.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
@@ -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
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] liquidio: standardization: use min_t instead of custom macro
  2017-06-24 11:31 [PATCH net-next] liquidio: standardization: use min_t instead of custom macro Felix Manlunas
@ 2017-06-25  6:09 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2017-06-25  6:09 UTC (permalink / raw)
  To: Felix Manlunas
  Cc: davem, netdev, raghu.vatsavayi, derek.chickles, satananda.burla,
	ricardo.farrington

[-- Attachment #1: Type: text/plain, Size: 1631 bytes --]

On Sat, Jun 24, 2017 at 04:31:56AM -0700, Felix Manlunas wrote:
> From: Rick Farrington <ricardo.farrington@cavium.com>
>
> Replaced custom MIN macro with use of standard 'min_t'.
>
> Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com>
> Signed-off-by: Derek Chickles <derek.chickles@cavium.com>
> Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
> ---
>  drivers/net/ethernet/cavium/liquidio/octeon_console.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_console.c b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
> index 53f38d0..2dc0e30 100644
> --- a/drivers/net/ethernet/cavium/liquidio/octeon_console.c
> +++ b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
> @@ -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

>
>  #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
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-25  6:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-24 11:31 [PATCH net-next] liquidio: standardization: use min_t instead of custom macro Felix Manlunas
2017-06-25  6:09 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).