From patchwork Tue Sep 4 15:18:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10587507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 812FA1669 for ; Tue, 4 Sep 2018 15:19:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7503129C7A for ; Tue, 4 Sep 2018 15:19:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 734DE29C83; Tue, 4 Sep 2018 15:19:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3078729C7A for ; Tue, 4 Sep 2018 15:19:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727635AbeIDTom (ORCPT ); Tue, 4 Sep 2018 15:44:42 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43135 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727613AbeIDTom (ORCPT ); Tue, 4 Sep 2018 15:44:42 -0400 Received: by mail-wr1-f65.google.com with SMTP id k5-v6so4373043wre.10 for ; Tue, 04 Sep 2018 08:19:09 -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=DaoitWn4N4E8MxKe6c9On/izFsNnJ18tWXmCQk3yml4=; b=fa1LNNpXRiUjwIDuNA5uLZ6TgYcZTxhpgDq4ZIE7lYKoik1y+ZYlTXjdgEwblpAiVN 6cAmmsIejoGUQyqAI/6NlFIuccnQ/8ndhU51CkHkyl0rDpqN64cWY/mK/HNDw8z7B2J3 cYFbIT4PeXZCjTnNtIyo4joLyYLfb9RS1obsw= 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=DaoitWn4N4E8MxKe6c9On/izFsNnJ18tWXmCQk3yml4=; b=GksbhGXSmBLFjIgt+ev3y/Dq0l49mP0lDPXra0pAztqQYzCKVge77kPN0L4NtMcg95 8AWsKsu/+y/w8tjDEIpAh9FNKrhqs2CiYLTr5G+6uBxHLmIf6sITA13Yisk2jZVGyUIw Fq4CHQlc1l8GDE9gcrlVhmhRu8yrz6ccBCVWzFv7Z/QRGsv1us3sXnIC532EnSL/WIby Yl1ueESlHUKgsUwanMi+nyXb9tLuO1GmiaxVhcObRw9LDRLUpEzG7LbIhNJGSDp5N97h s3Ipr5fRJTBey5iup0R67XoTEFf1iScuNs45lZ0QM8R6/JamAgkWnOV4XJyGRaLp8GAt pvyg== X-Gm-Message-State: APzg51DVlvqZYewt9BdRKajW0RC2t/1QLE47KkpdYVJ7u2bclsWf/tSy kPBMBdAtUqeIEC3z8tG3kKGH/w== X-Google-Smtp-Source: ANB0VdY+95wNAQpYvuLVkyHHpKvuxHwAp4ABNQoxv5SwgoL7Of96DxzqM5nf+42Xkkxlgwvvw3HjYg== X-Received: by 2002:adf:be81:: with SMTP id i1-v6mr21422160wrh.235.1536074348497; Tue, 04 Sep 2018 08:19:08 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (AToulouse-654-1-394-222.w90-55.abo.wanadoo.fr. [90.55.193.222]) by smtp.gmail.com with ESMTPSA id l24-v6sm40255033wrb.65.2018.09.04.08.19.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 08:19:07 -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 v3 4/6] usb: chipidea: Fix otg event handler Date: Tue, 4 Sep 2018 17:18:58 +0200 Message-Id: <1536074340-14840-4-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> References: <1536074340-14840-1-git-send-email-loic.poulain@linaro.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: v3: no change drivers/usb/chipidea/otg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index db4ceff..f25d482 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);