Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp18237imm; Tue, 5 Jun 2018 14:12:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIiKnudmwdt0IB1l/Hl8qrwl5GB6UX3rMlNHNby7O+uvCBLmlPQbGnQpENpSH1zfFetESIN X-Received: by 2002:a62:8910:: with SMTP id v16-v6mr235062pfd.13.1528233161773; Tue, 05 Jun 2018 14:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528233161; cv=none; d=google.com; s=arc-20160816; b=M+vogoC0Wb1rEDyy7xsKeXl0hZvIGxlkBcgs4vBFwX6mHWupAZ/Y6NJAiSuE14vlGd L8gU87xC7kCgY8Gy93BlnhI7yS7EU0F5q0WbrEnsGH3DlGG+JwISHaZlZzrMUGaz31+A DTQyVBByFNzskrbogEDi6c3fsXi4azeQBr4wAWO+TYOzoqlWnbuzOpiC3EZtmVJ9ojfi uf5UxSlsshGYRMzWI3FjKwXSuQjl+FppNbk+KZ7ag0mHcdP+KvSznlLPt29V9VRd3Tjj u9ZrbA4l4aOIykYhwN47Xgofd12AQN6YpaAV8vzbNFK8weewuUNT+dY0mn4LRp/d7rET t25Q== 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=A68PBE8fKWyTM0xrxkqWAIGVIy3fLE/nAzfvsvfKOAg=; b=wUfFIlFSFBg8ZODaR6O272dxW9qqk6J08flH16+5oXgjOm3RDGEHvIiMV6BHwF+owE apNmWqKYj+ifmczf/r4ie0Wn8J8/Bm2W7KAAdxKYlZ/M9tBK4c/3dodc+XsdecNm3QeR bwLKiJWk//oU7X26wiMookTrRqwucfXdzxhv3dpI6Wz7xlLV+fCR8woSE4ilbh+dHXR5 R3QI5VwVwuFIuOS+QaLtKCACj4LzMu8FHvlL5Kroomr+qdsDwYKikL3/1MyoRsULqk/W +7P3/zAeRh1XUq20/aHSVXqjVVsROEoWiOFKNpVW5wUtdDs7lijMeo/3w1LFE5npTgUz oIsg== 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 r12-v6si11575850pfj.331.2018.06.05.14.12.27; Tue, 05 Jun 2018 14:12:41 -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 S1752787AbeFEVL2 (ORCPT + 99 others); Tue, 5 Jun 2018 17:11:28 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33592 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752606AbeFEVHq (ORCPT ); Tue, 5 Jun 2018 17:07:46 -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 0B32816A0; Tue, 5 Jun 2018 14:07:46 -0700 (PDT) Received: from localhost.localdomain (unknown [10.118.17.245]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E81073F59D; Tue, 5 Jun 2018 14:07:44 -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 11/14] coresight: allow tpiu to be built as a module Date: Tue, 5 Jun 2018 16:07:07 -0500 Message-Id: <20180605210710.22227-12-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-tpiu as a module, for ease of development. - Kconfig becomes a tristate, to allow =m - add a tpiu_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 ++++- drivers/hwtracing/coresight/coresight-tpiu.c | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index 3c3256425a7f..2f44adb82361 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -32,7 +32,7 @@ config CORESIGHT_LINK_AND_SINK_TMC special enhancement or added features. config CORESIGHT_SINK_TPIU - bool "Coresight generic TPIU driver" + tristate "Coresight generic TPIU driver" depends on CORESIGHT_LINKS_AND_SINKS help This enables support for the Trace Port Interface Unit driver, @@ -42,6 +42,9 @@ config CORESIGHT_SINK_TPIU connected to an external host for use case capturing more traces than the on-board coresight memory can handle. + To compile this driver as a module, choose M here: the + module will be called coresight-tpiu. + config CORESIGHT_SINK_ETBV10 tristate "Coresight ETBv1.0 driver" depends on CORESIGHT_LINKS_AND_SINKS diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index 01b7457fe8fc..ab53ce1a9ce3 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -164,6 +164,15 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR_OR_ZERO(drvdata->csdev); } +static int __exit tpiu_remove(struct amba_device *adev) +{ + struct tpiu_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + coresight_unregister(drvdata->csdev); + + return 0; +} + #ifdef CONFIG_PM static int tpiu_runtime_suspend(struct device *dev) { @@ -207,6 +216,8 @@ static const struct amba_id tpiu_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, tpiu_ids); + static struct amba_driver tpiu_driver = { .drv = { .name = "coresight-tpiu", @@ -215,6 +226,12 @@ static struct amba_driver tpiu_driver = { .suppress_bind_attrs = true, }, .probe = tpiu_probe, + .remove = tpiu_remove, .id_table = tpiu_ids, }; -builtin_amba_driver(tpiu_driver); +module_amba_driver(tpiu_driver); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight TPIU (Trace Port Interface Unit) driver"); +MODULE_LICENSE("GPL v2"); -- 2.17.0