From patchwork Tue Jun 5 21:07:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kim Phillips X-Patchwork-Id: 10449253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 662BF60375 for ; Tue, 5 Jun 2018 21:13:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54E8829CB4 for ; Tue, 5 Jun 2018 21:13:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4855F29CBF; Tue, 5 Jun 2018 21:13:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B0F9729CB4 for ; Tue, 5 Jun 2018 21:13:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=FqyWcuj+1Y4sKt/KksPTWZ/v8iNrqdQcTykDhawY3NU=; b=KA3rfpqgXv7Wvk5ls9I5mFDBaS M4zCM/blI9hux8EZUSmuplFB5b3pBRFxAWaGzhNNySXjvBc3eshNAmOkAUYXH4J7x6XBWMhztYb4S 8kkWnv0oAySI6stVQlk2C694yipyARGsBMmiMdRipDf+0oEQPw66M1NLGNkxNxQ/4tw7p/T+J957X g24N+xW8LzHdURqdE/ggoDEG/MqNNv+YX0wRjtgsle/7T0sUdljU/2MlYdjMF2ONmEXCPZxP7gauf tJ7JE+9anD63ujWy7L73crhVoQIwakwUK4MotjUwZy8xaZnqVSK91WHFNrHIeG4slbkoG6aYdJzgF EENO1Ekw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQJGB-0003QV-K7; Tue, 05 Jun 2018 21:12:55 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQJBP-0007t9-PT for linux-arm-kernel@lists.infradead.org; Tue, 05 Jun 2018 21:08:41 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 526F116BA; Tue, 5 Jun 2018 14:07:48 -0700 (PDT) Received: from localhost.localdomain (unknown [10.118.17.245]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3C3363F59D; Tue, 5 Jun 2018 14:07:47 -0700 (PDT) From: Kim Phillips To: Mathieu Poirier Subject: [PATCH v4 13/14] coresight: allow funnel and replicator drivers to be built as modules Date: Tue, 5 Jun 2018 16:07:09 -0500 Message-Id: <20180605210710.22227-14-kim.phillips@arm.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180605210710.22227-1-kim.phillips@arm.com> References: <20180605210710.22227-1-kim.phillips@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180605_140800_129856_4BF11886 X-CRM114-Status: GOOD ( 16.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kefeng Wang , Kim Phillips , Geert Uytterhoeven , Alexander Shishkin , Gargi Sharma , David Howells , Russell King , Pavel Tatashin , Thierry Reding , Rik van Riel , Suzuki K Poulose , Eric Auger , Alex Williamson , Mike Rapoport , linux-arm-kernel , Greg Kroah-Hartman , Randy Dunlap , Oleg Nesterov , Linux Kernel Mailing List , Kirill Tkhai , Eric Biederman , Leo Yan , Andrew Morton , Robin Murphy , Todd Kjos MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Allow to build coresight-funnel and coresight-replicator as modules, for ease of development. - Kconfig becomes a tristate, to allow =m - add funnel_remove and replicator_remove functions, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Signed-off-by: Kim Phillips --- drivers/hwtracing/coresight/Kconfig | 5 ++++- .../hwtracing/coresight/coresight-funnel.c | 18 ++++++++++++++- .../coresight/coresight-replicator.c | 22 ++++++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index ae05b4b89ff9..181a44ea2d61 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -14,13 +14,16 @@ menuconfig CORESIGHT if CORESIGHT config CORESIGHT_LINKS_AND_SINKS - bool "CoreSight Link and Sink drivers" + tristate "CoreSight Link and Sink drivers" help This enables support for CoreSight link and sink drivers that are responsible for transporting and collecting the trace data respectively. Link and sinks are dynamically aggregated with a trace entity at run time to form a complete trace path. + To compile these drivers as modules, choose M here: the + modules will be called coresight-funnel and coresight-replicator. + config CORESIGHT_LINK_AND_SINK_TMC tristate "Coresight generic TMC driver" depends on CORESIGHT_LINKS_AND_SINKS diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 448145a36675..861ac641a716 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -211,6 +211,15 @@ static int funnel_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR_OR_ZERO(drvdata->csdev); } +static int __exit funnel_remove(struct amba_device *adev) +{ + struct funnel_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + coresight_unregister(drvdata->csdev); + + return 0; +} + #ifdef CONFIG_PM static int funnel_runtime_suspend(struct device *dev) { @@ -250,6 +259,8 @@ static const struct amba_id funnel_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, funnel_ids); + static struct amba_driver funnel_driver = { .drv = { .name = "coresight-funnel", @@ -258,6 +269,11 @@ static struct amba_driver funnel_driver = { .suppress_bind_attrs = true, }, .probe = funnel_probe, + .remove = funnel_remove, .id_table = funnel_ids, }; -builtin_amba_driver(funnel_driver); +module_amba_driver(funnel_driver); + +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight Funnel Driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 8d2eaaab6c2f..1fb469d7cf50 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -112,6 +112,17 @@ static int replicator_probe(struct platform_device *pdev) return ret; } +static int __exit replicator_remove(struct platform_device *pdev) +{ + struct replicator_drvdata *drvdata = dev_get_drvdata(&pdev->dev); + + coresight_unregister(drvdata->csdev); + + pm_runtime_disable(&pdev->dev); + + return 0; +} + #ifdef CONFIG_PM static int replicator_runtime_suspend(struct device *dev) { @@ -144,13 +155,22 @@ static const struct of_device_id replicator_match[] = { {} }; +MODULE_DEVICE_TABLE(of, replicator_match); + static struct platform_driver replicator_driver = { .probe = replicator_probe, + .remove = replicator_remove, .driver = { .name = "coresight-replicator", .of_match_table = replicator_match, + .owner = THIS_MODULE, .pm = &replicator_dev_pm_ops, .suppress_bind_attrs = true, }, }; -builtin_platform_driver(replicator_driver); +module_platform_driver(replicator_driver); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight Replicator Driver"); +MODULE_LICENSE("GPL v2");