From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF0BDC43461 for ; Mon, 7 Sep 2020 16:04:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5FCBC2080A for ; Mon, 7 Sep 2020 16:04:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Odb8MLHD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FCBC2080A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=m8ARN1G6K1nxhPwliROUofwidUSOSnR1Tz9gyDEOQ9M=; b=Odb8MLHDSvNdhdnpH4iWpkWSK v9KF5NuR3s2ZdfN6mZaS2EhIfvlNqfdBIVIywJS4ZfLUXKNGliaTn1AI3+Hj7MdRn5dbyJetaDES2 Kd13NvcvrfnSoS8rwP18d8GNEjBRKo+vs0gyvr5qSr+cRZhqKlKYMuTblSQgLrG31rl0j2Ujq0+uV hN5M0QTmErgJoYQ30p2JP0DUsqZDl1FjvIPVgIrmmrLhqBb3fguJxLoyNjY7zdc9/l5BCPrdlabLJ mq5fOlMtRIEpUoiAog8dQquZim0mHuttxSkaDw2jx/Y2Scyhgzoumy/O5HYb5liGORcayE3Yl1fB+ nf7nZwRBg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFJcP-00018I-Ad; Mon, 07 Sep 2020 16:03:45 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFJcM-00017Y-HJ for linux-arm-kernel@lists.infradead.org; Mon, 07 Sep 2020 16:03:43 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DE64131B; Mon, 7 Sep 2020 09:03:40 -0700 (PDT) Received: from bogus (unknown [10.57.10.112]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 376F23F73C; Mon, 7 Sep 2020 09:03:39 -0700 (PDT) Date: Mon, 7 Sep 2020 17:03:33 +0100 From: Sudeep Holla To: Cristian Marussi Subject: Re: [PATCH 0/3] firmware: arm_scmi: Enable building SCMI as module Message-ID: <20200907160333.GA3656@bogus> References: <20200907112920.34275-1-sudeep.holla@arm.com> <20200907152513.GA28463@e119603-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200907152513.GA28463@e119603-lin.cambridge.arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200907_120342_635085_7D043422 X-CRM114-Status: GOOD ( 22.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mikhail Golubev , Igor Skalkin , Peter Hilber , Anton Yakovlev , Sudeep Holla , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 07, 2020 at 04:25:13PM +0100, Cristian Marussi wrote: > Hi Sudeep, > > On Mon, Sep 07, 2020 at 12:29:17PM +0100, Sudeep Holla wrote: > > Hi, > > > > Though it was initially developed as module, so some reason(I can't > > recollect why apart from some structuring arounf the way bus and > > protocols were initialised), it was merged as a built-in only driver. > > > > Now, there is a need to build this as modules. This is mainly needed > > by virtio transport. This also aligns well with GKI modularisation > > efforts. > > > > This works for me as a module, but it gave me issues when compiled builtin > since the some SCMI drivers (hwmon, cpufreq) look for the SCMI bus too early > when both them and the core are compiled as builtins. > Thanks for testing. > [ 2.226029] rtc-efi rtc-efi.0: setting system clock to 2020-09-07T10:51:36 UTC (1599475896) > [ 2.235091] rtc-pl031 1c170000.rtc: registered as rtc1 > [ 2.240767] i2c /dev entries driver > [ 2.246522] Driver 'scmi-hwmon' was unable to register with bus_type 'scmi_protocol' because the bus was not initialized. > [ 2.259037] sp805-wdt 1c0f0000.wdt: registration successful > [ 2.265464] Driver 'scmi-cpufreq' was unable to register with bus_type 'scmi_protocol' because the bus was not initialized. > [ 2.278905] mmci-pl18x 1c050000.mmci: mmc0: PL180 manf 41 rev0 at 0x1c050000 irq 8,0 (pio) > > This dirty trick below solves for me though the builtin issue (and still runs > fine when modularized): > In fact the bus init was subsys previously, so make sense to move that too. I don't think it is a hack. Since scmi_bus needs to be available for all scmi_drivers to be registered, it looks valid for me. > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > index 2a1396b74fa5..b69bb174344d 100644 > --- a/drivers/firmware/arm_scmi/driver.c > +++ b/drivers/firmware/arm_scmi/driver.c > @@ -939,7 +939,11 @@ static int __init scmi_driver_init(void) > > return platform_driver_register(&scmi_driver); > } > +#ifdef MODULE > module_init(scmi_driver_init); > +#else > +subsys_initcall(scmi_driver_init); > +#endif > Indeed, just subsys_initcall will suffice. It is module_init when built as module, so no need for us to define that explicitly. -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel