From patchwork Wed Aug 23 12:46:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiran Gunda X-Patchwork-Id: 9917315 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 89752603FA for ; Wed, 23 Aug 2017 12:46:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C3F228926 for ; Wed, 23 Aug 2017 12:46:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70F132893D; Wed, 23 Aug 2017 12:46:43 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0710828926 for ; Wed, 23 Aug 2017 12:46:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753986AbdHWMqm (ORCPT ); Wed, 23 Aug 2017 08:46:42 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:43068 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753953AbdHWMql (ORCPT ); Wed, 23 Aug 2017 08:46:41 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id DA70B60115; Wed, 23 Aug 2017 12:46:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1503492400; bh=g2kg2mnsmOm/j5xv8bIkTIWXZWL8OZrQc6cp3pwjJHs=; h=From:To:Cc:Subject:Date:From; b=Mj1blGlptiwXimDuWyfcV/ftsN833ctu3kGuDF5uMA9bbuIjsoto9dwXmOvFz6rAf pWdNmrUnUVfi9pRKacFDXZvO2nbAciMnd2u2yD1KlRjgk0e6lGNVi0dCsSkH2xl1GI nd4wSxTRet3HJZJf3M13klru66Ufxaci1CgZqlx0= Received: from kgunda-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kgunda@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8A663603D2; Wed, 23 Aug 2017 12:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1503492400; bh=g2kg2mnsmOm/j5xv8bIkTIWXZWL8OZrQc6cp3pwjJHs=; h=From:To:Cc:Subject:Date:From; b=Mj1blGlptiwXimDuWyfcV/ftsN833ctu3kGuDF5uMA9bbuIjsoto9dwXmOvFz6rAf pWdNmrUnUVfi9pRKacFDXZvO2nbAciMnd2u2yD1KlRjgk0e6lGNVi0dCsSkH2xl1GI nd4wSxTRet3HJZJf3M13klru66Ufxaci1CgZqlx0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8A663603D2 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kgunda@codeaurora.org From: Kiran Gunda To: gregkh@linuxfoundation.org, sboyd@codeaurora.org, Kiran Gunda , Abhijeet Dharmapurikar , David Collins , linux-kernel@vger.kernel.org Cc: shawnguo@kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-msm-owner@vger.kernel.org Subject: [PATCH V2] spmi: pmic-arb: Move the ownership check to irq_chip callback Date: Wed, 23 Aug 2017 18:16:26 +0530 Message-Id: <1503492387-6226-1-git-send-email-kgunda@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Check the irq ownership in the irq_request_resources callback instead of checking it during the irq mapping. This can prevent installing the flow handler for the interrupt that is not owned by the EE and allow the irq translation during the gpio driver probe. Signed-off-by: Kiran Gunda Reviewed-by: Stephen Boyd --- V2: Fixed commit message. V1: This patch depends on the below patch series. Please take this patch along with this series. drivers/spmi/spmi-pmic-arb.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index ca9bdd3..360b821 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -666,6 +666,24 @@ static int qpnpint_get_irqchip_state(struct irq_data *d, return 0; } +static int qpnpint_irq_request_resources(struct irq_data *d) +{ + struct spmi_pmic_arb *pmic_arb = irq_data_get_irq_chip_data(d); + u16 periph = hwirq_to_per(d->hwirq); + u16 apid = hwirq_to_apid(d->hwirq); + u16 sid = hwirq_to_sid(d->hwirq); + u16 irq = hwirq_to_irq(d->hwirq); + + if (pmic_arb->apid_data[apid].irq_ee != pmic_arb->ee) { + dev_err(&pmic_arb->spmic->dev, "failed to xlate sid = %#x, periph = %#x, irq = %u: ee=%u but owner=%u\n", + sid, periph, irq, pmic_arb->ee, + pmic_arb->apid_data[apid].irq_ee); + return -ENODEV; + } + + return 0; +} + static struct irq_chip pmic_arb_irqchip = { .name = "pmic_arb", .irq_ack = qpnpint_irq_ack, @@ -674,6 +692,7 @@ static int qpnpint_get_irqchip_state(struct irq_data *d, .irq_set_type = qpnpint_irq_set_type, .irq_set_wake = qpnpint_irq_set_wake, .irq_get_irqchip_state = qpnpint_get_irqchip_state, + .irq_request_resources = qpnpint_irq_request_resources, .flags = IRQCHIP_MASK_ON_SUSPEND, }; @@ -707,13 +726,6 @@ static int qpnpint_irq_domain_dt_translate(struct irq_domain *d, } apid = rc; - if (pmic_arb->apid_data[apid].irq_ee != pmic_arb->ee) { - dev_err(&pmic_arb->spmic->dev, "failed to xlate sid = %#x, periph = %#x, irq = %u: ee=%u but owner=%u\n", - intspec[0], intspec[1], intspec[2], pmic_arb->ee, - pmic_arb->apid_data[apid].irq_ee); - return -ENODEV; - } - /* Keep track of {max,min}_apid for bounding search during interrupt */ if (apid > pmic_arb->max_apid) pmic_arb->max_apid = apid;