OpenCloudOS-Kernel/drivers/platform/surface/aggregator
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
..
Kconfig platform: surface: Propagate ACPI Dependency 2021-12-07 12:21:01 +01:00
Makefile platform/surface: aggregator: Use y instead of objs in Makefile 2021-08-12 09:26:28 +02:00
bus.c platform/surface: aggregator: Make client device removal more generic 2021-11-16 10:56:54 +01:00
bus.h platform/surface: aggregator: Make client device removal more generic 2021-11-16 10:56:54 +01:00
controller.c platform/surface: aggregator: Drop unnecessary variable initialization 2021-06-16 17:47:54 +02:00
controller.h platform/surface: aggregator: Update copyright 2021-06-16 17:47:53 +02:00
core.c platform/surface: aggregator: Fix initialization order when compiling as builtin module 2022-05-06 13:05:57 +02:00
ssh_msgb.h platform/surface: aggregator: Update copyright 2021-06-16 17:47:53 +02:00
ssh_packet_layer.c platform/surface: aggregator: Use list_move_tail instead of list_del/list_add_tail in ssh_packet_layer.c 2021-06-16 17:47:54 +02:00
ssh_packet_layer.h platform/surface: aggregator: Update copyright 2021-06-16 17:47:53 +02:00
ssh_parser.c platform/surface: aggregator: Update copyright 2021-06-16 17:47:53 +02:00
ssh_parser.h platform/surface: aggregator: Update copyright 2021-06-16 17:47:53 +02:00
ssh_request_layer.c platform/surface: aggregator: Use list_move_tail instead of list_del/list_add_tail in ssh_request_layer.c 2021-06-16 17:47:54 +02:00
ssh_request_layer.h platform/surface: aggregator: Update copyright 2021-06-16 17:47:53 +02:00
trace.h platform/surface: aggregator: Update copyright 2021-06-16 17:47:53 +02:00