diff mbox series

[v1] fusion: mptctl: Use min macro

Message ID 20240827113922.3898849-1-yanzhen@vivo.com
State Superseded
Headers show
Series [v1] fusion: mptctl: Use min macro | expand

Commit Message

Yan Zhen Aug. 27, 2024, 11:39 a.m. UTC
Using the real macro is usually more intuitive and readable,
When the original file is guaranteed to contain the minmax.h header file 
and compile correctly.

Signed-off-by: Yan Zhen <yanzhen@vivo.com>
---
 drivers/message/fusion/mptctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Laight Aug. 31, 2024, 12:19 p.m. UTC | #1
From: Yan Zhen
> Sent: 27 August 2024 12:39
> 
> Using the real macro is usually more intuitive and readable,
> When the original file is guaranteed to contain the minmax.h header file
> and compile correctly.
> 
> Signed-off-by: Yan Zhen <yanzhen@vivo.com>
> ---
>  drivers/message/fusion/mptctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
> index 9f3999750..17798edf7 100644
> --- a/drivers/message/fusion/mptctl.c
> +++ b/drivers/message/fusion/mptctl.c
> @@ -1609,7 +1609,7 @@ mptctl_eventreport (MPT_ADAPTER *ioc, unsigned long arg)
>  	maxEvents = numBytes/sizeof(MPT_IOCTL_EVENTS);
> 
> 
> -	max = MPTCTL_EVENT_LOG_SIZE < maxEvents ? MPTCTL_EVENT_LOG_SIZE : maxEvents;
> +	max = min(MPTCTL_EVENT_LOG_SIZE, maxEvents);

IMHO the arguments should be swapped.
	min(variable, CONSTANT);
is better.

	David.

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
diff mbox series

Patch

diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index 9f3999750..17798edf7 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -1609,7 +1609,7 @@  mptctl_eventreport (MPT_ADAPTER *ioc, unsigned long arg)
 	maxEvents = numBytes/sizeof(MPT_IOCTL_EVENTS);
 
 
-	max = MPTCTL_EVENT_LOG_SIZE < maxEvents ? MPTCTL_EVENT_LOG_SIZE : maxEvents;
+	max = min(MPTCTL_EVENT_LOG_SIZE, maxEvents);
 
 	/* If fewer than 1 event is requested, there must have
 	 * been some type of error.