diff mbox series

[v1] hwmon: (pc87360) Use min() macro

Message ID 20240827070442.40667-1-shenlichuan@vivo.com (mailing list archive)
State Accepted
Headers show
Series [v1] hwmon: (pc87360) Use min() macro | expand

Commit Message

Shen Lichuan Aug. 27, 2024, 7:04 a.m. UTC
Use the min() macro to simplify the pc87360_init_device() function 
and improve its readability.

Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
---
 drivers/hwmon/pc87360.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck Aug. 27, 2024, 3:07 p.m. UTC | #1
On Tue, Aug 27, 2024 at 03:04:42PM +0800, Shen Lichuan wrote:
> Use the min() macro to simplify the pc87360_init_device() function 
> and improve its readability.
> 
> Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/pc87360.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
> index 9e9681b2e8c5..788b5d58f77e 100644
> --- a/drivers/hwmon/pc87360.c
> +++ b/drivers/hwmon/pc87360.c
> @@ -1315,7 +1315,7 @@ static void pc87360_init_device(struct platform_device *pdev,
>  				    (reg & 0xC0) | 0x11);
>  	}
>  
> -	nr = data->innr < 11 ? data->innr : 11;
> +	nr = min(data->innr, 11);
>  	for (i = 0; i < nr; i++) {
>  		reg = pc87360_read_value(data, LD_IN, i,
>  					 PC87365_REG_IN_STATUS);
diff mbox series

Patch

diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
index 9e9681b2e8c5..788b5d58f77e 100644
--- a/drivers/hwmon/pc87360.c
+++ b/drivers/hwmon/pc87360.c
@@ -1315,7 +1315,7 @@  static void pc87360_init_device(struct platform_device *pdev,
 				    (reg & 0xC0) | 0x11);
 	}
 
-	nr = data->innr < 11 ? data->innr : 11;
+	nr = min(data->innr, 11);
 	for (i = 0; i < nr; i++) {
 		reg = pc87360_read_value(data, LD_IN, i,
 					 PC87365_REG_IN_STATUS);