Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1611887

[PATCH 4/4] iio: light: si1145: Replace ternary operator with min macro

From simran singhal <singhalsimran0@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 4/4] iio: light: si1145: Replace ternary operator with min macro
Date 2017-03-29 14:40 +0200
Message-ID <tql3j-6Rq-1@gated-at.bofh.it> (permalink)
References <tql3j-6Rq-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Use macro min() to get the minimum of two values for brevity and
readability.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/iio/light/si1145.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
index 096034c..e7ad6fb 100644
--- a/drivers/iio/light/si1145.c
+++ b/drivers/iio/light/si1145.c
@@ -557,7 +557,7 @@ static int si1145_set_chlist(struct iio_dev *indio_dev, unsigned long scan_mask)
 	data->scan_mask = scan_mask;
 	ret = si1145_param_set(data, SI1145_PARAM_CHLIST, reg);
 
-	return ret < 0 ? ret : 0;
+	return min(ret, 0);
 }
 
 static int si1145_measure(struct iio_dev *indio_dev,
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 4/4] iio: light: si1145: Replace ternary operator with min macro simran singhal <singhalsimran0@gmail.com> - 2017-03-29 14:40 +0200
  Re: [Outreachy kernel] [PATCH 4/4] iio: light: si1145: Replace  ternary operator with min macro Julia Lawall <julia.lawall@lip6.fr> - 2017-03-29 14:50 +0200
    Re: [Outreachy kernel] [PATCH 4/4] iio: light: si1145: Replace  ternary operator with min macro Lars-Peter Clausen <lars@metafoo.de> - 2017-03-29 15:00 +0200
      Re: [Outreachy kernel] [PATCH 4/4] iio: light: si1145: Replace  ternary operator with min macro SIMRAN SINGHAL <singhalsimran0@gmail.com> - 2017-03-29 17:00 +0200
        Re: [Outreachy kernel] [PATCH 4/4] iio: light: si1145: Replace  ternary operator with min macro SIMRAN SINGHAL <singhalsimran0@gmail.com> - 2017-03-29 17:00 +0200

csiph-web