From patchwork Fri Nov 22 10:27:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 179972 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp25531ilf; Fri, 22 Nov 2019 02:43:14 -0800 (PST) X-Google-Smtp-Source: APXvYqzYlySM2Hikq1Ahc1mtfvzN7IA8ZZ0DZ1juv7MT4w9OsFfjGg+wnN5PPOUIVo89aIsBrzRr X-Received: by 2002:a17:907:38e:: with SMTP id ss14mr20869937ejb.319.1574419394714; Fri, 22 Nov 2019 02:43:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574419394; cv=none; d=google.com; s=arc-20160816; b=ZP9tnBtgQZzgmoZ/UAt0BSf4mQu5gQPzh6XJZWuAzq8cP5xfvhDO0p0knVSalAmwpc WaLFv6oQZnARhFe49qbDaPrOnXa0HCUqAocUU+xJRd8uOQIrG/3H9ovOfrwx06ORlhhP SUO2yX1qdAnDwEdRiIKGEBr8WkwQtOjbkNrgL9Cc7viG6ONXzxzP4IWDuf947NSecBY8 /z3UkXnAgcHivFXN2T+h9CbzZbJz+kZxTh3DOMVLVNs78ND4HS/QLIvflLzXqbml2lSc SNPriOdh0aKxsSFx63ikyCb4Klylm1qz6dYYvWDFPRn7ycJPHrL0FkjB5Lnqp+8WX5b5 bFTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gqRiU45m22ZMfdkqYLZ/w0FV0gxWuYTtqQKBWzo3hz0=; b=HHnpwFMDa4oUyVCjt+JWDHKPQMH5e+ULzPkupGzbHajJKUL5jFcpEIK5DfvAGsLDwS zOWTiKLbYyzKZFcZIPQppi9F4/lBc4DJsI2blcdxz+QbmCU8RxxrmcS1OUIjyT3qTTA5 BBV1Z3gFGf7QYPf8rLqYuzue6eo39wGFO/7QMVW3TttuPqFX8+Yn0DOTul/+DWHryf5k TNfhYz4twFsebtXkhVkL4dp3Kovj+Snl3kbTWEVIHy2EKkMDJdKFoOuL/WPRtTHiXvhy ROfeXEPYjKcuAh+liHc/D/A4Bo23P31on8b8U8ipBg5gUMRg/cXxRBDW8YdglcFhAL1M 4gUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2pydndon; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c44si4483830ede.398.2019.11.22.02.43.14; Fri, 22 Nov 2019 02:43:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=2pydndon; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729192AbfKVKnN (ORCPT + 15 others); Fri, 22 Nov 2019 05:43:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:48672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728031AbfKVKnJ (ORCPT ); Fri, 22 Nov 2019 05:43:09 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A6A6D20637; Fri, 22 Nov 2019 10:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574419389; bh=/NIyCPyZeLdBwZL2f6/XlX7dwDQA8o09yF4PJxAG3WA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2pydndonjjVUX4nzh3zAsRHTma9XSxTXgCwCkjkSUas9/q0jj3w0nrwOBMSofU/rM pub70Fs5KaZDFOAfQmuZ66hPrTGQNWhHeS5OVSULa0kcN2TVAd8fru2o+3sBm/qjVU VhW2Hh3TZ8PIWLrKqwAO4WrQmYyCTSF9trcvupbQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Loic Poulain , Peter Chen , Sasha Levin Subject: [PATCH 4.9 095/222] usb: chipidea: Fix otg event handler Date: Fri, 22 Nov 2019 11:27:15 +0100 Message-Id: <20191122100910.315599583@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100830.874290814@linuxfoundation.org> References: <20191122100830.874290814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Loic Poulain [ Upstream commit 59739131e0ca06db7560f9073fff2fb83f6bc2a5 ] At OTG work running time, it's possible that several events need to be addressed (e.g. ID and VBUS events). The current implementation handles only one event at a time which leads to ignoring the other one. Fix it. Signed-off-by: Loic Poulain Signed-off-by: Peter Chen Signed-off-by: Sasha Levin --- drivers/usb/chipidea/otg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index f36a1ac3bfbdf..b8650210be0f7 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -206,14 +206,17 @@ static void ci_otg_work(struct work_struct *work) } pm_runtime_get_sync(ci->dev); + if (ci->id_event) { ci->id_event = false; ci_handle_id_switch(ci); - } else if (ci->b_sess_valid_event) { + } + + if (ci->b_sess_valid_event) { ci->b_sess_valid_event = false; ci_handle_vbus_change(ci); - } else - dev_err(ci->dev, "unexpected event occurs at %s\n", __func__); + } + pm_runtime_put_sync(ci->dev); enable_irq(ci->irq);