[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YskJ1wAp0rV9qFRM@google.com>
Date:   Fri, 8 Jul 2022 21:53:43 -0700
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     cy_huang <u0084500@...il.com>
Cc:     robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
        lee.jones@...aro.org, broonie@...nel.org, lgirdwood@...il.com,
        cy_huang@...htek.com, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-input@...r.kernel.org
Subject: Re: [PATCH v2 4/4] input: misc: rt5120: Add power key support
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
Powered by blists - more mailing lists
 
