All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Support Opensource <support.opensource@diasemi.com>,
	linux-input@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Biju Das <biju.das.au@gmail.com>,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v2 4/4] Input: da9063 - Add polling support
Date: Mon, 18 Dec 2023 17:52:50 -0800	[thread overview]
Message-ID: <ZYD3cvHBHMZoACnQ@google.com> (raw)
In-Reply-To: <20231213214803.9931-5-biju.das.jz@bp.renesas.com>

On Wed, Dec 13, 2023 at 09:48:03PM +0000, Biju Das wrote:
> +static void da9063_onkey_polled_poll(struct input_dev *input)
> +{
> +	struct da9063_onkey *onkey = input_get_drvdata(input);
> +	const struct da906x_chip_config *config = onkey->config;
> +	unsigned int val;
> +	int error;
> +
> +	error = regmap_read(onkey->regmap, config->onkey_status, &val);
> +	if (onkey->key_power && !error && (val & config->onkey_nonkey_mask)) {
> +		input_report_key(onkey->input, KEY_POWER, 1);
> +		input_sync(onkey->input);
> +		schedule_delayed_work(&onkey->work, 0);

In the polling case you should not be scheduling any additional works as
the driver may get confused if you repeatedly open and close input
device.

Also I think in threaded case it might be cleaner to avoid scheduling
work and simply loop in the interrupt thread (since it can sleep).

Thanks.

-- 
Dmitry

  reply	other threads:[~2023-12-19  1:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 21:47 [PATCH v2 0/4] Add polling support for DA9063 onkey driver Biju Das
2023-12-13 21:48 ` [PATCH v2 1/4] Input: da9063 - Simplify obtaining OF match data Biju Das
2023-12-19  1:48   ` Dmitry Torokhov
2023-12-13 21:48 ` [PATCH v2 2/4] Input: da9063 - Drop redundant prints in probe() Biju Das
2023-12-19  1:50   ` Dmitry Torokhov
2023-12-13 21:48 ` [PATCH v2 3/4] Input: da9063 - Use dev_err_probe() Biju Das
2023-12-19  1:50   ` Dmitry Torokhov
2023-12-13 21:48 ` [PATCH v2 4/4] Input: da9063 - Add polling support Biju Das
2023-12-19  1:52   ` Dmitry Torokhov [this message]
2024-01-25 11:52     ` Biju Das

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=ZYD3cvHBHMZoACnQ@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=biju.das.au@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=support.opensource@diasemi.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.