Received: by 10.213.65.68 with SMTP id h4csp1754061imn; Mon, 19 Mar 2018 12:19:52 -0700 (PDT) X-Google-Smtp-Source: AG47ELuYpuL8TSRkZMqElcJc53xOAPbXM3h/cxR1atks17BHLDdJ+4uj//4rE6UZbITlYDgV/m3a X-Received: by 2002:a17:902:758c:: with SMTP id j12-v6mr4274775pll.18.1521487192841; Mon, 19 Mar 2018 12:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521487192; cv=none; d=google.com; s=arc-20160816; b=sTHhH38RpXElcDGDD96crf0mc2M8jHG4dqoCa7chh+Fm2KXF7q0U1N1ifnc5/NRvj0 EHb35SjiJYq2ZxjSmapnS2yrGKycu4Q21Ci0FlXpd5wtLMvoCiKJBqwKBEYCkOmm4vbW xvVePThODlM8eZLPDT7u52imclcLHuR6Z8ZjE8lUYiR9YT8NJaybFZp3nHMH9Ng3rKI+ hTBAbnz7TPsyxvekwlyfusIRHl6lXZV6XrYqUr4fB/d38lvBYJMEFDbOF0P2bSIHXvC2 AqGR2fT+5+rRxv8JFxOJ+W6cBFoJC/stqSavm94dlAiwLtpAz/GitDaP1Hli0WPDNMaw LgoQ== 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=qP49o6ULFPUNunwZ3ZjmTdlgrcpV5ACECnFAjoxXeo8=; b=IZLxZwnHttBiK1oldEORFnv4SP3lfh+qxBHEL4ma0gy+yIdKrkbo+pIUUaprulYiGY 0FQoQ5L/qBcamR9B/zSBrVn7L1DAf9uJuSJlJDEBpXhn3tw2aQltbcqu8NZFZGCICIDp 8PSh9rt0isIZ6mLpm4VfP1GplSwmMOidN2HuNm2iHiqsCIr5fOEG5O3FXJI67fY2ogQ5 IxUMiRLdBxeAEw51HJTRPMAHUsM/zRq1UJDngeQR1xYr9hZJiPouyraAytMX8ffrG9FA dH7AEFWs6YF0HBGQ/IiknmoLvmHNEVTa6SEdtImBHJNyL3Q6IP4hz/bY0m6nkiocARyL kcHQ== 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 3-v6si478650pla.678.2018.03.19.12.19.38; Mon, 19 Mar 2018 12:19:52 -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 S969589AbeCSS0G (ORCPT + 99 others); Mon, 19 Mar 2018 14:26:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50590 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969807AbeCSSZz (ORCPT ); Mon, 19 Mar 2018 14:25:55 -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 82B0B100B; Mon, 19 Mar 2018 18:25:54 +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.9 143/241] drivers/perf: arm_pmu: handle no platform_device Date: Mon, 19 Mar 2018 19:06:48 +0100 Message-Id: <20180319180757.110623684@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@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.9-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 @@ -322,10 +322,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; @@ -337,8 +343,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)