From patchwork Fri Nov 22 10:27:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 179963 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp15599ilf; Fri, 22 Nov 2019 02:34:11 -0800 (PST) X-Google-Smtp-Source: APXvYqzBasc7cKu5ZUlUCWvwWC5CkluY7xIPm/R8d1M3cdFEuQnib/7OocC/MyhcVtfZSGof268v X-Received: by 2002:a05:6402:1609:: with SMTP id f9mr188032edv.37.1574418851130; Fri, 22 Nov 2019 02:34:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574418851; cv=none; d=google.com; s=arc-20160816; b=RWvMCQAIwIOmnAo9m5WwV2YO+cIFmwRC9i1i1JJVSTriszipEj50LSV+gKGCMN+9D+ LzWN8BYTg9Tji0m26XGQv17hqTRcY0jKtxalI9hwaTe/7neRV18+++V2szpmARcjfpV4 p6hivdCeV5M1tSxXrJj4+vHnKEJglyqR1Cgdxu0Hat7dRFVt3eAJDsL39ogWNmMqVRkl WZ74+kewtocurB+nTDYYfvvwyxrx6KwatVO/6vFUqCEgrsvVPClvx1xATHYzAv0nyvKO mGg1Xrgq63ohYjtw1KeYDvxoLr/q+Fx75bEyeuzJ9k07ZFEt+x0uRAorLF455lKcjSY2 qD9g== 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=fCpObPVMySLHo/xtFhl63yPEt+RySob77CvT6P+g5NCCbY0iWsNd1xSb3HoWb4paAg G7bSkrFova8bQM1LdXadGGPmWTz/gMG0jZsLYD6GcHfAzYtLL9Cm+BR+0vrkSIT8Czo2 Y6tYudjdxUGODyoMYxszo9xmIE+Y2Mn3XJJ0uueKuJEDCOV9kOD3hDbipULyd++zkqb5 QpqsleM4LxmG0zXcOtc/Zjhda0BxwKSO7TOk8nFYd+vOBGIBSxbJK9P0P7DEhxyh0Na4 p10x2AEdHTf0TIjdwPfwp6U1ZmJxZWqVt/Snyvo0dffbkNiqiJnATrdBjAGUEVkyXE6D 8pWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZiQyoWuw; 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 i26si3770626edy.197.2019.11.22.02.34.10; Fri, 22 Nov 2019 02:34:11 -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=ZiQyoWuw; 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 S1728056AbfKVKeJ (ORCPT + 26 others); Fri, 22 Nov 2019 05:34:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:57934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728036AbfKVKeE (ORCPT ); Fri, 22 Nov 2019 05:34:04 -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 D5E7B20637; Fri, 22 Nov 2019 10:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574418844; bh=/NIyCPyZeLdBwZL2f6/XlX7dwDQA8o09yF4PJxAG3WA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZiQyoWuwMhtktmy0vQqNWwsBOvmoeI1P6DxQVoNrVN6DtWvdGm5eYGwDH6OJHABy9 Z6ny+y0JZDshpKHZ539LNpq/vWWYcjV37zWzrPt5z1TriOwIM4lTNHRAGAsP/JVjy+ PLxGm4RRIk4rCoXaKDqooerOQL7d61rh4vTklcac= 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.4 069/159] usb: chipidea: Fix otg event handler Date: Fri, 22 Nov 2019 11:27:40 +0100 Message-Id: <20191122100755.872467415@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100704.194776704@linuxfoundation.org> References: <20191122100704.194776704@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 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);