From patchwork Thu Apr 18 15:25:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Zhu X-Patchwork-Id: 10907575 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 51F9813B5 for ; Thu, 18 Apr 2019 15:28:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3343828C6C for ; Thu, 18 Apr 2019 15:28:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2676428CA8; Thu, 18 Apr 2019 15:28:42 +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,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 BF09C28C6C for ; Thu, 18 Apr 2019 15:28:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388457AbfDRP2k (ORCPT ); Thu, 18 Apr 2019 11:28:40 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6645 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388299AbfDRP2k (ORCPT ); Thu, 18 Apr 2019 11:28:40 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 35162D8CB0041C3F437E; Thu, 18 Apr 2019 23:28:32 +0800 (CST) Received: from suse12-sp2.huawei.com (10.67.189.94) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.408.0; Thu, 18 Apr 2019 23:28:23 +0800 From: zhuyan To: , , CC: , Subject: [PATCH v3] usb: host: use usb_endpoint_maxp instead of usb_maxpacket Date: Thu, 18 Apr 2019 23:25:21 +0800 Message-ID: <1555601121-81611-1-git-send-email-zhuyan34@huawei.com> X-Mailer: git-send-email 1.8.5.6 MIME-Version: 1.0 X-Originating-IP: [10.67.189.94] X-CFilter-Loop: Reflected 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 From: Yan Zhu fhci_queue_urb() shouldn't use urb->pipe to compute the maxpacket size anyway.It should use usb_endpoint_maxp(&urb->ep->desc). Signed-off-by: Yan Zhu --- drivers/usb/host/fhci-sched.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/fhci-sched.c b/drivers/usb/host/fhci-sched.c index 3d12cdd..3235d53 100644 --- a/drivers/usb/host/fhci-sched.c +++ b/drivers/usb/host/fhci-sched.c @@ -727,8 +727,7 @@ void fhci_queue_urb(struct fhci_hcd *fhci, struct urb *urb) } ed->speed = (urb->dev->speed == USB_SPEED_LOW) ? FHCI_LOW_SPEED : FHCI_FULL_SPEED; - ed->max_pkt_size = usb_maxpacket(urb->dev, - urb->pipe, usb_pipeout(urb->pipe)); + ed->max_pkt_size = usb_endpoint_maxp(&urb->ep->desc); urb->ep->hcpriv = ed; fhci_dbg(fhci, "new ep speed=%d max_pkt_size=%d\n", ed->speed, ed->max_pkt_size); @@ -768,8 +767,7 @@ void fhci_queue_urb(struct fhci_hcd *fhci, struct urb *urb) if (urb->transfer_flags & URB_ZERO_PACKET && urb->transfer_buffer_length > 0 && ((urb->transfer_buffer_length % - usb_maxpacket(urb->dev, urb->pipe, - usb_pipeout(urb->pipe))) == 0)) + usb_endpoint_maxp(&urb->ep->desc)) == 0)) urb_state = US_BULK0; while (data_len > 4096) { td = fhci_td_fill(fhci, urb, urb_priv, ed, cnt, @@ -807,8 +805,8 @@ void fhci_queue_urb(struct fhci_hcd *fhci, struct urb *urb) break; case FHCI_TF_CTRL: ed->dev_addr = usb_pipedevice(urb->pipe); - ed->max_pkt_size = usb_maxpacket(urb->dev, urb->pipe, - usb_pipeout(urb->pipe)); + ed->max_pkt_size = usb_endpoint_maxp(&urb->ep->desc); + /* setup stage */ td = fhci_td_fill(fhci, urb, urb_priv, ed, cnt++, FHCI_TA_SETUP, USB_TD_TOGGLE_DATA0, urb->setup_packet, 8, 0, 0, true);