From patchwork Tue Sep 4 15:18:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10587497 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 5DF5B14BD for ; Tue, 4 Sep 2018 15:19:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F05F29BE1 for ; Tue, 4 Sep 2018 15:19:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D4EE29C83; Tue, 4 Sep 2018 15:19:10 +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 F04C429BE1 for ; Tue, 4 Sep 2018 15:19:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727620AbeIDTol (ORCPT ); Tue, 4 Sep 2018 15:44:41 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:53919 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727220AbeIDTol (ORCPT ); Tue, 4 Sep 2018 15:44:41 -0400 Received: by mail-wm0-f65.google.com with SMTP id b19-v6so4872357wme.3 for ; Tue, 04 Sep 2018 08:19:07 -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=Ie+UuyUnSDYUVvk6e0jmSvyTUxKfj3biwa8t/QSCAiY=; b=RMHttoOjLJnK/rpqgyhXWZKY2L7lwvSApNxb0eKaEyCOG75Dy2tGsmKARwCniiKApS Tze+au1ADXAI8xwxtA2S1vo9pNFEMy9GE1SEIeYt5yJR4MlaETolVl40efOFf7xuQNiC bz7ltheHoqFcfv6qQRhUWXL0cCTekztjCnowY= 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=Ie+UuyUnSDYUVvk6e0jmSvyTUxKfj3biwa8t/QSCAiY=; b=ptK8xSBd0uFiDcEkD4BaIxdw9CWKl0cgpWT1Esm0C0/vXQIkHDh9oV70bgqOFBXCnY Gtjp6ulZh/3Bbh8eAit+09QqlxNRgYB+70YVHTz1gThfiACRwiN/c3DIO0VexVEUeWzz k/gubCT3JXHjcvgB1Eyy8dZhJxB6EWEzq+AKLlZhf7UV5l5+o+EAI+H3vyFH0MOlkMQM UE5ci7iLn9JuRNDhETGCpg+98KRD5m48IrrLl4OTKqPvPgd3vZeLUGXf7cChS7o2qclr IDokmw0QoxMHbGb5P2pRTqysMRjuJEbXuAewQp9k6oGZ1H+jPpX6bbq7u3Sz9MtW6it9 FQJA== X-Gm-Message-State: APzg51CGj9vQKsSsvdCHCCLEnXAFdzpSXBaC9iBD0lFBaZnn6pCu6oFl c23JiPMl0HOP8FoYNkcqzQ94eQ== X-Google-Smtp-Source: ANB0VdZw/SSz6Q6zU/uFmi43EWFFd/w/L3Yz2Zfgw3628VSkJ2dUYkEiDqdJCqfo+MbDjdP5+yoqEQ== X-Received: by 2002:a1c:f11a:: with SMTP id p26-v6mr8780741wmh.92.1536074347009; Tue, 04 Sep 2018 08:19:07 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-654-1-394-222.w90-55.abo.wanadoo.fr. [90.55.193.222]) by smtp.gmail.com with ESMTPSA id l24-v6sm40255033wrb.65.2018.09.04.08.19.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 08:19:06 -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, andy.shevchenko@gmail.com, Loic Poulain Subject: [PATCH v3 3/6] usb: chipidea: Prevent unbalanced IRQ disable Date: Tue, 4 Sep 2018 17:18:57 +0200 Message-Id: <1536074340-14840-3-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> References: <1536074340-14840-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 --- v2: v3: no change 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 */