The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: simran singhal <singhalsimran0@gmail.com>
Cc: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de,
	pmeerw@pmeerw.net, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH 4/4] iio: light: si1145: Replace ternary operator with min macro
Date: Wed, 29 Mar 2017 14:40:56 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1703291440070.2989@hadrien> (raw)
In-Reply-To: <1490790791-5694-5-git-send-email-singhalsimran0@gmail.com>



On Wed, 29 Mar 2017, simran singhal wrote:

> 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);

A similar change involving max was already rejected.  ret < 0 is a
standard way of detecting an error, so perhaps leaving that explicitly
present will be preferred.

julia

>  }
>
>  static int si1145_measure(struct iio_dev *indio_dev,
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1490790791-5694-5-git-send-email-singhalsimran0%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

  reply	other threads:[~2017-03-29 12:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 12:33 [PATCH 0/4] drivers: iio: Replace ternary operator with min macro simran singhal
2017-03-29 12:33 ` [PATCH 1/4] iio: common: st_sensors: " simran singhal
2017-03-29 16:16   ` [Outreachy kernel] " Daniel Baluta
2017-03-29 17:24     ` SIMRAN SINGHAL
2017-03-29 12:33 ` [PATCH 2/4] iio: imu: st_lsm6dsx: " simran singhal
2017-03-29 12:33 ` [PATCH 3/4] " simran singhal
2017-03-29 12:33 ` [PATCH 4/4] iio: light: si1145: " simran singhal
2017-03-29 12:40   ` Julia Lawall [this message]
2017-03-29 12:53     ` [Outreachy kernel] " Lars-Peter Clausen
2017-03-29 14:52       ` SIMRAN SINGHAL
2017-03-29 14:53         ` SIMRAN SINGHAL
2017-03-29 18:56 ` [Outreachy kernel] [PATCH 0/4] drivers: iio: " Alison Schofield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1703291440070.2989@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=pmeerw@pmeerw.net \
    --cc=singhalsimran0@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox