All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Mårten Lindahl" <marten.lindahl@axis.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio@vger.kernel.org, kernel@axis.com
Subject: Re: [PATCH v4 3/3] iio: light: vcnl4000: Add interrupt support for vcnl4040
Date: Tue, 17 Jan 2023 17:58:54 +0200	[thread overview]
Message-ID: <Y8bFvovmqKCO6fVC@smile.fi.intel.com> (raw)
In-Reply-To: <20230117152435.3510319-4-marten.lindahl@axis.com>

On Tue, Jan 17, 2023 at 04:24:35PM +0100, Mårten Lindahl wrote:
> Add support to configure proximity sensor interrupts and threshold
> limits for vcnl4040. If an interrupt is detected an event will be
> pushed to the event interface.

...

> +	return (dir == IIO_EV_DIR_RISING) ?

> +	    FIELD_GET(VCNL4040_PS_IF_AWAY, ret) :
> +	    FIELD_GET(VCNL4040_PS_IF_CLOSE, ret);

Indentation issues?

...

> +	val = ret;
> +
> +	if (dir == IIO_EV_DIR_RISING)
> +		val = state ? (val | VCNL4040_PS_IF_AWAY) :
> +		    (val & ~VCNL4040_PS_IF_AWAY);
> +	else
> +		val = state ? (val | VCNL4040_PS_IF_CLOSE) :
> +		    (val & ~VCNL4040_PS_IF_CLOSE);


Wouldn't be better

	uXX val, mask;


	if (dir == IIO_EV_DIR_RISING)
		mask = VCNL4040_PS_IF_AWAY;
	else
		mask = VCNL4040_PS_IF_CLOSE;

	val = state ? (val | mask) : (val & ~mask);

?

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-01-17 15:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 15:24 [PATCH v4 0/3] iio: light: vcnl4000: Add vcnl4040 interrupt support Mårten Lindahl
2023-01-17 15:24 ` [PATCH v4 1/3] iio: light: vcnl4000: Prepare for more generic setup Mårten Lindahl
2023-01-17 15:51   ` Andy Shevchenko
2023-01-17 17:07     ` Marten Lindahl
2023-01-17 15:24 ` [PATCH v4 2/3] iio: light: vcnl4000: Make irq handling more generic Mårten Lindahl
2023-01-17 15:53   ` Andy Shevchenko
2023-01-17 17:09     ` Marten Lindahl
2023-01-17 15:24 ` [PATCH v4 3/3] iio: light: vcnl4000: Add interrupt support for vcnl4040 Mårten Lindahl
2023-01-17 15:58   ` Andy Shevchenko [this message]
2023-01-17 15:59     ` Andy Shevchenko
2023-01-17 17:14       ` Marten Lindahl

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=Y8bFvovmqKCO6fVC@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=jic23@kernel.org \
    --cc=kernel@axis.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=marten.lindahl@axis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.