Re: [PATCH v2 4/4] input: misc: rt5120: Add power key support

From: Dmitry Torokhov
Date: Sat Jul 09 2022 - 00:53:52 EST


Hi ChiYuan,

On Wed, Jun 22, 2022 at 06:01:44PM +0800, cy_huang wrote:
> +
> + is_pressed = !(stat & RT5120_PWRKEYSTAT_MASK);
> +
> + if ((is_pressed && irq == priv->press_irq) ||
> + (!is_pressed && irq == priv->release_irq)) {
> + input_report_key(priv->input, KEY_POWER, is_pressed);
> + input_sync(priv->input);
> + }
> +

What is the reason for checking both the status and interrupt? Can we
simply say:


input_report_key(priv->input, KEY_POWER,
!(stat & RT5120_PWRKEYSTAT_MASK));
input_sync(priv->input);

?

Thanks.

--
Dmitry