From patchwork Mon Aug 27 09:33:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 145166 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3975661ljw; Mon, 27 Aug 2018 02:33:49 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZOV9AFnbt4N1LWfOigQ18hT+D0qgPdsXCWrdsep6ov4g7LPqG3i7h+Eh9LdOuF7TP3491K X-Received: by 2002:a17:902:3081:: with SMTP id v1-v6mr12543997plb.58.1535362429208; Mon, 27 Aug 2018 02:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535362429; cv=none; d=google.com; s=arc-20160816; b=BfFOin/ImPyj/EXIHcGh/pF3zNk+LifiQ5UuXF/sZjrC52oRTsqhd/PZ6VybbsiFB7 QePVDRkfRnTIQsbCtTIhWu2ckaI/5QO3LBVI4SUOVlnPom3Tqc2EmbYTOp4IDqKEE315 VABis2qMIyFLS7UV2+rhg127ausPkJn7zFbUVv3KkldiypbsqqerWLyIuN9Zdr2ge+xT aS7+ChcjYBv5FCPRpE4vPC/qaxwk8wUYw6QBfleI9pU1ticcJAOnJgdJIWFXivLxIqV5 Hf2GUSxHx7NHkiQsNCvmlBAAirCQsqQkB1YpztbTa7OhBIjGUru5gGb3zUe+jXeEr+XT wOMA== 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:arc-authentication-results; bh=KMRezuJX1BEb4nHpMgT72/6xOEnl//0HUPcftOfNpT4=; b=VowfaI1U98VZ1qHUqqdd5EgOMk3tQfmwLeQDPg5IMY8Yu6ElDcPz0tJTczCFif4cO3 sgLxzpOtfutq0qmFq6gjbNOmOswIUQycLojRF1x3pZcLjPIhU2NTkNTroug5+ZtThJMx smarnaDDpCtPIQedZboVPBUaX6IoOiC9glJnPMGiGeGdt9JbWSJ/IlXUYayyHQ2fqqPT BnpSH6m59qjTv2BesIanJBHAjuLJodzGTMa47+ZW5+jorJcLXc+PgQXktL85ApzEIw55 xcRroYHJobbdheK15sT2kQlCFJu/wS122aTo/I06uhJec8RjAezQ+g26r4O6add5cfmj /08w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VO4gYZbF; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 35-v6si13216871pla.453.2018.08.27.02.33.48; Mon, 27 Aug 2018 02:33:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=@linaro.org header.s=google header.b=VO4gYZbF; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727498AbeH0NTj (ORCPT + 13 others); Mon, 27 Aug 2018 09:19:39 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33245 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726953AbeH0NTj (ORCPT ); Mon, 27 Aug 2018 09:19:39 -0400 Received: by mail-wr1-f68.google.com with SMTP id v90-v6so12980834wrc.0 for ; Mon, 27 Aug 2018 02:33:45 -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=KMRezuJX1BEb4nHpMgT72/6xOEnl//0HUPcftOfNpT4=; b=VO4gYZbF0n56KnRRrOfwAZ8emcMueAUtiSaEVbCr9UGPCGuMWD57jn1jqfDoI+tHCj E+jYlPGgkOWNekyvunmrK3ggQE8nBLTPeqgE3Vs3dV35bpEG1MK/rEJyuBdNvWlW0n4B SxLjrHq30tBvCxkx+iC8fUhHY7rQY2UauxFnM= 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=KMRezuJX1BEb4nHpMgT72/6xOEnl//0HUPcftOfNpT4=; b=pFQ+3UxrFxBTCPiIh7tzVFsVSyDAdz/HpQ++l6YdY/1bnO1nMSg/3XHdL96KkL28ce EfEmPigwi+AaOrs5r/fjAju3STH2eRlMwISzO+mdA9l+Yn/T0QACLYgX+VX298hjHUP2 rc3Hl0MYA/jhwIe2kx9VCf6p5pFcQp6Go0BBDx/EEEuAzRpFT/0NUoR52qhy5QMZwWW6 EGTEOLLi3H96hv/wA6MxuYi88rlMOHplB64AywDERyGkeN70fnX+ONVw5U7KYdHzzsgp QH/RWNoBAtt7jZ3dTs+BDHGdawocr8NFCwMNFFHqrSJ+4KWYOjTR4+QNBBHsr5N95Vci eczA== X-Gm-Message-State: APzg51AFb9okRBZX/kYrMOWpHP0nfNw8dZZfD+QD4/rIi050EqZBFFZh q9ct4iZfOHHQ9dZYtokPpOE5XQ== X-Received: by 2002:adf:db11:: with SMTP id s17-v6mr8488372wri.221.1535362424564; Mon, 27 Aug 2018 02:33:44 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-655-1-762-165.w109-220.abo.wanadoo.fr. [109.220.142.165]) by smtp.gmail.com with ESMTPSA id y203-v6sm8022828wmd.1.2018.08.27.02.33.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Aug 2018 02:33:43 -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 v2 5/7] usb: chipidea: Fix otg event handler Date: Mon, 27 Aug 2018 11:33:33 +0200 Message-Id: <1535362415-16559-5-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535362415-16559-1-git-send-email-loic.poulain@linaro.org> References: <1535362415-16559-1-git-send-email-loic.poulain@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- v2: no change drivers/usb/chipidea/otg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index 10236fe..8bf4032 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);