Am 16.12.24 um 18:21 schrieb Dmitry Torokhov:
Hi Armin,
On Mon, Dec 16, 2024 at 12:36:28AM +0100, Armin Wolf wrote:
Currently the platform filter cannot access any driver-specific state
which forces drivers installing a i8042 filter to have at least some
kind of global pointer for their filter.
This however might cause issues should such a driver probe multiple
devices. Fix this by allowing callers of i8042_install_filter() to
submit a context pointer which is then passed to the i8042 filter.
Right now i8042 supports only one instance of a filter, so the driver
probing several devices will have to sort out the ownership of the
filter anyways.
Unless you plan on supporting multiple filters I do not see the need of
storing the context in i8042. And if you decide to add support for
multiple filters I would need to better understand the use case.
Thanks.
I am well aware that the i8042 driver currently supports only a single platform filter.
The reason for introducing a context pointer is that otherwise drivers registering a i8042 filter
would need to provide such a global pointer for their filter themself, together with the necessary
locking since those driver can (theoretically) be instantiated multiple times.
With this patch the i8042 driver takes care of that so those driver can finally get rid of global
data structures which will break as soon as the driver is instantiated multiple times.
Additionally this new API will allow us to add support for multiple handlers later should the need
arise.
Thanks,
Armin Wolf