From patchwork Mon Sep 28 16:34:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804075 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 ED1EF139F for ; Mon, 28 Sep 2020 16:38:18 +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 916CD214D8 for ; Mon, 28 Sep 2020 16:38:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VQJoMEFj"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BMR/O8qe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 916CD214D8 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=x4DQhLls6smKca2EAMgNlAwGS+CCBnnUHwcmZk7gsys=; b=VQJoMEFjcY/kMrBYZlR+6+6aG AMA7J1B37g8BUNMgTf8fvRCpC/NMq46M0WTW4e6/Z0rzfn0bpxd1huxAyvEQOeHmb0l9adQBH2dBF GK4bqG/xQPoSXKI7rOnmABycx70MF1AI8U+NWgPMJi+w0fixluXl8NIOrdY+JUQM5FQtxe2jvifsr 94VxyQ+SWd8u/kUf2mPxyfRL+kWEZtYg8bMeH4BjUE3lVlHk1L8pnKU33J0TyAKX4xyg2+uNzXOYJ NXbrgKZGVAIpdfv0nJIVqff7KzbSUrO4irOgpM0E/ip6AqLH2lsIsxMuCJHSSRSxIZEEHjYp99mOD OP+LeUQxw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw9f-0001KZ-En; Mon, 28 Sep 2020 16:37:35 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7c-0000ZY-Qt for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:32 +0000 Received: by mail-pf1-x444.google.com with SMTP id q123so1542313pfb.0 for ; Mon, 28 Sep 2020 09:35:28 -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=z2CmOiUqIi3yzFuKU+bzyeukQxjbaPfmw7sLG+1ioBo=; b=BMR/O8qe2rXvmTvc0vLb+ZJea/fudMosPiGJcAui+t2ZRn578HzmIA5MS/kjTuwR6+ khFkU9w7kBv4rCc14TyxBuPiMawXnsKmZu262ZRMK5f2kGulIDYZn97Z5G4Uh97GzPwk FIcMws2GFZP5pgukI8WVlpZ2VuK0FphAPtN++y3pZbyEXeJrWaFvQWSX7370fIKdHwx8 uHQGBBdVTqUjWQfHRsInMtauh2EqJB2fOt83dBXdu3WmvAHyehYS2eRbEORSXWe3jOxz ZsKSD17zQ+a6SCxCvBibdzCGfcfshZpX2RxJSNbCQuKneyd3zZkQciJgXIRAtwymc1Ab rLSA== 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=z2CmOiUqIi3yzFuKU+bzyeukQxjbaPfmw7sLG+1ioBo=; b=Y1HYZSXjqfD3SXmVxlM3BDHtiWPxRoBzzvkWnn80fq9/2MFze1KL5y+IhG7w2ENsYX CbydEhZ2DNl2YsFGRmx1pxOM/NGFQybwfcHrnG117Hnn0KzNFOivuQHkkqUwCblxbOwL rJ8NqjBGymmV+pxog7OLdd1vwYOMAmArv6+zHZncmp3Ein2PVr6kX0lYevbMs3CDxtWT GEOWvU3x1jIabQ/xOLHUwYCr7y9MstAeMssKYal508xX8+0Ue+mHHfu2UY5ebxz3seHm +MFVsUlmsH7SCwvrALF9rMOR7gPG3zxgkTQ8jJsRazSWVFh1ACw+rMZQ6NSJZHBDlN0u 6RPQ== X-Gm-Message-State: AOAM532OT+4OMh7U7vz8h573U+skK7D91pOB75pCyXtItXrJzCjPSkV/ EW4zGHqpemW9Aeg2tV2gGJkPmMV35SccRw== X-Google-Smtp-Source: ABdhPJzqJs2a3ir5T2VTqKg6xAe6GuQu//NZjLFcieRxcCk962PEym3sNugg9IaixbV7as1OdqAlWQ== X-Received: by 2002:a62:154b:0:b029:150:c091:7146 with SMTP id 72-20020a62154b0000b0290150c0917146mr220065pfv.80.1601310926652; Mon, 28 Sep 2020 09:35:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:26 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 11/25] coresight: etb: Allow etb to be built as a module Date: Mon, 28 Sep 2020 10:34:59 -0600 Message-Id: <20200928163513.70169-12-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_123528_941291_D6CC18AC X-CRM114-Status: GOOD ( 22.05 ) 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:444 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: Kim Phillips Allow to build coresight-etb10 as a module, for ease of development. - Kconfig becomes a tristate, to allow =m - add an etb_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-etb10.c | 26 ++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index d6e107bbd30b..996d84a1edb8 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -57,13 +57,16 @@ config CORESIGHT_SINK_TPIU the on-board coresight memory can handle. config CORESIGHT_SINK_ETBV10 - bool "Coresight ETBv1.0 driver" + tristate "Coresight ETBv1.0 driver" depends on CORESIGHT_LINKS_AND_SINKS help This enables support for the Embedded Trace Buffer version 1.0 driver that complies with the generic implementation of the component without special enhancement or added features. + To compile this driver as a module, choose M here: the + module will be called coresight-etb10. + config CORESIGHT_SOURCE_ETM3X tristate "CoreSight Embedded Trace Macrocell 3.x driver" depends on !ARM64 diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 04ee9cda988d..248cc82c838e 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -801,6 +801,21 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) return ret; } +static int __exit etb_remove(struct amba_device *adev) +{ + struct etb_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + /* + * Since misc_open() holds a refcount on the f_ops, which is + * etb fops in this case, device is there until last file + * handler to this device is closed. + */ + misc_deregister(&drvdata->miscdev); + coresight_unregister(drvdata->csdev); + + return 0; +} + #ifdef CONFIG_PM static int etb_runtime_suspend(struct device *dev) { @@ -835,6 +850,8 @@ static const struct amba_id etb_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, etb_ids); + static struct amba_driver etb_driver = { .drv = { .name = "coresight-etb10", @@ -844,6 +861,13 @@ static struct amba_driver etb_driver = { }, .probe = etb_probe, + .remove = etb_remove, .id_table = etb_ids, }; -builtin_amba_driver(etb_driver); + +module_amba_driver(etb_driver); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight Embedded Trace Buffer driver"); +MODULE_LICENSE("GPL v2");