driver-core: add test module for asynchronous probing
PATCH 1/1 driver-core: add test module for asynchronous probing
From: Dmitry Torokhov <[email protected]>
This test module tries to test asynchronous driver probing by having a driver that sleeps for an extended period of time (5 secs) in its probe() method. It measures the time needed to register this driver (with device already registered) and a new device (with driver already registered). The module will fail to load if the time spent in register call is more than half the probing sleep time.
As a sanity check the driver will then try to synchronously register driver and device and fail if registration takes less than half of the probing sleep time.
Signed-off-by Dmitry Torokhov <[email protected]>
Reviewed-by Olof Johansson <[email protected]>
Signed-off-by Guenter Roeck <[email protected]>
Signed-off-by Thierry Escande <[email protected]>
--- drivers/base/Kconfig | 2 + drivers/base/Makefile | 2 + drivers/base/test/Kconfig | 9 ++ drivers/base/test/Makefile | 1 + drivers/base/test/test_async_driver_probe.c | 171 ++++++++++++++++++++++++++++ 5 files changed, 185 insertions(+) create mode 100644 drivers/base/test/Kconfig create mode 100644 drivers/base/test/Makefile create mode 100644 drivers/base/test/test_async_driver_probe.c
drivers/base/Kconfig +2 -0
@@ -212,6 +212,8 @@ config DEBUG_DEVRES If you are unsure about this, Say N here. +source "drivers/base/test/Kconfig" + config SYS_HYPERVISOR bool default n
drivers/base/Makefile +2 -0
@@ -24,5 +24,7 @@ obj-$(CONFIG_PINCTRL) += pinctrl.o obj-$(CONFIG_DEV_COREDUMP) += devcoredump.o obj-$(CONFIG_GENERIC_MSI_IRQ_DOMAIN) += platform-msi.o +obj-y += test/ + ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
drivers/base/test/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +config TEST_ASYNC_DRIVER_PROBE + tristate "Build kernel module to test asynchronous driver probing" + depends on m + help + Enabling this option produces a kernel module that allows + testing asynchronous driver probing by the device core. + The module name will be test_async_driver_probe.ko + + If unsure say N.
drivers/base/test/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_TEST_ASYNC_DRIVER_PROBE) += test_async_driver_probe.o
drivers/base/test/test_async_driver_probe.c new file +171 -0
171 lines not on this page · raw message
Signature · 1 line
2.7.4