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: 144730 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5306681ljj; Tue, 21 Aug 2018 06:56:06 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzx7efD9sll6zo7OneGwdDt+I80cWcdHul/k7wElvAPtL43eI5+hlhs6gyEL2P0Rcq03sR4 X-Received: by 2002:a17:902:b193:: with SMTP id s19-v6mr14439850plr.217.1534859766717; Tue, 21 Aug 2018 06:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534859766; cv=none; d=google.com; s=arc-20160816; b=RPl5G1/ptx7x7AbncXs6HOODb4B/r0+1n2i+qWRDikzvskhwa3Nncf9P9W0DpLOGLa XbGa4emoydzI8T0gQLLaCY7cWUGUpl+wn9mlVcvM8YgjgyBImsB/HAd1PHkDJ1Zni1Eb jmu3wveUwLgMpO6+G66ixMDa8WLPCt6CTJgDqNQ+WJdaTXqHBUsaz4m10dbDhexIu73p KwqCR2YLPY/RFDSUNV6sUMc2LuKQHB8Mz/Ogd7i96zsuDBxC8p66ccAjEDQt/6fHHT0i 2FcMR1N03S8UelU4n8opni1cvUhcAZGNClbSzznY4y86tru86tN4HTyxCIUgKehSBnIn On/A== 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=BUph3hiZ4V2ZG+wCVMKvEWc9ax1VLC2ty6Rm5d8QiGc=; b=UcI7lYyoFcDoiTx91qcoIbVQBsGgf0Eb5J/NSNGEElliZ893HtDPcANMYnWWwdSPth iaVHBr2hW3g+dw7FeFgOUntVZXlndxGY1jdY9TkCVjSz3eqn0deYwybOBeeMLDMLbaWK zPUUrmTLISkrhDsIyFEiptbrZkEM3noCWXMYwC2rVWwVq/6NYHRsOdtrXN1E5Ilnyvcv 9QdkQeMSsDWLJ0wdK8M+2E3AjvoEuPPeMg+Inyhx41LlgG0keV70SM1A1NQeMma3y3Lk 5p8bGZDhI6ioISi1tj78SGdW/fNh8fL3D14b1B2oAcZq07KWePFnnnwxstfLJHZPIob+ UqbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YaYF/GBp"; 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 f25-v6si7569484pgm.58.2018.08.21.06.56.06; Tue, 21 Aug 2018 06:56:06 -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="YaYF/GBp"; 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 S1727357AbeHURQU (ORCPT + 13 others); 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-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 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(-) -- 2.7.4 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);