Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2837140pxk; Tue, 15 Sep 2020 03:47:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyLQuEkHwj/SfyljKgJMTVz1nZrGfiTR/AtBW1vRVRKvRoe6Fhnq7RvK4uLOBdw4wa1tE0 X-Received: by 2002:a05:6402:6d3:: with SMTP id n19mr21311391edy.381.1600166830182; Tue, 15 Sep 2020 03:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600166830; cv=none; d=google.com; s=arc-20160816; b=HjD84Bs8yjeb+j5DESlguePht8gmymPErFo9p3X+jliu60XhRNjtOZm2W/EIPxIGxH YtM6AycFgYVOssx820VtP9zQHpuYtjl+wppYIGGtDEP/too6EpAKmkmyc1ufgo9O2LzL Fns0d8qXjUefCgNSy9nuR7RG19RgRB5BT7eI+GJsniUIny59Ot7B36nhpkn8fTDJ1vyu Y0HPuPf5gjio5fm+8fYd8wT+WrmObBYv15eBQ5W9INKR0W2LUBM4mOC69OyNRlRu1UaP t/bR73VL/A5GsE2Bmce4FjNfNIDiW5oKIkI6ATYnzVn9ZA5Rfo9UBHoE9N3mv8zmWmzx GAtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature; bh=iWgpx93myVfTgVuliFCSUQkhRd6Nl/5GBcbj6CMtLlA=; b=qRnmnxexvGLoRVmcagQwqeP9Tw5MTOq8aR5cDw2nfmp+qZQ5BEh9lOwqPDM2X8mtgz qHOcGlXQMBnmtOLrfW1dh8ChwryTcvLGA/WzRd7rHRGmyQiFsrksznDN2aebwLpvQHNr lptVTi8NqAEB8H0cWBHu8/LWHIMbdIZK5BGkyyaX/cmuocBN6hBK+xCdbEE/5W0vba5i hyRh25d11mK2+N14ajS45X3MyIPXWNOwChgPzSGOX4JmPkfo2IveFYYFhuf0ETZJHCR1 KrzYkcuA8bVDOIcDzvJ6HBcYm6PRhRJCpZkBjXCaDGENzGf3ZaNL0m/Dfe1T3tp5auDL Vx9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="T/fIXDb9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si10231808eda.569.2020.09.15.03.46.48; Tue, 15 Sep 2020 03:47:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="T/fIXDb9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726469AbgIOKpN (ORCPT + 99 others); Tue, 15 Sep 2020 06:45:13 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:19700 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726382AbgIOKmq (ORCPT ); Tue, 15 Sep 2020 06:42:46 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1600166565; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=iWgpx93myVfTgVuliFCSUQkhRd6Nl/5GBcbj6CMtLlA=; b=T/fIXDb99XqLUfgowkqkZlHijZEkn+n883pbR32ZFweUYxEvB9xhUUOW9rqx609jfip3fTmY ESPAm9OSjP2u2YiWSyGpq5CNFpj7tKJEOti/sNA1ZM/Z1QuPmePzWbrah2G1eEyxrPAEZUx8 muTTzBw5cu1i1u2u7n+27Re376M= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-west-2.postgun.com with SMTP id 5f609a97698ee477d157c471 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 15 Sep 2020 10:42:31 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 76997C433FE; Tue, 15 Sep 2020 10:42:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from tingweiz-gv.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tingwei) by smtp.codeaurora.org (Postfix) with ESMTPSA id D437BC433C8; Tue, 15 Sep 2020 10:42:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D437BC433C8 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=tingwei@codeaurora.org From: Tingwei Zhang To: Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Mike Leach Cc: Tingwei Zhang , Greg Kroah-Hartman , Leo Yan , Randy Dunlap , Russell King , Kim Phillips , Mian Yousaf Kaukab , tsoni@codeaurora.org, Sai Prakash Ranjan , Mao Jinlong , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Suzuki K Poulose Subject: [PATCH v11 07/24] coresight: stm: allow to build coresight-stm as a module Date: Tue, 15 Sep 2020 18:40:59 +0800 Message-Id: <20200915104116.16789-8-tingwei@codeaurora.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20200915104116.16789-1-tingwei@codeaurora.org> References: <20200915104116.16789-1-tingwei@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org - 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 Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Reviewed-by: Mathieu Poirier --- 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 4663fd1bbffc..6433f835fc97 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -86,7 +86,7 @@ config CORESIGHT_SOURCE_ETM4X data tracing may also be available. config CORESIGHT_STM - bool "CoreSight System Trace Macrocell driver" + tristate "CoreSight System Trace Macrocell driver" depends on (ARM && !(CPU_32v3 || CPU_32v4 || CPU_32v4T)) || ARM64 select CORESIGHT_LINKS_AND_SINKS select STM @@ -96,6 +96,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 2ba819a47cf6..b0ad912651a9 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -951,6 +951,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) { @@ -983,6 +994,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", @@ -991,7 +1004,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"); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project