Re: [PATCH v4 3/3] iio: light: vcnl4000: Add interrupt support for vcnl4040

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux