Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp994606pxa; Wed, 19 Aug 2020 22:52:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEUYSyxagnfWh1TtoRbnqaa/DSRkZC1jkxKFRoYC6WwNgBd1htk6rGHP1eKdbyP4jhPs6R X-Received: by 2002:a50:ccd1:: with SMTP id b17mr1338364edj.165.1597902748871; Wed, 19 Aug 2020 22:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597902748; cv=none; d=google.com; s=arc-20160816; b=c393wQ6VBIyk1CKZxPulcFQCQ0iBvVDcPmZisMdKSqiHvaPbt5IM0He10mMMOyfwIx YCLe5MXNyudzatntkvGhJdlacdiXLkqlV4Crvmovcy3o4C70zh0LKkEQnAtG4In4LkGP l9erc6Q4OzURh4X6cgcpnxfUXYT+bs7ZCwdjne+FLa1dOJEgUtzgfZxjr45VjZgUG2KL Q4zbOrwnw212VRd0GinicXo/5+MsEo+BKWA1ntH3lIa16MIX7n/n5l79p9NYspsgFCMG jw4NoiFFcs4liRpSQMvGNciMbI5uMdAd+eVA5M+8dqnh1Z0ex06FzV/7lr+pjPMlcNzL mI7w== 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=1h4fsqhtrfHOIIY9722x00XG5pmAjB4prQT3AFauQ9k=; b=tohCX09HYsxeCkeUyCPPTn0g4l3l6T+wFygeRyQdeNUOHM7igpPD4pR2MMqfgl8UOj XWvBfH16CX1SnYV90IfjgMboburielH8y5Q8F8tvPwtgWwwHJtZAz4CNVne+W6XuwoF+ oJmNpAHQp19Iq4vmEyhR8SvJ4+pa9iJ5ZBCJ4rs1zX2D2zYBDX+/aY9917wVr4f1NBWY HubNqcS/jL+h45Yu/jeH0kCjlUJCRpOYiQdFVUMbZhyVjxgMnFkaMAUs3OFYBN5xopsi bYym4ybj7A5usonWVapOK5nQmE+Ary6ICFtjCTMabt1H5jI4KcXAoRBVoOFqvTjX5Tu8 YErg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="VlVqI/2p"; 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 md17si473541ejb.214.2020.08.19.22.52.05; Wed, 19 Aug 2020 22:52:28 -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="VlVqI/2p"; 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 S1727770AbgHTFsn (ORCPT + 99 others); Thu, 20 Aug 2020 01:48:43 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:37192 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727108AbgHTFsm (ORCPT ); Thu, 20 Aug 2020 01:48:42 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597902521; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=1h4fsqhtrfHOIIY9722x00XG5pmAjB4prQT3AFauQ9k=; b=VlVqI/2pMK5DAP0OJ5Qa8PDIvn8me+GMcqDA6pMK9q/8vLKBRe9311bZEQvlrfH4zZIeHUH9 t73+Qy/Oa5ReH6sDPoiC21BlIt8Dfbs0LBof0/NgFGuw2o+MSZPVDxzoZLUljKHvs25awFQC ciSJug9ewlKEYErWmUiebfswke4= 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 5f3e0eb9797e7ddeccddf9b8 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 20 Aug 2020 05:48:41 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id EA2F2C43452; Thu, 20 Aug 2020 05:48:40 +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=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable 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 9F94AC433A1; Thu, 20 Aug 2020 05:48:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9F94AC433A1 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=none 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 v9 07/24] coresight: stm: allow to build coresight-stm as a module Date: Thu, 20 Aug 2020 13:47:01 +0800 Message-Id: <20200820054718.20115-8-tingwei@codeaurora.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20200820054718.20115-1-tingwei@codeaurora.org> References: <20200820054718.20115-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 673d2f56ed1e..b74072e78436 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -948,6 +948,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) { @@ -980,6 +991,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", @@ -988,7 +1001,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