Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp19395imm; Tue, 5 Jun 2018 14:14:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKFaWSo+nClPUBc80gXmbmwKRNzZBPtpiRE6xdCZWp+ybvwF/AiANC1nM/kioD753DBwAVY X-Received: by 2002:a17:902:9a98:: with SMTP id w24-v6mr263745plp.9.1528233241464; Tue, 05 Jun 2018 14:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528233241; cv=none; d=google.com; s=arc-20160816; b=UZHymflSg+VwnBhlI3YcWCvMeScBoJdXwAkqnTe60g6kW84IFu7YDz6+l2BbtgwPIj xMrE+WoPg+VLMzh5YJ8d2cJqkY+xD5hlk/BoGpocXN6I7zU8CJXALlMvoBNJnAm8/SC6 t+wemY619+qw4EPTsYfhjUZoUajf04SyPO5qdCNl/xmwIFgxom70XmrtnosAWMzAu9us y8MVRVNZhDTzjsrFhZj8lBKlspqXaelZFtOkZYZ5cOqlf4IYCHBFudqstA5h5GRSVN7i dIge+fuOuNi2HuqFATNZxzmbDrIDg8aMEqLt1dw9nKnlCrW1RVP0s1duw45lVIj89I6I ZFiQ== 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=zMOlbwA2EV4/n/18SX2UzVEuVbEQnQqgkC8mjVlmhJM=; b=Q73tbCxf0cQSMOVoI8NHP8rN9MYr69cAzEXzYk2ex+HsGTQiezRbFy9FE3ky2sFpKu jH0emoV2AUO6CyEHtzjgDH/+41neTZGqBSHrxRd6+9q0VzE2kVm0kMMAp4fR0Vd4jOqL XpwaSAComYhcN+vNEqcpThT15b/SyjZ15nu8rK5a6SlkNEDv0llXpoQbVoYPLx1Mok6T f7lkDMk6uyHju9DM+PvyozFK9kOrKBxnYZi9N/Vh9+LAmGtOoSBPTV6xqxXBF8la06/E 4baUuU7YyXJanwK/ZKfnSPDRNjWAEyO0lai2lFDM3Qkn3lJMStWuGQAvMSiDyRRpXAGW 1wRg== 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 g14-v6si4934471plo.95.2018.06.05.14.13.47; Tue, 05 Jun 2018 14:14:01 -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 S1752579AbeFEVHn (ORCPT + 99 others); Tue, 5 Jun 2018 17:07:43 -0400 Received: from foss.arm.com ([217.140.101.70]:33460 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751951AbeFEVHk (ORCPT ); Tue, 5 Jun 2018 17:07:40 -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 4D8A71650; Tue, 5 Jun 2018 14:07:40 -0700 (PDT) Received: from localhost.localdomain (unknown [10.118.17.245]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 37CB03F59D; Tue, 5 Jun 2018 14:07:39 -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 06/14] coresight: allow stm to be built as a module Date: Tue, 5 Jun 2018 16:07:02 -0500 Message-Id: <20180605210710.22227-7-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-stm as a module, for ease of development. - Kconfig becomes a tristate, to allow =m - add a stm_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-stm.c | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index d1209f5acf76..8c5e5407b7dd 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -79,8 +79,8 @@ config CORESIGHT_DYNAMIC_REPLICATOR trace data based on the traceid. config CORESIGHT_STM - bool "CoreSight System Trace Macrocell driver" depends on (ARM && !(CPU_32v3 || CPU_32v4 || CPU_32v4T)) || ARM64 + tristate "CoreSight System Trace Macrocell driver" select CORESIGHT_LINKS_AND_SINKS select STM help @@ -89,6 +89,9 @@ config CORESIGHT_STM logging useful software events or data coming from various entities in the system, possibly running different OSs + To compile this driver as a module, choose M here: the + module will be called coresight-stm. + config CORESIGHT_CPU_DEBUG tristate "CoreSight CPU Debug driver" depends on ARM || ARM64 diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index c46c70aec1d5..c465e6bc66c8 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -882,6 +882,17 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) return ret; } +static int __exit stm_remove(struct amba_device *adev) +{ + struct stm_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + coresight_unregister(drvdata->csdev); + + stm_unregister_device(&drvdata->stm); + + return 0; +} + #ifdef CONFIG_PM static int stm_runtime_suspend(struct device *dev) { @@ -922,6 +933,8 @@ static const struct amba_id stm_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, stm_ids); + static struct amba_driver stm_driver = { .drv = { .name = "coresight-stm", @@ -930,7 +943,12 @@ static struct amba_driver stm_driver = { .suppress_bind_attrs = true, }, .probe = stm_probe, + .remove = stm_remove, .id_table = stm_ids, }; -builtin_amba_driver(stm_driver); +module_amba_driver(stm_driver); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_DESCRIPTION("Arm CoreSight System Trace Macrocell driver"); +MODULE_LICENSE("GPL v2"); -- 2.17.0