lkml.org 
[lkml]   [2019]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: iio: ad7150: use ternary operating to ensure 0/1 value
On Fri, 14 Jun 2019 13:50:59 -0300
Melissa Wen <melissa.srw@gmail.com> wrote:

> Remove idiom and use ternary operator for consistently trigger 0/1 value
> on variable declaration.
>
> Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Hi Melissa,

In general I would consider this unnecessary churn as, whilst
it's no longer a favoured idiom, it is extremely common in the
kernel. However, as this is a staging cleanup, fair enough to
make it as 'nice as possible'!

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan

> ---
> drivers/staging/iio/cdc/ad7150.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
> index 8234da4b8c65..25598bf124fb 100644
> --- a/drivers/staging/iio/cdc/ad7150.c
> +++ b/drivers/staging/iio/cdc/ad7150.c
> @@ -350,8 +350,8 @@ static ssize_t ad7150_show_timeout(struct device *dev,
>
> /* use the event code for consistency reasons */
> int chan = IIO_EVENT_CODE_EXTRACT_CHAN(this_attr->address);
> - int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(this_attr->address)
> - == IIO_EV_DIR_RISING);
> + int rising = (IIO_EVENT_CODE_EXTRACT_DIR(this_attr->address)
> + == IIO_EV_DIR_RISING) ? 1 : 0;
>
> switch (IIO_EVENT_CODE_EXTRACT_TYPE(this_attr->address)) {
> case IIO_EV_TYPE_MAG_ADAPTIVE:

\
 
 \ /
  Last update: 2019-06-16 12:17    [W:0.057 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site