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=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 3BB92C433E0 for ; Mon, 3 Aug 2020 17:15:15 +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 DAAAC20A8B for ; Mon, 3 Aug 2020 17:15:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yOXY4IwI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="H1YKo3uE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAAAC20A8B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VQKsrmSHFwZdp5ZUrNWwtWH/pTivUJHYpBu1+UTisNI=; b=yOXY4IwI24/dy5Et7glnsRRh6 JRV17gVpE3CCDm9ibCjOc7L+v2p9q6VFf5yh2mbgUTcwyEIDwrgfWgBt+DK9fTB5yTpVZ5Dh+RU8W HscX5svmlWB+clDQ7eFPRW9npAGCng3Ns6ff9b7k3t8wKoY/dilCoeEnGf7EMayV25XBev9ASUnX6 Mdn4vtbZ7wNQjKy+CrqzQ7Pd44VUIsBidMV04vrU2tc7Z2RLLPq+GdRs/Jho6yT+awFl80xIjlOF8 eFhflUYc2lUBRnGpxx2hjiXhf89njQwT48h6HXMi/QCLHgDsl8n3jfuoBZD6JpqhO0vRZEVEt9g4p z8TcPJeLA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2e1D-0006MK-A5; Mon, 03 Aug 2020 17:13:00 +0000 Received: from mail-ej1-x641.google.com ([2a00:1450:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2e0R-0005to-63 for linux-arm-kernel@lists.infradead.org; Mon, 03 Aug 2020 17:12:16 +0000 Received: by mail-ej1-x641.google.com with SMTP id c16so19039937ejx.12 for ; Mon, 03 Aug 2020 10:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8gQQOZScxAK6XkeVRxcpgwj3MkM+b+Wj/7E6NJpMKcw=; b=H1YKo3uEiJfkWpYiU32TKNGYT9Xzaq7CMaMG7SnKe29g4bznQw3/G+yaEQRlMrPHgq 7i17WnGwuvDpj74KrNYNlu0KiYpHOmzZ8vQCljzNxsqnZVL0AK07gzRWjy9h2U58sBoA YB0cduyE2taAQhiM6SYwQ2hA8i8UBiDqb5+jeHM1nbBIrjWJf8veFXpV2E97PNMPvj76 CBUaaL2/xNLCoQ464vux4XNsbWYjFIdXlCLzV3QGAIhav4Uqf+N9+xp5Gas4WgGAnAFM F5lg3uhrFpJAvD0zLSdReHXfi7hCtAtNx6vULBJ0n97WZ0k3qJIF4Ii0rTU7x+E/v6Y5 1SJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8gQQOZScxAK6XkeVRxcpgwj3MkM+b+Wj/7E6NJpMKcw=; b=CVinaPpPhrJE449o6fxM9S63Eoox4asLuxuzhoHwAeL3bkNr5Fi+PjkgGZBBBr4irJ m2hhCWePas1YDz/HlcwVrZE4+UraFQQBdsstRNbpKwYx/v5VX/JzseSsTEwtDg/34dKM Mtbl5afNY1LL3YsX5MGJ9O+ggtvujkyNcsgmKUAYcdgsCwMF7NZbrRQgDynUpvMzYxL4 O3h8tP8YwTM23ugjSg2NLfDjpid0tM/WMC0h+TbKlvFBLxYtMp0FRbmANBPtbPErdZTy r4TQUc6tUswIocv93VSjz+OCsmwuun/QLeYRWCqzlbQ0vjhHJQ+pLrdKs9BFa/3CvtZj kxow== X-Gm-Message-State: AOAM5320SQRJqOssOXs1Df1V+AtG45vYtyA+w5rJuSGO5UlF5IDtYQ2n 6Fc8bSbNa7HcNGA2tcPZob9C2/T6XTkpHBkvw7P/WA== X-Google-Smtp-Source: ABdhPJwk3WOSODUpFBpyqySa9zTwysIfTidaIgcSVdcZxrj6N0ktWRIv2p9hVi+km0JXaU2juvVhi5gIi8zXmJMEYbs= X-Received: by 2002:a17:906:8748:: with SMTP id hj8mr18074060ejb.477.1596474729942; Mon, 03 Aug 2020 10:12:09 -0700 (PDT) MIME-Version: 1.0 References: <20200731064012.8076-1-tingwei@codeaurora.org> <20200731064012.8076-23-tingwei@codeaurora.org> In-Reply-To: <20200731064012.8076-23-tingwei@codeaurora.org> From: Mike Leach Date: Mon, 3 Aug 2020 18:11:59 +0100 Message-ID: Subject: Re: [PATCH v6 22/25] coresight: cti: allow cti to be built as a module To: Tingwei Zhang X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200803_131211_513177_39DDBDD9 X-CRM114-Status: GOOD ( 29.64 ) 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: tsoni@codeaurora.org, Sai Prakash Ranjan , Kim Phillips , Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Greg Kroah-Hartman , Coresight ML , Randy Dunlap , Mian Yousaf Kaukab , Russell King , Mao Jinlong , Leo Yan , linux-arm-kernel 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 Fri, 31 Jul 2020 at 07:42, Tingwei Zhang wrote: > > Allow to build coresight-cti as a module, for ease of development. > > - Kconfig becomes a tristate, to allow =m > - append -core to source file name to allow module to > be called coresight-cti by the Makefile > - add an cti_remove function, for module unload > - move cti_remove_conn_xrefs to cti_remove > - add a MODULE_DEVICE_TABLE for autoloading on boot > > Signed-off-by: Tingwei Zhang > --- > drivers/hwtracing/coresight/Kconfig | 5 ++++- > drivers/hwtracing/coresight/Makefile | 4 ++-- > .../{coresight-cti.c => coresight-cti-core.c} | 19 ++++++++++++++++++- > .../hwtracing/coresight/coresight-platform.c | 1 + > drivers/hwtracing/coresight/coresight.c | 1 + > 5 files changed, 26 insertions(+), 4 deletions(-) > rename drivers/hwtracing/coresight/{coresight-cti.c => coresight-cti-core.c} (98%) > > diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig > index f31778dd0b5d..b04aae2ceecc 100644 > --- a/drivers/hwtracing/coresight/Kconfig > +++ b/drivers/hwtracing/coresight/Kconfig > @@ -136,7 +136,7 @@ config CORESIGHT_CPU_DEBUG > module will be called coresight-cpu-debug. > > config CORESIGHT_CTI > - bool "CoreSight Cross Trigger Interface (CTI) driver" > + tristate "CoreSight Cross Trigger Interface (CTI) driver" > depends on ARM || ARM64 > help > This driver provides support for CoreSight CTI and CTM components. > @@ -147,6 +147,9 @@ config CORESIGHT_CTI > halt compared to disabling sources and sinks normally in driver > software. > > + To compile this driver as a module, choose M here: the > + module will be called coresight-cti. > + > config CORESIGHT_CTI_INTEGRATION_REGS > bool "Access CTI CoreSight Integration Registers" > depends on CORESIGHT_CTI > diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile > index f2a568b969c4..0359d5a1588f 100644 > --- a/drivers/hwtracing/coresight/Makefile > +++ b/drivers/hwtracing/coresight/Makefile > @@ -19,6 +19,6 @@ coresight-etm4x-y := coresight-etm4x-core.o coresight-etm4x-sysfs.o > obj-$(CONFIG_CORESIGHT_STM) += coresight-stm.o > obj-$(CONFIG_CORESIGHT_CPU_DEBUG) += coresight-cpu-debug.o > obj-$(CONFIG_CORESIGHT_CATU) += coresight-catu.o > -obj-$(CONFIG_CORESIGHT_CTI) += coresight-cti.o \ > - coresight-cti-platform.o \ > +obj-$(CONFIG_CORESIGHT_CTI) += coresight-cti.o > +coresight-cti-y := coresight-cti-core.o coresight-cti-platform.o \ > coresight-cti-sysfs.o > diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti-core.c > similarity index 98% > rename from drivers/hwtracing/coresight/coresight-cti.c > rename to drivers/hwtracing/coresight/coresight-cti-core.c > index 6bb06c5715db..ca31da6cf1c0 100644 > --- a/drivers/hwtracing/coresight/coresight-cti.c > +++ b/drivers/hwtracing/coresight/coresight-cti-core.c > @@ -838,7 +838,6 @@ static void cti_device_release(struct device *dev) > struct cti_drvdata *ect_item, *ect_tmp; > > mutex_lock(&ect_mutex); > - cti_remove_conn_xrefs(drvdata); > cti_pm_release(drvdata); > > /* remove from the list */ > @@ -853,6 +852,18 @@ static void cti_device_release(struct device *dev) > if (drvdata->csdev_release) > drvdata->csdev_release(dev); > } > +static int __exit cti_remove(struct amba_device *adev) > +{ > + struct cti_drvdata *drvdata = dev_get_drvdata(&adev->dev); > + > + mutex_lock(&ect_mutex); > + cti_remove_conn_xrefs(drvdata); > + mutex_unlock(&ect_mutex); > + > + coresight_unregister(drvdata->csdev); > + > + return 0; > +} > > static int cti_probe(struct amba_device *adev, const struct amba_id *id) > { > @@ -972,6 +983,7 @@ static const struct amba_id cti_ids[] = { > CS_AMBA_UCI_ID(0x000bb9ed, uci_id_cti), /* Coresight CTI (SoC 600) */ > { 0, 0}, > }; > +MODULE_DEVICE_TABLE(amba, cti_ids); > > static struct amba_driver cti_driver = { > .drv = { > @@ -980,6 +992,7 @@ static struct amba_driver cti_driver = { > .suppress_bind_attrs = true, > }, > .probe = cti_probe, > + .remove = cti_remove, > .id_table = cti_ids, > }; > > @@ -1002,3 +1015,7 @@ static void __exit cti_exit(void) > > module_init(cti_init); > module_exit(cti_exit); > + > +MODULE_AUTHOR("Mike Leach "); > +MODULE_DESCRIPTION("Arm CoreSight CTI Driver"); > +MODULE_LICENSE("GPL v2"); > diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c > index bfd44231d7ad..635d55c1d580 100644 > --- a/drivers/hwtracing/coresight/coresight-platform.c > +++ b/drivers/hwtracing/coresight/coresight-platform.c > @@ -75,6 +75,7 @@ coresight_find_csdev_by_fwnode(struct fwnode_handle *r_fwnode) > } > return csdev; > } > +EXPORT_SYMBOL_GPL(coresight_find_csdev_by_fwnode); > > #ifdef CONFIG_OF > static inline bool of_coresight_legacy_ep_is_input(struct device_node *ep) > diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c > index 78439b7cd8ba..3b4abdda1f72 100644 > --- a/drivers/hwtracing/coresight/coresight.c > +++ b/drivers/hwtracing/coresight/coresight.c > @@ -289,6 +289,7 @@ void coresight_set_assoc_ectdev_mutex(struct coresight_device *csdev, > csdev->ect_dev = ect_csdev; > mutex_unlock(&coresight_mutex); > } > +EXPORT_SYMBOL_GPL(coresight_set_assoc_ectdev_mutex); > > static int coresight_enable_sink(struct coresight_device *csdev, > u32 mode, void *data) > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > Tested by: Mike Leach -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel