Skip to content

Commit 44acfc2

Browse files
qzedjwrdegoede
authored andcommitted
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: c167b9c ("platform/surface: Add Surface Aggregator subsystem") Reported-by: Blaž Hrastnik <[email protected]> Signed-off-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent ed13d4a commit 44acfc2

File tree

1 file changed

+1
-1
lines changed
  • drivers/platform/surface/aggregator

1 file changed

+1
-1
lines changed

drivers/platform/surface/aggregator/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ static int __init ssam_core_init(void)
817817
err_bus:
818818
return status;
819819
}
820-
module_init(ssam_core_init);
820+
subsys_initcall(ssam_core_init);
821821

822822
static void __exit ssam_core_exit(void)
823823
{

0 commit comments

Comments
 (0)