From patchwork Mon Sep 28 16:34:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804079 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2995C139A for ; Mon, 28 Sep 2020 16:39:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EEC8C214D8 for ; Mon, 28 Sep 2020 16:39:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PrJN8GxR"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JjHQyvZe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEC8C214D8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gtk84wtmLeCMp7zpenrEoi1xIz83lEvaZR9ztYtyGR8=; b=PrJN8GxRFCig8T8nGrijsCa1n 88xMpmgAVpPBtXn3z9iyaqwRo6Rucykwn5fCCL+auNEV/oOz1wFFF5HxKDvkXLJ6siGVS9zfkq0Pt 73DuqSD+Q5FtZ7Ues8xzcGAgEMyoIkG11m1U0SG0GLBSAT6AJCkc3TDn/yfha5P+6xqeCRGOThzio odloHq+OF5iNOdxCl9AM09kMxCak7EZUtd84iarb6GgooRjfTEYRteAcmjoyhhtDzzCgZOxvDTedu CbKzDTdHHpRAe1nKzVPFBLSvmOgYhzsizzB/oOpA8qCn/o+RmmvygD8DN+ekU5OyawfK/um5d7cIE hQdXdA8nQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw92-00018i-RX; Mon, 28 Sep 2020 16:36:56 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7Y-0000Xf-It for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:29 +0000 Received: by mail-pg1-x543.google.com with SMTP id 197so1318076pge.8 for ; Mon, 28 Sep 2020 09:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O73kpBGGK8HOLylKY/q0Q1ivmjbxjRv7jyp1mVZ/xfA=; b=JjHQyvZem5pU93PCTLoPYqqGDRIMNVni4NYVyaBvYticDEgRkRpfWMdh/C+HAoe/Ve Tk24YuFhl2Tpf8La/RCfOlFcwklF+W1URx+BIYHWADuL+YtCfG1bTOjEUjDpvgIxPUtf WailIZkMRWt3+Kz0f99o+jzPVw63mrlEsir/DIIdFBKUawlGxKH4CNPqPEw7FvYB6nAz kWEuJtHWVvFceqismX3cvXZk0b+r+5ZIOhtqeu3dQhuJ2tUrRsLIA/8kdEbCsUauioD6 7ki0e/+DpMq+IhCmKSiSeLxU2MvH85Bpb4ZVykPLSXWLNby43yW1vVwuQqbHWE/RumWl t1AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O73kpBGGK8HOLylKY/q0Q1ivmjbxjRv7jyp1mVZ/xfA=; b=sdcE+PrX0PGHGVDpp//3BOI9inqow1rqgHCkNZxO7ZKb/95YpPc4GGFzVx4qYqy0nH 9x/tOx9mPdA7ZLxwnHzGdNN9JKwvfisR0bYrvR4IixijjB/9j0SH+6DD45ZSsD1n+NsJ 2LEUXE0uenB3L6hS5I4UKWW51sXg01oiImDRXICmwktFHoS5ER9ovF33yOc0S5hJgY9l G7DV31RHvUv2xFnLJKXug33IFLcmg3e8Y9GiRusia6P1hmLyT2kAhxnayo5BdH+LGw/D JFEDUPwAU4fdICnJRul8T7fq7q7HJbpBhDKKHaqeVcDlhRq2ybiRf6HUaPvcbjQLFlqY SmaA== X-Gm-Message-State: AOAM530t6rUzeNhrq/YJEVl8t1p+slvFhpeupcxVndIcLmjgj0i/Wg7S iuggmn+LBQpoEwXe2l5I+/s9T09tCa5rNQ== X-Google-Smtp-Source: ABdhPJx685Iufn2gqsCjBD//uq3ZXQDyAbAQhuKDHf1FWgHy/Qy1tzwHHREjEF87YYC8QG1UWzhaEQ== X-Received: by 2002:aa7:8299:0:b029:142:2501:397a with SMTP id s25-20020aa782990000b02901422501397amr288654pfm.63.1601310922393; Mon, 28 Sep 2020 09:35:22 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:21 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 07/25] coresight: stm: Allow to build coresight-stm as a module Date: Mon, 28 Sep 2020 10:34:55 -0600 Message-Id: <20200928163513.70169-8-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200928_123524_684475_72526579 X-CRM114-Status: GOOD ( 19.57 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:543 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Tingwei Zhang - 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 Signed-off-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");