]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
hwmon: (pc87360) Use min() macro
authorShen Lichuan <shenlichuan@vivo.com>
Tue, 27 Aug 2024 07:04:42 +0000 (15:04 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 27 Aug 2024 15:12:23 +0000 (08:12 -0700)
Use the min() macro to simplify the pc87360_init_device() function
and improve its readability.

Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
Message-ID: <20240827070442.40667-1-shenlichuan@vivo.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pc87360.c

index 9e9681b2e8c55ee85198acb85c9759b774beaa10..788b5d58f77eaf8d4a8d3c377170f6d569ceb935 100644 (file)
@@ -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);