Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751636AbdFFK55 (ORCPT ); Tue, 6 Jun 2017 06:57:57 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:56226 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751412AbdFFK5z (ORCPT ); Tue, 6 Jun 2017 06:57:55 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 06 Jun 2017 16:27:49 +0530 From: kgunda@codeaurora.org To: Stephen Boyd Cc: Abhijeet Dharmapurikar , Christophe JAILLET , David Collins , Subbaraman Narayanamurthy , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, adharmap@quicinc.com, aghayal@qti.qualcomm.com, linux-arm-msm-owner@vger.kernel.org Subject: Re: [PATCH V1 08/15] spmi: pmic_arb: use appropriate flow handler In-Reply-To: <20170531190310.GF20170@codeaurora.org> References: <1496147943-25822-1-git-send-email-kgunda@codeaurora.org> <1496147943-25822-9-git-send-email-kgunda@codeaurora.org> <20170531190310.GF20170@codeaurora.org> Message-ID: <695b7cf8e5872d3465d05a2eae8f3902@codeaurora.org> User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2286 Lines: 60 On 2017-06-01 00:33, Stephen Boyd wrote: > On 05/30, Kiran Gunda wrote: >> From: Abhijeet Dharmapurikar >> >> The current code uses handle_level_irq flow handler even if the >> trigger type of the interrupt is edge. This can lead to missing >> of an edge transition that happens when the interrupt is being >> handled. The level flow handler masks the interrupt while it is >> being handled, so if an edge transition happens at that time, >> that edge is lost. >> >> Use an edge flow handler for edge type interrupts which ensures >> that the interrupt stays enabled while being handled - at least >> until it triggers at which point the flow handler sets the >> IRQF_PENDING flag and only then masks the interrupt. That >> IRQF_PENDING state indicates an edge transition happened while >> the interrupt was being handled and the handler is called again. >> >> Signed-off-by: Abhijeet Dharmapurikar >> Signed-off-by: Kiran Gunda > > Do we have any edge interrupts in the tree right now? At least > RTC seems to be using edge... This should go back to stable with > a Fixes tag. > Yes. A bunch of internal drivers use edge interrupts. >> --- >> drivers/spmi/spmi-pmic-arb.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/drivers/spmi/spmi-pmic-arb.c >> b/drivers/spmi/spmi-pmic-arb.c >> index 1d23df0..ad34491 100644 >> --- a/drivers/spmi/spmi-pmic-arb.c >> +++ b/drivers/spmi/spmi-pmic-arb.c >> @@ -625,6 +625,12 @@ static int qpnpint_irq_set_type(struct irq_data >> *d, unsigned int flow_type) >> } >> >> qpnpint_spmi_write(d, QPNPINT_REG_SET_TYPE, &type, sizeof(type)); >> + >> + if (flow_type & IRQ_TYPE_EDGE_BOTH) > > IRQ_TYPE_EDGE_BOTH doesn't seem appropriate to use here. We're > really just testing to see if the type is an edge type, not if > it's BOTH edges. > Ok. Agree. Will fix in the follow up patch. >> + irq_set_handler_locked(d, handle_edge_irq); >> + else >> + irq_set_handler_locked(d, handle_level_irq); >> + > > And we already have code that does that check: > > if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) > > so just put the irq_set_handler_locked() calls in those if > statements please. Sure. Will fix in the follow up patch.