WSL2-Linux-Kernel/drivers/platform/surface
Maximilian Luz 44acfc22c7 platform/surface: aggregator: Fix initialization order when compiling as builtin module
When building the Surface Aggregator Module (SAM) core, registry, and
other SAM client drivers as builtin modules (=y), proper initialization
order is not guaranteed. Due to this, client driver registration
(triggered by device registration in the registry) races against bus
initialization in the core.

If any attempt is made at registering the device driver before the bus
has been initialized (i.e. if bus initialization fails this race) driver
registration will fail with a message similar to:

    Driver surface_battery was unable to register with bus_type surface_aggregator because the bus was not initialized

Switch from module_init() to subsys_initcall() to resolve this issue.
Note that the serdev subsystem uses postcore_initcall() so we are still
able to safely register the serdev device driver for the core.

Fixes: c167b9c7e3 ("platform/surface: Add Surface Aggregator subsystem")
Reported-by: Blaž Hrastnik <blaz@mxxn.io>
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20220429195738.535751-1-luzmaximilian@gmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2022-05-06 13:05:57 +02:00
..
aggregator platform/surface: aggregator: Fix initialization order when compiling as builtin module 2022-05-06 13:05:57 +02:00
Kconfig platform/surface: Remove Surface 3 Button driver 2022-03-02 12:33:00 +01:00
Makefile platform/surface: Remove Surface 3 Button driver 2022-03-02 12:33:00 +01:00
surface3-wmi.c platform/surface: surface3-wmi: Simplify resource management 2022-02-03 11:56:04 +01:00
surface3_power.c surface: surface3_power: Fix battery readings on batteries without a serial number 2022-03-02 11:42:36 +01:00
surface_acpi_notify.c platform/surface: Replace acpi_bus_get_device() 2022-02-03 11:56:01 +01:00
surface_aggregator_cdev.c platform/surface: aggregator_cdev: Add lockdep support 2021-06-16 17:47:53 +02:00
surface_aggregator_registry.c platform/surface: aggregator_registry: Rename device registration function 2021-11-16 10:56:54 +01:00
surface_dtx.c platform/surface: dtx: Add missing mutex_destroy() call in failure path 2021-06-16 17:47:52 +02:00
surface_gpe.c platform/surface: gpe: Add support for Surface Pro 8 2022-05-06 13:05:57 +02:00
surface_hotplug.c platform/surface: Add Surface Hot-Plug driver 2021-02-08 16:59:21 +01:00
surface_platform_profile.c platform/surface: aggregator: Make SSAM_DEFINE_SYNC_REQUEST_x define static functions 2021-03-08 11:33:28 +01:00
surfacepro3_button.c platform: x86: ACPI: Get rid of ACPICA message printing 2021-03-08 11:33:39 +01:00