WSL2-Linux-Kernel/drivers/platform/surface
Maximilian Luz 50bf941137 platform/surface: aggregator: Fix initialization order when compiling as builtin module
[ Upstream commit 44acfc22c7 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-05-18 10:26:48 +02:00
..
aggregator platform/surface: aggregator: Fix initialization order when compiling as builtin module 2022-05-18 10:26:48 +02:00
Kconfig platform/surface: dtx: Add support for native SSAM devices 2021-03-17 18:39:38 +01:00
Makefile platform/surface: Add DTX driver 2021-03-17 18:39:38 +01:00
surface3-wmi.c platform/surface: surface3-wmi: Fix variable 'status' set but not used compiler warning 2021-02-04 13:23:55 +01:00
surface3_button.c platform/surface: Move Surface 3 Button driver to platform/surface 2020-10-27 12:51:24 +01:00
surface3_power.c surface: surface3_power: Fix battery readings on batteries without a serial number 2022-03-02 11:47:59 +01:00
surface_acpi_notify.c ACPI: scan: Extend acpi_walk_dep_device_list() 2021-06-07 16:45:05 +02: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: Add support for Surface Laptop Studio 2021-11-18 19:15:59 +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: surface_gpe: Fix non-PM_SLEEP build warnings 2021-01-04 15:54:27 +01: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