From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754581AbcISJUE (ORCPT ); Mon, 19 Sep 2016 05:20:04 -0400 Received: from foss.arm.com ([217.140.101.70]:56980 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751129AbcISJT4 (ORCPT ); Mon, 19 Sep 2016 05:19:56 -0400 Subject: Re: [PATCH] genirq: Skip chained interrupt trigger configuration if type is IRQ_TYPE_NONE To: Thomas Gleixner References: <1474274967-15984-1-git-send-email-marc.zyngier@arm.com> Cc: linux-kernel@vger.kernel.org, Geert Uytterhoeven From: Marc Zyngier Organization: ARM Ltd Message-ID: <57DFADB9.4080806@arm.com> Date: Mon, 19 Sep 2016 10:19:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/09/16 10:12, Thomas Gleixner wrote: > On Mon, 19 Sep 2016, Marc Zyngier wrote: >> There is no point in trying to configure the trigger of a chained >> interrupt if no trigger information has been configured. At best >> this is ignored, and at the worse this confuses the underlying >> irqchip (which is likely not to handle such a thing), and >> unnecessarily alarms the user. >> >> Only apply the configuration if type is not IRQ_TYPE_NONE. >> >> Reported-by: Geert Uytterhoeven >> Fixes: 1e12c4a9393b ("genirq: Correctly configure the trigger on chained interrupts") >> Link: https://lkml.kernel.org/r/CAMuHMdVW1eTn20=EtYcJ8hkVwohaSuH_yQXrY2MGBEvZ8fpFOg@mail.gmail.com >> Signed-off-by: Marc Zyngier >> --- >> kernel/irq/chip.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c >> index 6373890..26ba565 100644 >> --- a/kernel/irq/chip.c >> +++ b/kernel/irq/chip.c >> @@ -820,6 +820,8 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle, >> desc->name = name; >> >> if (handle != handle_bad_irq && is_chained) { >> + unsigned int type = irqd_get_trigger_type(&desc->irq_data); >> + >> /* >> * We're about to start this interrupt immediately, >> * hence the need to set the trigger configuration. >> @@ -828,8 +830,10 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle, >> * chained interrupt. Reset it immediately because we >> * do know better. >> */ >> - __irq_set_trigger(desc, irqd_get_trigger_type(&desc->irq_data)); >> - desc->handle_irq = handle; >> + if (type != IRQ_TYPE_NONE) { >> + __irq_set_trigger(desc, type); >> + desc->handle_irq = handle; > > Are you really sure that the handler should only be set when the trigger > type is != NONE? I seriously doubt that this is correct. The handler has already been set outside of if() statement (at line 819). Here, we only set it again if we've actually called __irq_set_trigger() which could have changed it to something that takes the type into account (handle_level_irq or handle_edge_irq, for example). Thanks, M. -- Jazz is not dead. It just smells funny...