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: 10576779 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 A34E81805 for ; Mon, 27 Aug 2018 09:33:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96E412847D for ; Mon, 27 Aug 2018 09:33:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AC052977F; Mon, 27 Aug 2018 09:33:49 +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 4BA77297A9 for ; Mon, 27 Aug 2018 09:33:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727499AbeH0NTj (ORCPT ); Mon, 27 Aug 2018 09:19:39 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45336 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727495AbeH0NTj (ORCPT ); Mon, 27 Aug 2018 09:19:39 -0400 Received: by mail-wr1-f65.google.com with SMTP id 20-v6so12944256wrb.12 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=dZcUqRqHAOPNB4ku5PU+x/0lr1u+Uh8CgwIoxEbaCDj8ielpS65cVr6KbJkURUass7 7emhdm0YkVAw2BeJE1KHUdZUsw1kSkrdLoRrX/hGFRVAmfVl4fJG1+bGbrma+VNcLy/J FWmYYwa7ZZXqLio+ZGJPu6SYkRiwWv6hg2UlGe/kQXEvXn13eI2c1OV52HxgeFeWnYIw u7uE8RR+EtaC8zSkfJXtGKwAiRve/xqn229dIJLog2Z5giaCZBvm992XN4eE1dOCfmtR il9GtAbwSK7I8Zd1NbpeHldiBTdlN52VObSm6UZoK+RkpeGVKATYDgVvGOxsqCheJZky pcVw== X-Gm-Message-State: APzg51Ay/HmhPb4SYsQO+WWwn7J5w4tu1N6iIbNFH+skpirE/fkE1vNz BFTYa45zSwXQjDDs3ZUo30FiYw== X-Google-Smtp-Source: ANB0VdYfpnGniBjmdQ2QohOldJ/TbQxIgg5L5XScJui0m5aFZk4t487I1TnLCfUVwvBgsEssag4UYA== 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-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: 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 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);