Re: [PATCH v2 4/4] Input: da9063 - Add polling support

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

 



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




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux