From patchwork Tue Aug 21 13:55:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10571703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C554F14BD for ; Tue, 21 Aug 2018 13:56:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B69702A39D for ; Tue, 21 Aug 2018 13:56:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4B042A385; Tue, 21 Aug 2018 13:56:05 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 66A172A386 for ; Tue, 21 Aug 2018 13:56:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727345AbeHURQT (ORCPT ); Tue, 21 Aug 2018 13:16:19 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:43771 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727252AbeHURQS (ORCPT ); Tue, 21 Aug 2018 13:16:18 -0400 Received: by mail-wr1-f66.google.com with SMTP id k5-v6so4411707wre.10 for ; Tue, 21 Aug 2018 06:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K+768cvU4pPkRaQ3YhlP5lEiMFUDD4Pvl2Aw6Stu7VM=; b=aV4isIV01NCTUOo6lJhKgs30jUfcFF3l/qpAEyM49F48jfqvWCfTmU8gZmHLTWkwdz V1IXZoSNK2KngMx0OwWYclZCROMzyfim8waLfH+vxKyqu59zYH2BcjzHSKWfjFnkz4UT avvxY2ZMyM6baGcvj8yzI3mvlOuzRUS872nzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K+768cvU4pPkRaQ3YhlP5lEiMFUDD4Pvl2Aw6Stu7VM=; b=OG4MRRdNwJybLFnD8nprYy/u43/oxdcaab1LtyxMyAwSoApRp+yL0sjz5RuCMzVZqB uxjPfH7avSJu8RZdv58WVttD1YZm9CcZF+TFt1kSmYaRAdRTd4/TWkVnf3Lc0Sjr0P+w Nd2F6ztcNvK938UAA/CL0AQ8as2L0ErarFahg8cWk6pANnmbJMP4iaw2dOQ+CTpQRQPn 6Np0xkRRH4nvbE1FFSoLA0UcGTIPHVjHjOZScD4QWgk02IKAWNLYRnTE/UI+kf9gKt5J 5QnuhY0TvIsMugm5hSRX993QaVq8V8Sq4QD1/fwAmCIb6IZvZt0BIENWDLDkZ2R1jjtL nsfw== X-Gm-Message-State: APzg51Cido8XaqbrGNRTKtqA8/fC5LvuWe5oQqxoKzrCmihaOXa+KzMl sz6RIgguRJyUYq47U+YlDIxEVw== X-Google-Smtp-Source: ANB0VdaVXwid/Kyho2nyvo4eVJR+izDT0k1NOORRcj+DdEzIkdTEiSbdDuahpRJfmYpbeOvjPfNbEQ== X-Received: by 2002:a5d:4fc3:: with SMTP id h3-v6mr3183393wrw.261.1534859762734; Tue, 21 Aug 2018 06:56:02 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id l24-v6sm16728523wrb.65.2018.08.21.06.56.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Aug 2018 06:56:02 -0700 (PDT) From: Loic Poulain To: Peter.Chen@nxp.com Cc: linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, david.brown@linaro.org, robh+dt@kernel.org, bjorn.andersson@linaro.org, andy.gross@linaro.org, Loic Poulain Subject: [PATCH 3/6] usb: chipidea: Prevent unbalanced IRQ disable Date: Tue, 21 Aug 2018 15:55:53 +0200 Message-Id: <1534859756-6955-3-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534859756-6955-1-git-send-email-loic.poulain@linaro.org> References: <1534859756-6955-1-git-send-email-loic.poulain@linaro.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ChipIdea IRQ is disabled before scheduling the otg work and re-enabled on otg work completion. However if the job is already scheduled we have to undo the effect of disable_irq int order to balance the IRQ disable-depth value. Fixes: be6b0c1bd0be ("usb: chipidea: using one inline function to cover queue work operations") Signed-off-by: Loic Poulain --- drivers/usb/chipidea/otg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/otg.h b/drivers/usb/chipidea/otg.h index 7e7428e..4f8b817 100644 --- a/drivers/usb/chipidea/otg.h +++ b/drivers/usb/chipidea/otg.h @@ -17,7 +17,8 @@ void ci_handle_vbus_change(struct ci_hdrc *ci); static inline void ci_otg_queue_work(struct ci_hdrc *ci) { disable_irq_nosync(ci->irq); - queue_work(ci->wq, &ci->work); + if (queue_work(ci->wq, &ci->work) == false) + enable_irq(ci->irq); } #endif /* __DRIVERS_USB_CHIPIDEA_OTG_H */