Received: by 10.213.65.68 with SMTP id h4csp39927imn; Mon, 19 Mar 2018 18:51:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELudBJuPBQC0x7l4LL7pEHec49pVcJwWnMnxpJLCEBekNcm5V3y3bsbxG9WXVzs1tyWKFy1l X-Received: by 10.101.98.85 with SMTP id q21mr10421001pgv.182.1521510687136; Mon, 19 Mar 2018 18:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521510687; cv=none; d=google.com; s=arc-20160816; b=n4KtxN8SeRpN2Jn9fxOO55iMzIXoTxo8mxiEpoTfVnTyPlUBIvHGLJAUXNaK6Iz+w7 zUeRqStZnuFatMziMg0YrO8wBgLkL+2Bypp8Z1LqxGbpgkp6sbZSMs/i74WYynl+SFU5 gc8h73ipYZ9RBfdFA8b5L4qXBlTaD5tk7Gtfq1avjasViM41kZyBljB6jMCGkB5lweJ5 tSvbW0AWO8gTtVRAStrB/c08wu9ECSLfMsR8sOWxivdAkXGboz1XaJmsEKRKd35HjH7m 9S6xDEZ8FankCKcz5piCOwN/uJZRFbQV/or7q3ZDIAVBw+QdpaW0cXWiUJ1sZoYsGtAP 3TiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=aoDNvGd3miw86H1uZNsTvg5cEHSCKn972IIMbznw6d4=; b=aGgff3dHqb/8yTDdJev5UUTGQh/XZOqJRZtRIrXZsxjbTG+S9d96jc2Tf2ZcyY2veV KNxiL8CRK6i8ROX10cxGd0pKQhHkiN1VWH9LQumhvNP40JN7s4MO6rom4IXX67jC2aes MP/b3oXKbas0lI1Z1OBmCAKqjtqRL/Fnh3bUQFqIk1fW8PW6c8IYrUkuVJHN6L+BOSEr VRt+g9wQ59h9wPbbyV2LxjwbF3wf9HH4CchjAOnA24WFQtEZTTyKciv+mxSc/9QoEa/y k+ijaVgNie7I8O1HA5PxwSVbnCEnzGdZQ7Ji3meg8wEaKT0LgfUMSWC8815/CZ1JIhpA 7Tkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h127si408446pgc.238.2018.03.19.18.51.13; Mon, 19 Mar 2018 18:51:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031370AbeCSUVA (ORCPT + 99 others); Mon, 19 Mar 2018 16:21:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44386 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030558AbeCSSO4 (ORCPT ); Mon, 19 Mar 2018 14:14:56 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 73136F40; Mon, 19 Mar 2018 18:14:55 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Jeremy Linton , Will Deacon , Sasha Levin Subject: [PATCH 4.4 070/134] drivers/perf: arm_pmu: handle no platform_device Date: Mon, 19 Mar 2018 19:05:53 +0100 Message-Id: <20180319171859.341765752@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mark Rutland [ Upstream commit 7654137071fa706e5c91f4f27bc2a5cd7e435a9b ] In armpmu_dispatch_irq() we look at arm_pmu::plat_device to acquire platdata, so that we can defer to platform-specific IRQ handling, required on some 32-bit parts. With the advent of ACPI we won't always have a platform_device, and so we must avoid trying to dereference fields from it. This patch fixes up armpmu_dispatch_irq() to avoid doing so, introducing a new armpmu_get_platdata() helper. Signed-off-by: Mark Rutland Tested-by: Jeremy Linton Cc: Will Deacon Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/perf/arm_pmu.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -321,10 +321,16 @@ validate_group(struct perf_event *event) return 0; } +static struct arm_pmu_platdata *armpmu_get_platdata(struct arm_pmu *armpmu) +{ + struct platform_device *pdev = armpmu->plat_device; + + return pdev ? dev_get_platdata(&pdev->dev) : NULL; +} + static irqreturn_t armpmu_dispatch_irq(int irq, void *dev) { struct arm_pmu *armpmu; - struct platform_device *plat_device; struct arm_pmu_platdata *plat; int ret; u64 start_clock, finish_clock; @@ -336,8 +342,8 @@ static irqreturn_t armpmu_dispatch_irq(i * dereference. */ armpmu = *(void **)dev; - plat_device = armpmu->plat_device; - plat = dev_get_platdata(&plat_device->dev); + + plat = armpmu_get_platdata(armpmu); start_clock = sched_clock(); if (plat && plat->handle_irq)