Received: by 2002:ac0:c50a:0:0:0:0:0 with SMTP id y10csp1375025imi; Fri, 1 Jul 2022 08:30:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tbT8/Or+zmzdfTZ+1wTFwgB3BJtpO3GxpP9H9JhDkg/k3n+E6GsedJxJ2PV57KKp/sE3Tt X-Received: by 2002:a17:907:8a25:b0:726:c9f2:2f5e with SMTP id sc37-20020a1709078a2500b00726c9f22f5emr14584047ejc.286.1656689406352; Fri, 01 Jul 2022 08:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656689406; cv=none; d=google.com; s=arc-20160816; b=p8TdY0bsO3pgq1iCCWwVlmH/P9KQ7zcLUSRgzxvdcYycl+eBjtBEKqaco80Bo3tEeJ QQEqcaUfaSv9oqyInwoOMozk2KqGc8eUnLaTtISEwLnQ7BN264nJ+oF26XPEmP3fq4Pe XRjLm9iseAyqj+Mujd27gkn3H/V0MKL1ZoSt9a/+xHYd1nxtnelj0uh5B3CbyoKTHl04 1kSRdAEu77pANplmLCwp9C6xDlG/5ybJ28mo9abMpGAlYqkQGJDesWx/MZmTTBzp2vMX Nv0tb70IAUzevEN2P72ffPk5N1TptbvWlcuFrKe0TyV0FVovE2rFMJVErQfSpgmiKVnZ vQDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=SE44W34SajwMozwW5SPe8i8mX3UbCpkOf4qi2sq/0lU=; b=TYep90J7BpNe1l+0hfvFcctGzv2jBDpzJUs5xrLD5FukH45vJOxzf/sLfmnWc6dON6 S6PXksmomPUbadfWvxH6n9OPva5JfbJQcKUSAyeyHtJwwMECrp/rhSeSYXnEvuw1fcZf w3wlRjvMNMumDm+muzcYg4j9OI6gZtr5hW5TfIBFL2EbA/89Q23koHXZQve7HbQBxevJ i3qSVPd1EaaYQiVMIPGRHNsp7sU3RUMvOSgLGqEFL+mcjSLAnxYh2RUTAZmcYXT2ROVW Hv5WPIBLqNPRNobP0sqtRvkMFqlxwwyACIvRiVhbU8XtBZiunaBnXQe5S5FT6F0tKhYh Fxsg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a170906068b00b006f3b763040asi17415903ejb.141.2022.07.01.08.29.40; Fri, 01 Jul 2022 08:30:06 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231485AbiGAPSg (ORCPT + 99 others); Fri, 1 Jul 2022 11:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230334AbiGAPSe (ORCPT ); Fri, 1 Jul 2022 11:18:34 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BC9542AC5C for ; Fri, 1 Jul 2022 08:18:33 -0700 (PDT) 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 CCA9F113E; Fri, 1 Jul 2022 08:18:33 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AC4CA3F66F; Fri, 1 Jul 2022 08:18:31 -0700 (PDT) Date: Fri, 1 Jul 2022 16:18:29 +0100 From: Sudeep Holla To: Cristian Marussi Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.quinlan@broadcom.com, Jonathan.Cameron@huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, daniel.lezcano@linaro.org, tarek.el-sherbiny@arm.com, adrian.slatineanu@arm.com, souvik.chakravarty@arm.com, wleavitt@marvell.com, wbartczak@marvell.com, Sudeep Holla Subject: Re: [PATCH v3 8/9] firmware: arm_scmi: Add scmi_driver optional setup/teardown callbacks Message-ID: <20220701151829.j2blytsgma5so6ox@bogus> References: <20220627123038.1427067-1-cristian.marussi@arm.com> <20220627123038.1427067-9-cristian.marussi@arm.com> <20220701140946.uar5ohadyjksf2ka@bogus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,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 On Fri, Jul 01, 2022 at 04:09:05PM +0100, Cristian Marussi wrote: > On Fri, Jul 01, 2022 at 03:09:46PM +0100, Sudeep Holla wrote: > > On Mon, Jun 27, 2022 at 01:30:37PM +0100, Cristian Marussi wrote: > > > Add optional .setup and .teardown methods to the scmi_driver descriptor: > > > such callbacks, if provided, will be called by the SCIM core at driver > > > registration time, so that, an SCMI driver, registered as usual with the > > > module_scmi_driver() helper macro, can provide custom callbacks to be > > > run once for all at module load/unload time to perform specific setup > > > or teardown operations before/after .probe and .remove steps. > > > > > > > What can't the driver call this setup/teardown on its own before/after > > calling scmi_driver_register/unregister ? > > > > > Based on the usage in 9/9, I guess it is mainly to use the > > module_scmi_driver ? If so, I would avoid using that or have another > > macro to manage this setup/teardown(once there are multiple users for that). > > IMO, it doesn't make sense to add callbacks to do things that are outside > > the scope of scmi drivers. No ? > > > > This is exactly what I was doing in fact :D at first ... defining a normal > init/exit from where I called what I needed at first and then ivoke the > scmi_driver_register()...so bypassing/not using the module_scmi-driver macro > indeed...then I realized I needed something similar also for the SCMI Test > driver, so I tried to unify; in both cases indeed the required ops to be > done before the scmi_driver_register are NOT scmi related things. > > So I can drop this if you prefer and use bare module_init/exit that > calls scmi_driver_register() after having setup what needed for the > specific driver initialization (before probe)...I was not really > convinced it was worth this level of unification. > We can add macro for that too if there is another user for this. i.e. if and when we merge the test code using something similar, we can wrap them in a macro module_scmi_driver_setup_teardown(driver, setup, teardown) and simplify things for the users. -- Regards, Sudeep