From patchwork Tue Nov 19 05:18:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 179724 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp183451ilf; Mon, 18 Nov 2019 22:05:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxE3zd0fnnmou9WCZznZw7rDO//oRrlDQjCMSnVuf4FR/blGxWO2UkXbSFeEhDXKRWIF+K6 X-Received: by 2002:a17:906:698b:: with SMTP id i11mr31805623ejr.97.1574143524989; Mon, 18 Nov 2019 22:05:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574143524; cv=none; d=google.com; s=arc-20160816; b=f/HZ9H34EhbwJ32HWiZrFnSWvZ7qgw6x4HY5VVbLuzjGXAMkR5ojd12ns/nVncxByB gv8nFf6ReKv3wOJZHQ/x0kj5LYGijfJywuvdPUQO4sLO0es8Q2aYfusAdU5YCJzR8HKD Lfb7x6sme6G+pNPa0SSj6zxdz0Afar2IKbSWxDnC0488Z0ECfPy7nBe97FfshFxDCFqI 80Z+PUynn8rKSsLGulsEPHtyLCzp9iFtGsvNxxrj0mr/K5gEoAM27ICt6kC4V4axILsP i/TWXww+WKw9kPsLho3mwzrlMsol1Wkj0O1XsZGZSk0ExiFfd8jVcsjufLfZxVqeDXaQ pQQw== 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=QHgIoyyb7S14PcA4VWagcgVFrcUh/0DE7tlaqstVPh8=; b=MQsmr5QNm/m+iCMHQUOJYB9Kr77Y2LrxETckye1/3P0GIiPR01M6atr6HCPM2Or9u4 GsDzLWYrI7v5MBc9p8rhqf9K8YW6XcbHnTa9BoJZ75yVvzQB5rG+TyI1ClZddmOtCXwN RcUCgJT7KRobLiJowuwJfEsFP4qznsi8nrN+kmWjsH1fdVoqOJHfwklzG3M4s4T36Dts mOskf2+M5iGvqgBVAw1Td7cU2FVGt744in6wfqJPuHIgk7IO+rw8yG5FarofmwdnWWDg rlbkPEM7RncljHiMC+mRxb/MBxJgit6b+z6Rbpr8vOn3vFUb8Nan2UosKJplzTry9ELX DtNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LVlnRRYT; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r2si12936942ejz.12.2019.11.18.22.05.24; Mon, 18 Nov 2019 22:05:24 -0800 (PST) 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=LVlnRRYT; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730003AbfKSFgv (ORCPT + 26 others); Tue, 19 Nov 2019 00:36:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:58262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729018AbfKSFgr (ORCPT ); Tue, 19 Nov 2019 00:36:47 -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 47893206EC; Tue, 19 Nov 2019 05:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574141806; bh=1WDmaeQnzHdPuKnUb+DOjRMz6dZ0mYdB0EDJCkGbeH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LVlnRRYTehan28yD6I88C3EDkxN8A4kpzVMRkLzBgPs/UO0Q2QeRy8KmSpzfMO3vl tIKumO+bCvNKNUmRxtHE2MpXVy/DcpZx+b8SFNTB9Vr6rPBDVl+GYs1QGSIkPwV/4V ebN0Hsofu1dtcgU0jXPRbswGob8G8tmXXyGG72mA= 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.19 287/422] usb: chipidea: Fix otg event handler Date: Tue, 19 Nov 2019 06:18:04 +0100 Message-Id: <20191119051417.584670547@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051400.261610025@linuxfoundation.org> References: <20191119051400.261610025@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 db4ceffcf2a61..f25d4827fd49c 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -203,14 +203,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);