linux/drivers/input/serio
Hans de Goede b1884583fc Input: i8042 - allow insmod to succeed on devices without an i8042 controller
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>
2020-10-26 20:56:28 -07:00
..
altera_ps2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ambakmi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ams_delta_serio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
apbps2.c Input: apbps2 - add __iomem to register struct 2019-12-19 13:41:54 -08:00
arc_ps2.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
ct82c710.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
gscps2.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
hil_mlc.c Input: hil_mlc - convert timeval to jiffies 2018-01-01 21:39:12 -08:00
hp_sdc_mlc.c Input: hil_mlc - convert timeval to jiffies 2018-01-01 21:39:12 -08:00
hp_sdc.c parisc: Fix HP SDC hpa address output 2018-12-10 07:48:07 +01:00
hyperv-keyboard.c Input: hyperv-keyboard: Add the support of hibernation 2020-01-25 16:52:11 -05:00
i8042-io.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
i8042-ip22io.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
i8042-jazzio.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
i8042-ppcio.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
i8042-snirm.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
i8042-sparcio.h Input: i8042 - rework DT node name comparisons 2019-02-18 12:11:04 -08:00
i8042-unicore32io.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
i8042-x86ia64io.h Input: i8042 - add nopnp quirk for Acer Aspire 5 A515 2020-09-28 16:23:42 -07:00
i8042.c Input: i8042 - allow insmod to succeed on devices without an i8042 controller 2020-10-26 20:56:28 -07:00
i8042.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ioc3kbd.c Input: add IOC3 serio driver 2020-01-22 10:05:53 -08:00
Kconfig Input: add IOC3 serio driver 2020-01-22 10:05:53 -08:00
libps2.c Input: Use fallthrough pseudo-keyword 2020-07-07 11:25:54 -07:00
maceps2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
Makefile Input: add IOC3 serio driver 2020-01-22 10:05:53 -08:00
olpc_apsp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
parkbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pcips2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 178 2019-05-30 11:29:19 -07:00
ps2-gpio.c Input: remove dev_err() usage after platform_get_irq() 2019-08-14 10:49:01 -07:00
ps2mult.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
q40kbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
rpckbd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
sa1111ps2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 178 2019-05-30 11:29:19 -07:00
serio_raw.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
serio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
serport.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
sun4i-ps2.c Input: sun4i-ps2 - fix handling of platform_get_irq() error 2020-09-16 10:42:16 -07:00
userio.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
xilinx_ps2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 151 2019-05-30 11:26:28 -07:00