Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3154808pxk; Mon, 28 Sep 2020 09:37:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmdqf5vt48VEQI1zu7Rh+TIR90iI/SRAE5Nxo8icK0S+ycb/Xcoc5ZPScSZFqGHhz021pY X-Received: by 2002:a17:906:1c03:: with SMTP id k3mr2611136ejg.259.1601311058750; Mon, 28 Sep 2020 09:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601311058; cv=none; d=google.com; s=arc-20160816; b=Kjsud+17xP8DgtwOq7zvn9NYIo5M7FC/BCr5YfZb5EEGaZ0GrziyQYWfvr8V51sg6i +Zyc1JZni7RIigwBu4lL1WLWiKM80NYnyro6gkaB6XvlJarME7ymOChRwgS704UBblyI ZoATKdEzwJNZvYTRBZlkbdOZhEKwKOeeF1rWkV3xyYNUtUzeSq8o1hu6tEWZEci2UuEY EuEbW6lQEZ7x1yK4b8RpSZ7HU7QCfw3BB+5RoGkyoGsanAUCKdyp31rceqcjTg+XZGF+ g3fj/E7V9jPM7ZUZiQUbffe6ryjgjnApLaFX0jvXvN7ZA9L+s7Ygfkt8JKY7mCMa4lM/ GkeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=z2CmOiUqIi3yzFuKU+bzyeukQxjbaPfmw7sLG+1ioBo=; b=dorXKcG5hGIsyP4uFRD3BJBU6552LbICkjO+bdUeWXakL9JEHPjUn9q0IKDjCTIJB6 4DpF9KMHdj43dr5Wa07VlNXuA+kT5Mc/LJJ7GcOQYBqIwY1pEaLL+mWbd4L0Go0MkECj /bDAYJ17C+ZV7zVaF+4Dlvc2EHhCLTwLt7oH07mPNkGd0yh21sSc+2h47xyWif741lBM BNzox2TbisNb8bivLAEoE4T+lYXnJ52n/S5IZBdtNxdS5IFzp9LZ/E1w/tWuoo+hacf3 FmyElt0/d9oHCq+8cPn4BDiRHqhLySBV8xJeS8u0+kBO7SyREUOWOMwowpGfTUj2kZXc rVKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BMR/O8qe"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si1050784edp.120.2020.09.28.09.36.52; Mon, 28 Sep 2020 09:37:38 -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=pass header.i=@linaro.org header.s=google header.b="BMR/O8qe"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726780AbgI1Qfb (ORCPT + 99 others); Mon, 28 Sep 2020 12:35:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726409AbgI1Qf1 (ORCPT ); Mon, 28 Sep 2020 12:35:27 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BAB2C0613D3 for ; Mon, 28 Sep 2020 09:35:27 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id d6so1507726pfn.9 for ; Mon, 28 Sep 2020 09:35:27 -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=f7JSD/jjR6Z1a3v79HZ1tY3paUbw3PfrLlAUJ5s/Jvg0ePYaaWOvIU9i+ViLL8XZJu b7gcI8foeJGgds/wY6VilkJ2RNkcwlDt03Sj74aeMMobeKn5dEwVJhMW+908eB53XXEA UKWQn2bpiDy8gDUvH0rKiJJEBLxu7iRITF6+xq6PEGsRVaSS4ji2u+MP06NT7r/x9EV3 9nQsIo9om7raxK4H3XJfzrF5Ifr3LUuCgt37su16z/SON0/+/0ckr9OTmZQvda8g0BMS LojcYZvEn+oLVPbw8/DA76dQGOYZRWTF6qrRm+FUY9OXf4PaPbXo66hqeRFuthXyZ/OS KxIg== X-Gm-Message-State: AOAM530DqKEZRUPSqpJMaWxiATyWhpzrA+FbX3cSnETAk4n/iwoMmYWe yCDTolNM9nUQ3AvkYv2JrsuUBw== 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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"); -- 2.25.1