From patchwork Mon Sep 28 16:35:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804107 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 515AE6CB for ; Mon, 28 Sep 2020 16:44:56 +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 02BCF208FE for ; Mon, 28 Sep 2020 16:44: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="Th1jz3s/"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ObBy8vJt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02BCF208FE 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+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gKTtNvOnzS3cqmMB0YzpL7wXdbEFKFmPWjxSoSiq6Nc=; b=Th1jz3s/7gntM3wgrlSBPBvh5 HNdRxs2U7PC5OvJnvgGRnTxsDsCgnoN64qQrFDLJWXWsfmTV1B3UvQR6TJfUGVYXTVuGboDIS0XOt p8N7G8xhzg9oDEfkzpskexrLqhz4pvhowdpb40NmxIUj4hBd6xJdL647sIGUmKEevKksB+2vC9OFC i6pAoidPqkNdkc/oQi9/aPL9uAHKAiZYnsUpY8CI2kcgswqH07KoXWaBpRZRPXiyiNpbWhUDagbf6 B7j16Von32kWfeS8GiEg6v3LaVoafw57wAE+aJPnteZwh014vkmJRo0FHxE8nO77jMS7Wirk082wP NpSjm9Z4g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwEI-0003V3-C7; Mon, 28 Sep 2020 16:42:22 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7n-0000ec-9B for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:47 +0000 Received: by mail-pg1-x541.google.com with SMTP id t14so1308277pgl.10 for ; Mon, 28 Sep 2020 09:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ivbWO62B8/k+HVBL4SFDiAMi/0I8fix8+11SWaId4bY=; b=ObBy8vJtilE1GAR2jjlktnpUQ69kiKhcfz77CJ1CtcnVu2IFeEWVMNAaiqkh+QERYS 11Aj+Bj5Fr582cwGunCQ2YZImInNM3vIZxARd7AU3cwRQxQ1adWFHr5QMiUsDiffpAdo ETINsPdp2Ty5tLUBPlX6b+y9sc8XXTJ4ha/0lb5CWJwj1yG2jt4Nk01M0rCVbzpCpUz7 J6HB5bOvb9Kk+kDEGUGNTEkEuqFhmYIpcAmYBGzCtMYjaSfiioAHOBUuJuZxSQsL4OjZ mUMGFF614RKMy7NBxPlIQzlVYxgEujaRQx2hGf49EbLRbwIP8CuTgj7uuCQW4EepTEkN bu6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ivbWO62B8/k+HVBL4SFDiAMi/0I8fix8+11SWaId4bY=; b=W8g9wFCrTS2Y5b02TaytVaBfTacxEX/h8VFRCQgeCNad+mXjC3KSC4qXEStBXypPIZ oUEFvGueFZWfWlLUpPwSj/wcNFjDWgrlJ6G5BdglH7aUrgxjhF1BX++l8CsirhXUQpDv hrLxNDITOHzeeIACk4Seo+FaMlD2et3JIVoeurOijgmc36yIz8XVHS+ayOrHf5kanIa8 TzWnYudqLHOI/+MgFgDio03PyPD8d5+nW6V7FPD8PNqcyxo1u6VUyBN8kBkIJ3lfpvxZ hu+EfqSTKHi9YKTkmpIAZiIbrh+73xijtEfLoKy6CpC/gRwlCsD3yrKdE/zOKVB3VNc4 LMag== X-Gm-Message-State: AOAM532waeSVq651JQLevtt1oDRdlXicKw9v7fgN5Rk7TdU9XpoN4L5n NNGD52VJrFgKk6p7dgrp4g7TDg== X-Google-Smtp-Source: ABdhPJzyeA3Q5ngCzGIK7eSt6PW/tJB8tqaKnGIDg9q3no2KbHhZQJeHREM0JArhioIFXKbrUbsY9w== X-Received: by 2002:a63:2e42:: with SMTP id u63mr1817811pgu.292.1601310937360; Mon, 28 Sep 2020 09:35:37 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:36 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 21/25] coresight: cti: Allow cti to be built as a module Date: Mon, 28 Sep 2020 10:35:09 -0600 Message-Id: <20200928163513.70169-22-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200928_123539_379325_9C12E89E X-CRM114-Status: GOOD ( 21.33 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Tingwei Zhang 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 - add a MODULE_DEVICE_TABLE for autoloading on boot - move cti_remove_conn_xrefs to cti_remove since all sysfs links have gone when system calls device_release. Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 5 ++++- drivers/hwtracing/coresight/Makefile | 6 +++--- .../{coresight-cti.c => coresight-cti-core.c} | 20 ++++++++++++++++++- .../hwtracing/coresight/coresight-platform.c | 1 + drivers/hwtracing/coresight/coresight.c | 1 + 5 files changed, 28 insertions(+), 5 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 3dbd49a060dd..27034bd4d3c7 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 \ - coresight-cti-sysfs.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 38e785d913b0..d28eae93e55c 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti-core.c @@ -822,7 +822,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 */ @@ -837,6 +836,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) { @@ -957,6 +968,8 @@ static const struct amba_id cti_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, cti_ids); + static struct amba_driver cti_driver = { .drv = { .name = "coresight-cti", @@ -964,6 +977,7 @@ static struct amba_driver cti_driver = { .suppress_bind_attrs = true, }, .probe = cti_probe, + .remove = cti_remove, .id_table = cti_ids, }; @@ -986,3 +1000,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 227e234a2470..3629b7885aca 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 546c97045afe..5aebdbe293f2 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -288,6 +288,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)