From: Andy Shevchenko Date: Mon, 23 Feb 2026 03:40:16 +0000 (-0600) Subject: iio: light: gp2ap020a00f: Replace custom implementation of min() X-Git-Tag: v7.1-rc1~17^2~120^2~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b9e5e513915c99818780b2bb77c24da9d71a904;p=thirdparty%2Flinux.git iio: light: gp2ap020a00f: Replace custom implementation of min() Replace custom implementation of min() to save a few lines of code. Signed-off-by: Andy Shevchenko Signed-off-by: Ethan Tidmore Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c index 64be9b8ca5e36..d41b3135b1778 100644 --- a/drivers/iio/light/gp2ap020a00f.c +++ b/drivers/iio/light/gp2ap020a00f.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -45,6 +46,7 @@ #include #include #include + #include #include #include @@ -454,9 +456,7 @@ static int gp2ap020a00f_write_event_threshold(struct gp2ap020a00f_data *data, */ thresh_reg_val = data->thresh_val[th_val_id] / 16; else - thresh_reg_val = data->thresh_val[th_val_id] > 16000 ? - 16000 : - data->thresh_val[th_val_id]; + thresh_reg_val = min(data->thresh_val[th_val_id], 16000U); thresh_buf = cpu_to_le16(thresh_reg_val);