From patchwork Sat Dec 1 11:13:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anurag Kumar Vulisha X-Patchwork-Id: 10707615 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 EC4D314BD for ; Sat, 1 Dec 2018 11:14:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCB192E65F for ; Sat, 1 Dec 2018 11:14:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D02C12E666; Sat, 1 Dec 2018 11:14:13 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 46F542E65F for ; Sat, 1 Dec 2018 11:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726916AbeLAW0X (ORCPT ); Sat, 1 Dec 2018 17:26:23 -0500 Received: from mail-eopbgr700083.outbound.protection.outlook.com ([40.107.70.83]:52078 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726736AbeLAW0R (ORCPT ); Sat, 1 Dec 2018 17:26:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9O/fkWXIvShko9wn5oCt8IYeGZavbYH55pp2ZrjJTN0=; b=WA5SlF1tTBOgL2Fz0ChvpeHXHbSkIrIAIuE27TumPysbe+jsr7/l4dVO3U0UI3d86tO9iFCQ9xCGWmv5w2sXP3mxFksh7NJBEXnMV98XexFSeJTq2/LReF+UX9HzJ8/MGpN12HDa9o9S+Yd0s5ZMZ0qBhVkj4zkuNVGCCHU+SrY= Received: from BN6PR02CA0040.namprd02.prod.outlook.com (2603:10b6:404:5f::26) by SN6PR02MB4463.namprd02.prod.outlook.com (2603:10b6:805:a8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sat, 1 Dec 2018 11:13:52 +0000 Received: from CY1NAM02FT049.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::206) by BN6PR02CA0040.outlook.office365.com (2603:10b6:404:5f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22 via Frontend Transport; Sat, 1 Dec 2018 11:13:46 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT049.mail.protection.outlook.com (10.152.75.83) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1382.18 via Frontend Transport; Sat, 1 Dec 2018 11:13:44 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DT-0002W0-RA; Sat, 01 Dec 2018 03:13:43 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1gT3DO-0001kp-NN; Sat, 01 Dec 2018 03:13:38 -0800 Received: from xsj-pvapsmtp01 (mailman.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id wB1BDYMq003401; Sat, 1 Dec 2018 03:13:34 -0800 Received: from [172.23.64.8] (helo=xhdvnc108.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gT3DK-0001jm-0H; Sat, 01 Dec 2018 03:13:34 -0800 Received: by xhdvnc108.xilinx.com (Postfix, from userid 15427) id 34A1460504; Sat, 1 Dec 2018 16:43:33 +0530 (IST) From: Anurag Kumar Vulisha To: Felipe Balbi , Greg Kroah-Hartman , Shuah Khan , Alan Stern , Johan Hovold , Jaejoong Kim , Benjamin Herrenschmidt , Roger Quadros , Manu Gautam , , Bart Van Assche , Mike Christie , Matthew Wilcox , Colin Ian King CC: , , , Thinh Nguyen , Tejas Joglekar , Ajay Yugalkishore Pandey , Anurag Kumar Vulisha Subject: [PATCH v7 03/10] usb: dwc3: gadget: handle stream events Date: Sat, 1 Dec 2018 16:43:24 +0530 Message-ID: <1543662811-5194-4-git-send-email-anurag.kumar.vulisha@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1543662811-5194-1-git-send-email-anurag.kumar.vulisha@xilinx.com> References: <1543662811-5194-1-git-send-email-anurag.kumar.vulisha@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(136003)(346002)(376002)(39860400002)(2980300002)(189003)(199004)(26005)(186003)(51416003)(478600001)(476003)(126002)(106466001)(90966002)(52956003)(426003)(36386004)(336012)(2906002)(47776003)(7416002)(305945005)(76176011)(11346002)(446003)(486006)(2616005)(63266004)(14444005)(356004)(6666004)(48376002)(107886003)(4326008)(5660300001)(2171002)(110136005)(106002)(81166006)(6266002)(103686004)(54906003)(50226002)(8936002)(36756003)(81156014)(316002)(42186006)(16586007)(8676002)(50466002)(39060400002)(107986001)(921003)(83996005)(2101003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR02MB4463;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CY1NAM02FT049;1:shfDVG207dhnfnamBqKcZBMsSzvGgtwL1kSxXeiV8bgnqUpkAbjHNYCG6630DiI3Onq2ZLTqSVZVnVY4fAcYrdFHZy8P0eLOq4M8jPLj7G1RhqGtoNri1Gj2gnuuLzBb MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 99784bdf-8ccc-4983-bf9d-08d6577e0fa4 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4608076)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060);SRVR:SN6PR02MB4463; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4463;3:rn5NDDx1eJvnOdh7XYy6o0eTMyRoAV2dDVQNQ+/P2Ff57WJjxXyWc9kqh15ZM/9NH1Z40cK7eeKrjaR722QgXnB4pmAfKEx86AIx5mbQXqcQW1Bh2GjaI0HcLcyEI1hLjAatnRAGq7dzepLznLjRqbWjeatZhLtTNQAXEeAURItlQdKUA/UTwZ79izAPXeC3Dw84InGmsNJqAtgzERtLrYE03vQCgZdthnQzCktQ9GvNUXd/b5g9GnlirOM3D3s4HZ1EIzefc+8OuMfSC0exlji61cpta273coupy0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wcZEig8m5ZPo//nrswfPF3CSXWpiLDOOWdtyntaBWbb0v+3kL+wtNiEdMbeOG/JND0AZxRgYoOJZAtGNUxrPVPAVMRZb/kS8hd88muO0bp7uYtZpCLbxajmbFPn2mwhCAjryPO6V3iGxPMvUCpDJQmc X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93004095)(3002001)(10201501046)(3231454)(999002)(944501476)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095);SRVR:SN6PR02MB4463;BCL:0;PCL:0;RULEID:;SRVR:SN6PR02MB4463; X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4463;4:/GyUqIC6o2/cQKubZacWH9geX4UbyDmuhcFwXGzEHWnmLVcPVoW0ZQxWcby7jNYfsWQOYZDQAPenCbpFtsbx/MU3ECoukk86GF3Qw6O9ijnN5YkxiYBYlWZgRfHwkSNkZRspnNuKe7X6IHfNk3LWanXibfPkaSEcZDc/exoFV4kwAL7hDhoaoRJwkROGsxMqzkQQRrDdT+xJYvOzU5pR8QCZU4X9LdwNl8cZ3GK4wN6/dvp8fdwbxvyWHX3y7bdOBAm12n8JN6I9dIFsc6OnNA== X-Forefront-PRVS: 087396016C X-Microsoft-Exchange-Diagnostics: 1;SN6PR02MB4463;23:lE9Yx6u2YKeYiddoV7g6gZxdHDvvnrSowh97IWXRCtrCYFqRa8C+qrHV24Efw+opM0S7pG+9jZaIND5Cp42xIVUE59js3e2rrmBs6xaoOIdMQc+IjSO73OqNge68KCJFPCC7aPrfporLaFaJGNk6akvOvOtKXbwfzOqIgzN4AxMYf7IPga68yVSy5AkzsIMWPSMLR5mSBVlg5zMR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Um5oO0hARuS3oUUTlFHrI=;7:g818g84Pdg85Ds+HYi5DbZ8xzyp+mtOxGgWTZ9A3MgXffjJb/2kkHQGAR+HM6GBlZTVr3CUx+9JjD2+znFVYc4YGDQd3QGHRHoFRDbRieWT1SqxNilz0puLmamxJk058NrokceCCjDeXpOZubszwUw== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2018 11:13:44.8985 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99784bdf-8ccc-4983-bf9d-08d6577e0fa4 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB4463 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 When bulk streams are enabled, the udc/core.c starts the timer for every request queued. This timer needs to be deleted by the gadget driver when a valid stream event is found. This is done to avoid the deadlock situation which occurs when streams are enabled. This patch modifies the code to delete the pending timer for the request matching the streamid found in the event. Signed-off-by: Anurag Kumar Vulisha --- Changes in v7: 1. This patch is newly added into this series --- drivers/usb/dwc3/gadget.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9faad89..319a3ed 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2438,6 +2438,28 @@ static void dwc3_gadget_endpoint_transfer_not_ready(struct dwc3_ep *dep, __dwc3_gadget_start_isoc(dep); } +static void dwc3_endpoint_stream_event(struct dwc3 *dwc, + const struct dwc3_event_depevt *event) +{ + struct dwc3_ep *dep; + struct dwc3_request *req; + u8 epnum = event->endpoint_number; + u8 stream_id; + + dep = dwc->eps[epnum]; + + stream_id = event->parameters; + + /* Check for request matching the streamid and delete the timer */ + list_for_each_entry(req, &dep->started_list, list) { + if (req->request.stream_id == stream_id) { + if (timer_pending(&req->request.req_timeout_timer)) + del_timer(&req->request.req_timeout_timer); + break; + } + } +} + static void dwc3_endpoint_interrupt(struct dwc3 *dwc, const struct dwc3_event_depevt *event) { @@ -2477,6 +2499,9 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, } break; case DWC3_DEPEVT_STREAMEVT: + if (event->status == DEPEVT_STREAMEVT_FOUND) + dwc3_endpoint_stream_event(dwc, event); + case DWC3_DEPEVT_XFERCOMPLETE: case DWC3_DEPEVT_RXTXFIFOEVT: break;