From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753773AbdE0IQu (ORCPT ); Sat, 27 May 2017 04:16:50 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:43565 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751411AbdE0IQs (ORCPT ); Sat, 27 May 2017 04:16:48 -0400 Date: Sat, 27 May 2017 10:16:37 +0200 (CEST) From: Thomas Gleixner To: jeffy cc: LKML , briannorris@chromium.org, dianders@chromium.org, tfiga@chromium.org, Johannes Berg Subject: Re: [PATCH] genirq: Check irq disabled & masked states in irq_shutdown In-Reply-To: <592905F7.4010803@rock-chips.com> Message-ID: References: <1495804658-12410-1-git-send-email-jeffy.chen@rock-chips.com> <592905F7.4010803@rock-chips.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 27 May 2017, jeffy wrote: > On 05/26/2017 09:20 PM, Thomas Gleixner wrote: > > On Fri, 26 May 2017, Jeffy Chen wrote: > > > > > If irq is already disabled and masked, we would hit a unbalanced irq > > > shutdown/disable/mask when freeing it. > > > > Errr? What exactly is unbalanced? None of the called functions has any > > counter or whatever. > > > > Can you please explain what you are trying to fix? > > sorry, i'll try to rewrite the commit message. > > for example when a driver(drivers/net/wireless/marvell/mwifiex/main.c) try to > do these: > > devm_request_irq->irq_startup->irq_enable > disable_irq <-- disabled and masked > devm_free_irq->irq_shutdown <-- disable it again This driver is broken as hell. It requests the interrupt _BEFORE_ the whole thing is initialized. If there is a pending interrupt on that line, it will explode nicely before it is able to disable the irq. But that's a different problem. Thanks, tglx