Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3296768iob; Mon, 16 May 2022 18:31:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+GDoiMN4St8EjoqOH4XQLXfP7KPBvs3vRhSOBSKmHWL0UKaaWENhapEgIplxqgPCjdPLA X-Received: by 2002:a17:90a:3b07:b0:1de:b43f:f976 with SMTP id d7-20020a17090a3b0700b001deb43ff976mr34310772pjc.192.1652751061164; Mon, 16 May 2022 18:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652751061; cv=none; d=google.com; s=arc-20160816; b=lOHxwpcSRg78cZnvOwSm+vG5YJw+fqVrSvTZ+GZdkpdegg0Eig2QlhuGTtbjyl5wcY T+RvPxFMhBCGzwe8lJpRZ4BNTnUEOBNhWZb6TG2m2iYrHanLzRFqPhxcz2k8fJStjgi1 cG+9nhi6vCG7Kg6pZPTADS9sss8x9hoQBCmUzlQL9CH0vuVpvu36Xnncqqdp0IzX7/WN TCFzNCjOjx3SRUmGG6Qbk9+4saVPpdgJK2Q2Ne85Oi3nR2/WmgKJQq2YHP4MhQAbsMCa /u5Yl8DIksjVzv4N8ERub7UehA4rF6KCCFRf4iuGPteyk1GqKWFCKHlLIQWeOwWBDhiV dLig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qkJ+yXTITH4g9uLfNGGjgSW4AdAupvi0lFnAI73hQVA=; b=DEFGVLIaak7/KFQxI3sQtmFFvBidjeVgXwm+bf0OdM3BUXe4ZbStVevQVJUUiCJ0Jj n8ZwUyda9KFIUg2HdhAGbUlZ82p463QkxN/fuq6oEg+CcqvU9OZHSRjfF04Bg7IAb18K GV+5xMk1RET1UpK5everiYlGPQ7hdAthMBxAJGZagZHeZ270Qqof3KYa6aGxG2Va2tWL kynVZo8/JOChzpdjn6fnr8CcaK6WqdsLJ+ov5/KU8p+wbh0sp6irY3dd2yiXJvvTTH4K n+x9WbFOaN0Knw5bLVUb5ohBPmKaFAjTZiQVwYIew6Fgj47bnYeYAlUgVO08vpcCGKHG rS7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tpXxfd5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a170902788600b0015a46b52f92si13241737pll.243.2022.05.16.18.30.47; Mon, 16 May 2022 18:31:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tpXxfd5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233916AbiEPUNs (ORCPT + 99 others); Mon, 16 May 2022 16:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348133AbiEPT60 (ORCPT ); Mon, 16 May 2022 15:58:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EBE949250; Mon, 16 May 2022 12:50:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4D745B81612; Mon, 16 May 2022 19:50:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90B49C385AA; Mon, 16 May 2022 19:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652730610; bh=E6IEgSzYAeio9Qxj1EaJrujKdyR+K6hkdC/qFq7fLfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tpXxfd5mBgi0D7dwb7R6DKO8VatY/KecuPsBaYcw4zt55w4NgQ+RCQR8s/TFvNvAP B3qC+5P79njWpKe6qJQix1PD7Fnbj9GuGJkegrUpDIzp/7tCsyLoH/lfzjLwrjgaN+ u4U63OWwjgacB52l10p6bhp9N03mn94HMZXTj7fA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Bla=C5=BE=20Hrastnik?= , Maximilian Luz , Hans de Goede , Sasha Levin Subject: [PATCH 5.15 013/102] platform/surface: aggregator: Fix initialization order when compiling as builtin module Date: Mon, 16 May 2022 21:35:47 +0200 Message-Id: <20220516193624.377408906@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516193623.989270214@linuxfoundation.org> References: <20220516193623.989270214@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maximilian Luz [ Upstream commit 44acfc22c7d055d9c4f8f0974ee28422405b971a ] 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: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem") Reported-by: Blaž Hrastnik Signed-off-by: Maximilian Luz Link: https://lore.kernel.org/r/20220429195738.535751-1-luzmaximilian@gmail.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- drivers/platform/surface/aggregator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/surface/aggregator/core.c b/drivers/platform/surface/aggregator/core.c index c61bbeeec2df..54f86df77a37 100644 --- a/drivers/platform/surface/aggregator/core.c +++ b/drivers/platform/surface/aggregator/core.c @@ -816,7 +816,7 @@ static int __init ssam_core_init(void) err_bus: return status; } -module_init(ssam_core_init); +subsys_initcall(ssam_core_init); static void __exit ssam_core_exit(void) { -- 2.35.1