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: 10571709 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 6BCF01579 for ; Tue, 21 Aug 2018 13:56:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D5F92A3AF for ; Tue, 21 Aug 2018 13:56:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49C7B2A3AE; Tue, 21 Aug 2018 13:56:07 +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 0A6602A38F for ; Tue, 21 Aug 2018 13:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727362AbeHURQU (ORCPT ); Tue, 21 Aug 2018 13:16:20 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:51077 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727322AbeHURQU (ORCPT ); Tue, 21 Aug 2018 13:16:20 -0400 Received: by mail-wm0-f66.google.com with SMTP id s12-v6so3060460wmc.0 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=U2XwxZAIq4fITD4Z+5OM3ds9S/Pu4mHcx7ClcWWGMlWxEQyBauPxsQcztyPmYseGAq lFYfIRsuzp2DVmyY4SuI3N7oBXA933uOZbQoYfE6avVjNGrq0BLgCwkbo4zO+eBMQ0pn h+TPUSCtRdCDnZiYFm1N/nTtg7vIP+2VQBBu25G6WdUy+hr/3GAVLqfxxeI6EW4FqSKe hLT9bCA1AdCoxL+D3enjHZ5V2qRUbM4p4TUQDSAqk42UQGS8/8iliJILEE60Ysl5TyQu eiw33eJw1hZyf2UacrHQ9Nnyk9xm1DqY0XAugnL1v7Eg/6Wm05/iswa61B1dYExuxc32 EOkw== X-Gm-Message-State: AOUpUlEEGKInDr/Sc2WYrKXT8UH9YP8u3eu3G3fiQCuczfxNh/abctyH AaiatT7g8xn/4Jg648U+kXHXPA== 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-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 --- 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);