linux/drivers/input
Hans de Goede 94b6e6ee17 Input: i8042 - allow insmod to succeed on devices without an i8042 controller
[ Upstream commit b1884583fc ]

The i8042 module exports several symbols which may be used by other
modules.

Before this commit it would refuse to load (when built as a module itself)
on systems without an i8042 controller.

This is a problem specifically for the asus-nb-wmi module. Many Asus
laptops support the Asus WMI interface. Some of them have an i8042
controller and need to use i8042_install_filter() to filter some kbd
events. Other models do not have an i8042 controller (e.g. they use an
USB attached kbd).

Before this commit the asus-nb-wmi driver could not be loaded on Asus
models without an i8042 controller, when the i8042 code was built as
a module (as Arch Linux does) because the module_init function of the
i8042 module would fail with -ENODEV and thus the i8042_install_filter
symbol could not be loaded.

This commit fixes this by exiting from module_init with a return code
of 0 if no controller is found.  It also adds a i8042_present bool to
make the module_exit function a no-op in this case and also adds a
check for i8042_present to the exported i8042_command function.

The latter i8042_present check should not really be necessary because
when builtin that function can already be used on systems without
an i8042 controller, but better safe then sorry.

Reported-and-tested-by: Marius Iacob <themariusus@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201008112628.3979-2-hdegoede@redhat.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-12-02 08:48:08 +01:00
..
gameport
joystick Input: xpad - add custom init packet for Xbox One S controllers 2020-06-03 08:19:32 +02:00
keyboard Input: sunkbd - avoid use-after-free in teardown paths 2020-11-22 10:02:26 +01:00
misc Input: adxl34x - clean up a data type in adxl34x_probe() 2020-11-24 13:27:21 +01:00
mouse Input: trackpoint - enable Synaptics trackpoints 2020-10-07 08:00:08 +02:00
rmi4 Input: synaptics-rmi4 - fix error return code in rmi_driver_probe() 2020-06-03 08:19:33 +02:00
serio Input: i8042 - allow insmod to succeed on devices without an i8042 controller 2020-12-02 08:48:08 +01:00
tablet Input: pegasus_notetaker - fix endpoint sanity check 2020-01-29 16:43:20 +01:00
touchscreen Input: resistive-adc-touch - fix kconfig dependency on IIO_BUFFER 2020-11-24 13:27:21 +01:00
apm-power.c
evbug.c
evdev.c Input: evdev - call input_flush_device() on release(), not flush() 2020-06-03 08:19:31 +02:00
ff-core.c
ff-memless.c Input: ff-memless - kill timer in destroy() 2019-11-20 18:45:14 +01:00
input-compat.c
input-compat.h
input-leds.c
input-mt.c
input-polldev.c
input.c Input: add safety guards to input_set_keycode() 2020-01-14 20:07:01 +01:00
joydev.c
Kconfig
Makefile
matrix-keymap.c
mousedev.c
sparse-keymap.c