Re: [PATCH] Input: add IOC3 serio driver

From: Dmitry Torokhov
Date: Wed Jan 22 2020 - 01:57:50 EST


Hi Thomas,

On Wed, Jan 15, 2020 at 01:59:50PM +0100, Thomas Bogendoerfer wrote:
> +
> + platform_set_drvdata(pdev, d);
> + serio_register_port(d->kbd);
> + serio_register_port(d->aux);
> +
> + ret = request_irq(irq, ioc3kbd_intr, IRQF_SHARED, "ioc3-kbd", d);

I just realized something - serio ports are registered asynchronously,
and therefore may not be ready when you request IRQ which may fire
immediately. To solve this issue serio core allows to specify start()
method that is called after serio port has been registered. In this
method you can set "exist" flag associated with either kbd or aux port,
and check these flags in your interrupt routine before deciding whether
you can forward the received data to appropriate port via
serio_interrupt().

Please see i8042_start() for example of use.

Thanks.

--
Dmitry