From patchwork Tue Aug 21 13:55:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10571707 X-Patchwork-Delegate: agross@codeaurora.org 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 D608D13B6 for ; Tue, 21 Aug 2018 13:56:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7E302A35E for ; Tue, 21 Aug 2018 13:56:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C62BF2A390; Tue, 21 Aug 2018 13:56:06 +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=ham 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 7F9D22A35E for ; Tue, 21 Aug 2018 13:56:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727357AbeHURQU (ORCPT ); Tue, 21 Aug 2018 13:16:20 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:54907 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727346AbeHURQU (ORCPT ); Tue, 21 Aug 2018 13:16:20 -0400 Received: by mail-wm0-f68.google.com with SMTP id c14-v6so3023159wmb.4 for ; Tue, 21 Aug 2018 06:56:04 -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=BUph3hiZ4V2ZG+wCVMKvEWc9ax1VLC2ty6Rm5d8QiGc=; b=YaYF/GBpEDKs9QiQ2BmGdxqFdxlUmsQS+Tr7MHEpfWIP0Ke0ZECC/0Kf0hmA1QgNdQ al41hdCS894To9nqvqIG8gZS5FFZzk3RlbgWNhNYBU5bathxAXOLdYi+UOSMF8lJSBNv nyA/c6dJSQ2/icWjtEK/ACXekKvkL6vfrDDWw= 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=BUph3hiZ4V2ZG+wCVMKvEWc9ax1VLC2ty6Rm5d8QiGc=; b=SXOiVoWMME2HZzCP0wngCZT+G09R7NsSPBz1c1RrAelm6ruAc39ve2WL3h7wbKvQsS fvcP6sc/Xy0woPkzyBs9HKTfgT3uRwRtg8v1M9bW8QTTmvfk0ucMmvKG4/v84rjwz5aS m95Qpb9vb+955FnnHW1VQ72bZqsfJWm+GS0OsIkF6OLKPFBIl4sghTN1l9Rhs8CbtV3Y X+d40zc9pnxebDvIUtuP0JAw5y0WyVVDEJ5uaGNtK9I5d6XJT7QiK07dqBtWPYPM3Nfe 9hQN3qfOJtc572mPWf0cRhfP6noskzA+/wcp7b4FnAmXq/IPDuv9syotjMKLm2YYxFCw gzIw== X-Gm-Message-State: AOUpUlG3BpZDltre+C6YMUfTPdMuoKXNQBbcptrsxf9EQVT2MgDA+cjr JAHzLFJ85LVzeX38PRRu1ZUIBg== X-Google-Smtp-Source: AA+uWPwGvt9j6tJt35/GZqSolWUTqieD/9+cFovYYL0AxLJL65VdyjrVKiy7h6AFD1+kRUyxmXefmw== X-Received: by 2002:a1c:64d5:: with SMTP id y204-v6mr28114037wmb.14.1534859764345; Tue, 21 Aug 2018 06:56:04 -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 l24-v6sm16728523wrb.65.2018.08.21.06.56.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Aug 2018 06:56:03 -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, Loic Poulain Subject: [PATCH 4/6] usb: chipidea: Fix otg event handler Date: Tue, 21 Aug 2018 15:55:54 +0200 Message-Id: <1534859756-6955-4-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534859756-6955-1-git-send-email-loic.poulain@linaro.org> References: <1534859756-6955-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 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 --- 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);