From patchwork Wed Dec 21 10:19:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 9482817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D131660772 for ; Wed, 21 Dec 2016 10:21:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C387028179 for ; Wed, 21 Dec 2016 10:21:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7CD02844B; Wed, 21 Dec 2016 10:21:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5215E28179 for ; Wed, 21 Dec 2016 10:21:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cJe0V-00059o-Dt; Wed, 21 Dec 2016 10:20:23 +0000 Received: from webbox1416.server-home.net ([77.236.96.61]) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cJe0L-00043x-PF for linux-arm-kernel@lists.infradead.org; Wed, 21 Dec 2016 10:20:15 +0000 Received: from imapserver.systec-electronic.com (unknown [212.185.67.146]) by webbox1416.server-home.net (Postfix) with ESMTPA id 1E8D927A6CB; Wed, 21 Dec 2016 11:19:51 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by imapserver.systec-electronic.com (Postfix) with ESMTP id 097BDDA0A62; Wed, 21 Dec 2016 11:19:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at imapserver.systec-electronic.com Received: from imapserver.systec-electronic.com ([127.0.0.1]) by localhost (imapserver.systec-electronic.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qxAdCzxiPjwb; Wed, 21 Dec 2016 11:19:49 +0100 (CET) Received: from localhost.localdomain (ws-stein.systec.local [192.168.10.118]) by imapserver.systec-electronic.com (Postfix) with ESMTP id 8BE7EDA0A5A; Wed, 21 Dec 2016 11:19:46 +0100 (CET) From: Alexander Stein To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Will Deacon , Mark Rutland , Russell King Subject: [PATCH 2/3] drivers/perf: arm_pmu: add arm_pmu_device_remove Date: Wed, 21 Dec 2016 11:19:34 +0100 Message-Id: <20161221101935.17178-3-alexander.stein@systec-electronic.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161221101935.17178-1-alexander.stein@systec-electronic.com> References: <20161221101935.17178-1-alexander.stein@systec-electronic.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161221_022014_129463_E7A1E472 X-CRM114-Status: UNSURE ( 8.19 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 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, Alexander Stein MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add ARM PMU removal function. This will be required by perf event drivers when option DEBUG_TEST_DRIVER_REMOVE is enabled. Signed-off-by: Alexander Stein --- drivers/perf/arm_pmu.c | 14 ++++++++++++++ include/linux/perf/arm_pmu.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index a9bbdbf..b7ddc4c 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -1022,6 +1022,7 @@ int arm_pmu_device_probe(struct platform_device *pdev, armpmu_init(pmu); pmu->plat_device = pdev; + platform_set_drvdata(pdev, pmu); if (node && (of_id = of_match_node(of_table, pdev->dev.of_node))) { init_fn = of_id->data; @@ -1073,6 +1074,19 @@ int arm_pmu_device_probe(struct platform_device *pdev, return ret; } +int arm_pmu_device_remove(struct platform_device *pdev) +{ + struct arm_pmu *pmu = platform_get_drvdata(pdev); + + __oprofile_cpu_pmu = NULL; + + perf_pmu_unregister(&pmu->pmu); + + cpu_pmu_destroy(pmu); + + return 0; +} + static int arm_pmu_hp_init(void) { int ret; diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index 8462da2..8106f27 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -159,6 +159,8 @@ struct pmu_probe_info { int arm_pmu_device_probe(struct platform_device *pdev, const struct of_device_id *of_table, const struct pmu_probe_info *probe_table); +int arm_pmu_device_remove(struct platform_device *pdev); + #define ARMV8_PMU_PDEV_NAME "armv8-pmu"