From patchwork Wed Oct 31 23:10:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149905 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp102124ljp; Wed, 31 Oct 2018 16:11:35 -0700 (PDT) X-Google-Smtp-Source: AJdET5euRjpvKwcqhv2fzimuz89WyXS94Duvea8nol5ZwenE6wJqxFdHkGgbQxNZFFHi/eyyWtxB X-Received: by 2002:a62:160c:: with SMTP id 12-v6mr5274770pfw.45.1541027494927; Wed, 31 Oct 2018 16:11:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541027494; cv=none; d=google.com; s=arc-20160816; b=uFU7y3EfpJcfiNFXtzGNt+QtScHzDV9gMZXTKCsclCFhFuJBgLQoDhBNZ+gIMAgxqb VtOCdMDWehPIgKoMUDB3+UrD2Ftg0hjeLL00kg7XYVLUmZf1A7J3mw2pwOb71jWQ+Fav wNz260FiqWx+ocbjJhvLcb5O1znIo4eQjjhJ05QHDrLGyZfFYknUMrZN4x15DvZxFpaM a80mLmFpwElO1peV81yvAPcYZFPPhz5KvJXqRwNL4rhXpHJo4QEwYPkCzYtF9zqhKP3k jbWA4TyBvxaDN/EXI77yCul8Fx+KdhT7kJ2hqQyKJzhTeThFQvNsfX1dqG44SIfv3fTg 4AlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=A1rTQmK1rP5vv4JYcvZrwuri1jehBXkusafKaa1smZI=; b=ujNeUbakb8/nDEnLh8c/xDki2L7TqFP9GgPv4OqxfMJUKI14gL7YOBXXEpU2/Jb032 ZZ0bsgDG5FiZcw0ZY0TbPNZNmip4eFIdAVVwj+z5YPW/IYYSlZoQH7zvqNTW4SQoTep0 mppfe1ezq+LN+sebyJqrB5mQ5jJ5gCsuw6XIGSOujFaXB1rljIv9BmQz/4msulF0zc9W yk56vGqmhTkJSfwGGYobmhYzUYc/k5Ll6XUeyEORc8eBxz7C4u9dzqzhIIMeqVo3P5Aq jNwo34vM1PtxOOHPeR9uRSFVlFZlCgDaNvndRtYsVrDrUyBZl/YlsdcQrFvww5AZ3VLq Q2mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=woVQfJOj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t7-v6si29812686pfb.16.2018.10.31.16.11.34; Wed, 31 Oct 2018 16:11:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=woVQfJOj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731843AbeKAILo (ORCPT + 32 others); Thu, 1 Nov 2018 04:11:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:35716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731786AbeKAILn (ORCPT ); Thu, 1 Nov 2018 04:11:43 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0129520854; Wed, 31 Oct 2018 23:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027491; bh=v47CDGbxOENzAMPOKoeJKAp11j0bzEXJHNMmoo5kuG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=woVQfJOjSE4Wgho3jqho00sJJ7JIityOIFbF1v5J8tRSbC3OLPjG4gfrpzXCWsAqt bHVhulWqe+RK/yza2i8lZ+hN0qadyz1df5DZ8tShpjmtA9URKF6OR48/Sb/RLAGBHb x3oZPDPouH7Dj4cznZ0BiXj/mVvvaQgDBSDNZ/Ws= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Loic Poulain , Peter Chen , Sasha Levin Subject: [PATCH AUTOSEL 4.9 42/48] usb: chipidea: Prevent unbalanced IRQ disable Date: Wed, 31 Oct 2018 19:10:48 -0400 Message-Id: <20181031231054.29333-42-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031231054.29333-1-sashal@kernel.org> References: <20181031231054.29333-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Loic Poulain [ Upstream commit 8b97d73c4d72a2abf58f8e49062a7ee1e5f1334e ] 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 Signed-off-by: Peter Chen Signed-off-by: Sasha Levin --- drivers/usb/chipidea/otg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/usb/chipidea/otg.h b/drivers/usb/chipidea/otg.h index 9ecb598e48f0..a5557c70034a 100644 --- a/drivers/usb/chipidea/otg.h +++ b/drivers/usb/chipidea/otg.h @@ -20,7 +20,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 */