Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp19560imm; Tue, 5 Jun 2018 14:14:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJQM1Eqmvp//els3qRzK42dtL0RPTuGSVVs+1EHowO8v9L4ZBxKwbNAPcaDlKfQDanPxRm2 X-Received: by 2002:a62:c00e:: with SMTP id x14-v6mr239272pff.67.1528233254738; Tue, 05 Jun 2018 14:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528233254; cv=none; d=google.com; s=arc-20160816; b=CCRD4topTEx3eWS1qQPRee1kg8mOV+cGHyz54lZOzabft2+iBcl3QtmGrq/kaW3wu/ wVGDxZzMOVvMTit8dEdXyn0zCT1GRV/t3u73hFzZ8j0PJqUuDiMO/v9XBgJWNgvVTDB4 HXbAQUIPDutUDVADhHxOqQRTCQjTTW2ohJlC5qWWyRaQpHfGX2wdlZ6LeZRvKnuOYMyO bocYIJvysbiOoh13KibwMwWvYdTtMxb93gmI9EkkxaMmixoJh3hMS03cN//h3ShpXRu9 MOw1g+XgexzbhkZz0pSO3tHGQMmO/m1wspIXX8PwmXKAyuJi+hXqflDIxV9VLu7bfJwl gdOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=gFGD/eIDySWy8aUeojs8NPbDz9IKEkpyC1nNBvG6c3E=; b=F2sCnkonB552YQ57aod89j99PDkveu5EaMsH8CKTsGlYe+r+z11FPl5877RQoOuUHZ Kd0NxnYhjQCfCDvX0iuodDYCx+TGBdwzsfjicS0IXdzV+a61+PJ3F3HMmee+6cLc4AEU 3qhrqd8acGj4fFpo+nbf7Hly6Z1yKm7nT1ZBOkV3QuQ/eqqPEMygMSrDJYbkTeqBcu4S 0FmmgHV/l6C1krI81yYZ0c1TnuPHqYzLxYhuhgfzo234DPiIwcE0YdRMZxYMzzeDQ6pR 6d0Gcc7PIfu7ZI6jGkiPJt6BK8FAjHgRvuwriUzTwD3gJdmz4gcvSg89cQqJDLtVIXWi CVuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 22-v6si10632710pfh.308.2018.06.05.14.14.00; Tue, 05 Jun 2018 14:14:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752853AbeFEVL7 (ORCPT + 99 others); Tue, 5 Jun 2018 17:11:59 -0400 Received: from foss.arm.com ([217.140.101.70]:33492 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752486AbeFEVHl (ORCPT ); Tue, 5 Jun 2018 17:07:41 -0400 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 6F1BA165D; Tue, 5 Jun 2018 14:07:41 -0700 (PDT) Received: from localhost.localdomain (unknown [10.118.17.245]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 580D93F59D; Tue, 5 Jun 2018 14:07:40 -0700 (PDT) From: Kim Phillips To: Mathieu Poirier Cc: Leo Yan , Suzuki K Poulose , Greg Kroah-Hartman , Alexander Shishkin , Alex Williamson , Andrew Morton , David Howells , Eric Auger , Eric Biederman , Gargi Sharma , Geert Uytterhoeven , Kefeng Wang , Kirill Tkhai , Mike Rapoport , Oleg Nesterov , Pavel Tatashin , Rik van Riel , Robin Murphy , Russell King , Thierry Reding , Todd Kjos , Randy Dunlap , linux-arm-kernel , Linux Kernel Mailing List , Kim Phillips Subject: [PATCH v4 07/14] coresight: allow dynamic-replicator to be built as a module Date: Tue, 5 Jun 2018 16:07:03 -0500 Message-Id: <20180605210710.22227-8-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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow to build coresight-dynamic-replicator as a module, for ease of development. - Kconfig becomes a tristate, to allow =m - add a replicator_remove function, 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 ++++- .../coresight/coresight-dynamic-replicator.c | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index 8c5e5407b7dd..945b17ca2eed 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -71,13 +71,16 @@ config CORESIGHT_SOURCE_ETM4X data tracing may also be available. config CORESIGHT_DYNAMIC_REPLICATOR - bool "CoreSight Programmable Replicator driver" + tristate "CoreSight Programmable Replicator driver" depends on CORESIGHT_LINKS_AND_SINKS help This enables support for dynamic CoreSight replicator link driver. The programmable ATB replicator allows independent filtering of the trace data based on the traceid. + To compile this driver as a module, choose M here: the + module will be called coresight-dynamic-replicator. + config CORESIGHT_STM depends on (ARM && !(CPU_32v3 || CPU_32v4 || CPU_32v4T)) || ARM64 tristate "CoreSight System Trace Macrocell driver" diff --git a/drivers/hwtracing/coresight/coresight-dynamic-replicator.c b/drivers/hwtracing/coresight/coresight-dynamic-replicator.c index f6d0571ab9dd..b59055097436 100644 --- a/drivers/hwtracing/coresight/coresight-dynamic-replicator.c +++ b/drivers/hwtracing/coresight/coresight-dynamic-replicator.c @@ -159,6 +159,15 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR_OR_ZERO(drvdata->csdev); } +static int __exit replicator_remove(struct amba_device *adev) +{ + struct replicator_state *drvdata = dev_get_drvdata(&adev->dev); + + coresight_unregister(drvdata->csdev); + + return 0; +} + #ifdef CONFIG_PM static int replicator_runtime_suspend(struct device *dev) { @@ -200,13 +209,21 @@ static const struct amba_id replicator_ids[] = { { 0, 0 }, }; +MODULE_DEVICE_TABLE(amba, replicator_ids); + static struct amba_driver replicator_driver = { .drv = { .name = "coresight-dynamic-replicator", + .owner = THIS_MODULE, .pm = &replicator_dev_pm_ops, .suppress_bind_attrs = true, }, .probe = replicator_probe, + .remove = replicator_remove, .id_table = replicator_ids, }; -builtin_amba_driver(replicator_driver); +module_amba_driver(replicator_driver); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_DESCRIPTION("Arm CoreSight Dynamic Replicator Driver"); +MODULE_LICENSE("GPL v2"); -- 2.17.0