From patchwork Sun Jun 27 12:57:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kelly Devilliv X-Patchwork-Id: 467921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5372C48BC2 for ; Sun, 27 Jun 2021 12:58:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8645761C23 for ; Sun, 27 Jun 2021 12:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbhF0NAu (ORCPT ); Sun, 27 Jun 2021 09:00:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbhF0NAt (ORCPT ); Sun, 27 Jun 2021 09:00:49 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA0D1C061574; Sun, 27 Jun 2021 05:58:25 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id i4so7299291plt.12; Sun, 27 Jun 2021 05:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lSJb3ALiMvMZDvE7jtI1z/LDciUnieTeSH6iaR3sAZA=; b=nQ2T+qSs9k3+8Dp8q4ZlwnnXq7Ae57qHKWIs2vmFi1iPkRbO012+05cGlO3BJjNtrG iFhc48MXusGaH/L9rHYVPiIcmLYRK3zwovF4PXWm4eRgf1TksJTVD5rH28WGtrOiiWjY K5MckTU4PGZO0/pFtmfSiLHltpV/KMjtVjPD96WYbvJey6OMQKOgLmWrrK18eyssXBOq diOHUhcJuqv33O6dP9IfgMoMELUJ/gAKZ3EmVIHAHz+knTzGdbJU9lLo0f5qKxUuW8gT pHUaJnk0WS9nRNb1Q2VANbhBnicIE2cwgR1Ko5HfLPP6xm3V4z2VJBQbXyK0m9eLBcwL OONw== 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:mime-version:content-transfer-encoding; bh=lSJb3ALiMvMZDvE7jtI1z/LDciUnieTeSH6iaR3sAZA=; b=gJ4jvyQtxrJnYS5v8SxM0bST29Z/ghAxIXWFiLPQ+vogYIdNNUJzxyHzqW+Z0KWvZ3 7f13rDhpcISd8ZsecR2rOtnsEBa4+B/5ZBr2OwPmDV/NiSlEmCVc10uB3YQnctC4LhFz mKtmrMfV+/YD5t5bpnKJPt0/ZbaRkGyOVZFqLorJmU1KlkSwOoX3KxcnI+VAubivM++I N1Av4m2l1q4vjT699uYaKkxsSYKGgXI0S7H8zVctfDT3W+RtBn7Zc6Dr/IDBToxi/hxm rM7C0xURT9/qxllqaa93p6pxnT1TiShx3cCTy5hzbiE6iOsM70aktJbTw25qo2r0Q4qA iDzQ== X-Gm-Message-State: AOAM533/58oP4Y50iZ/qxXWbasYclvlvkf9FncecVNZ9am68H0UlVDg8 LBjU4+bJ5PMzxaU48Y1RbYlQkUJWRTWx2pt0 X-Google-Smtp-Source: ABdhPJyos4zBFqhRfEAkxu6dTUOQhSZ24LvH+CaUIbEFwixXV9YeCh0kHQSZJCP+TZUDuYH5GK7u8A== X-Received: by 2002:a17:902:8d92:b029:113:91e7:89d6 with SMTP id v18-20020a1709028d92b029011391e789d6mr18011699plo.85.1624798705379; Sun, 27 Jun 2021 05:58:25 -0700 (PDT) Received: from localhost.localdomain ([113.76.110.29]) by smtp.googlemail.com with ESMTPSA id c5sm11270260pfi.81.2021.06.27.05.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Jun 2021 05:58:25 -0700 (PDT) From: Kelly Devilliv To: gregkh@linuxfoundation.org, shubhankarvk@gmail.com, lee.jones@linaro.org, gustavoars@kernel.org, chunfeng.yun@mediatek.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kelly Devilliv Subject: [PATCH 1/3] Revert "usb: host: fotg210: Use dma_pool_zalloc" Date: Sun, 27 Jun 2021 20:57:45 +0800 Message-Id: <20210627125747.127646-2-kelly.devilliv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210627125747.127646-1-kelly.devilliv@gmail.com> References: <20210627125747.127646-1-kelly.devilliv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This reverts commit cb6a0db8fdc12433ed4281331de0c3923dc2807b for the same reason as commit 43b78f1155c868208a413082179251f5fba78153 in the ehci-hcd driver. Alan writes: What you can't see just from reading the patch is that in both cases (ehci->itd_pool and ehci->sitd_pool) there are two allocation paths -- the two branches of an "if" statement -- and only one of the paths calls dma_pool_[z]alloc. However, the memset is needed for both paths, and so it can't be eliminated. Given that it must be present, there's no advantage to calling dma_pool_zalloc rather than dma_pool_alloc. Signed-off-by: Kelly Devilliv --- drivers/usb/host/fotg210-hcd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c index 9c2eda0918e1..bb50a7a7318a 100644 --- a/drivers/usb/host/fotg210-hcd.c +++ b/drivers/usb/host/fotg210-hcd.c @@ -1857,9 +1857,11 @@ static struct fotg210_qh *fotg210_qh_alloc(struct fotg210_hcd *fotg210, qh = kzalloc(sizeof(*qh), GFP_ATOMIC); if (!qh) goto done; - qh->hw = dma_pool_zalloc(fotg210->qh_pool, flags, &dma); + qh->hw = (struct fotg210_qh_hw *) + dma_pool_alloc(fotg210->qh_pool, flags, &dma); if (!qh->hw) goto fail; + memset(qh->hw, 0, sizeof(*qh->hw)); qh->qh_dma = dma; INIT_LIST_HEAD(&qh->qtd_list); @@ -4111,7 +4113,7 @@ static int itd_urb_transaction(struct fotg210_iso_stream *stream, } else { alloc_itd: spin_unlock_irqrestore(&fotg210->lock, flags); - itd = dma_pool_zalloc(fotg210->itd_pool, mem_flags, + itd = dma_pool_alloc(fotg210->itd_pool, mem_flags, &itd_dma); spin_lock_irqsave(&fotg210->lock, flags); if (!itd) { @@ -4121,6 +4123,7 @@ static int itd_urb_transaction(struct fotg210_iso_stream *stream, } } + memset(itd, 0, sizeof(*itd)); itd->itd_dma = itd_dma; list_add(&itd->itd_list, &sched->td_list); } From patchwork Sun Jun 27 12:57:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kelly Devilliv X-Patchwork-Id: 468166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CED8BC49EAF for ; Sun, 27 Jun 2021 12:58:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AACFA61C23 for ; Sun, 27 Jun 2021 12:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230379AbhF0NBC (ORCPT ); Sun, 27 Jun 2021 09:01:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbhF0NBC (ORCPT ); Sun, 27 Jun 2021 09:01:02 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5F3EC061574; Sun, 27 Jun 2021 05:58:37 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id pf4-20020a17090b1d84b029016f6699c3f2so10996537pjb.0; Sun, 27 Jun 2021 05:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TD9RKCumN6SQ/jONnfjhNDCjuF5eLGJYOMSfmMwJUAk=; b=VjlQciPnvD/DEQPn+L56j0VaEYuL8Wb0G7kmTb5oXASHGuLLYAbenrjlced3r/A/8G xrSaMUpczAtNqlbt2mN552JzULQWlr6ogDZkdGp0X2HyneguQIkADtiq8D9DlabnbRaF rQUJWi8O9K0ULSMf/UAbsxodF9nzDx/lDqA5o/jL4NcKNIQBkhhNIyEUCVmt8hxBDkLI KaIXMkqQ2jKvBeaZ/xV7F6BlZb6t6xO73CPaDsrGXcli7dE/YU3PB58e+I7FJMXOaHyH RZPgp3Pu+wtI4WLLuRV7u9ZLumK4JSWHqP+rleqNF7WO1ZQNq+ZsfM9ytWx4NED73+i7 0WFg== 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:mime-version:content-transfer-encoding; bh=TD9RKCumN6SQ/jONnfjhNDCjuF5eLGJYOMSfmMwJUAk=; b=nKgY5s8j0KOTiY2aUOU9+1o6jEyI66ioHbL+KY8xXHKcqcas/EWVj8bAMvv5mm0xlU /wv4K9g6h8W/loDWG8RGNy0nvTJeqD4Aa61rfPyKBm/McyS+Z4t+LgN7u7mG9YnkBdZ1 b+if5c3F6xgNzGKk9uqJtozx9JS4VBaOfA50FxOebMxqNW3s1trMej62gFT/raB41IHA 7KFcdxL7W+3fVb0JLIFFZdlupGq8MOFW4WWS0Ftgo2npyvYPI5X614t1P8gGa2LdRTIE 7i6dMYXF2alPQB3i2Cb0MLvJfO1Dvy1+8kdfBq9An7jZTeVnOKcpaofFqUgdwP0ig3Yy Bp0g== X-Gm-Message-State: AOAM531URte8lWzktP3LlsN2z+cLHSK89pHD7bTU9Fap9oJUV2C3pQob AtULTZQazgvV5CsN8Tk1j/4= X-Google-Smtp-Source: ABdhPJyKhXugoSpKWQRMdqTUxbag6ZBX1DE195PxlhiC4vlMomzhbGX+c2KBjmcMY1Lc0JG5JS8i+Q== X-Received: by 2002:a17:902:ab8e:b029:125:e6a0:fea2 with SMTP id f14-20020a170902ab8eb0290125e6a0fea2mr11520502plr.41.1624798717324; Sun, 27 Jun 2021 05:58:37 -0700 (PDT) Received: from localhost.localdomain ([113.76.110.29]) by smtp.googlemail.com with ESMTPSA id c5sm11270260pfi.81.2021.06.27.05.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Jun 2021 05:58:37 -0700 (PDT) From: Kelly Devilliv To: gregkh@linuxfoundation.org, shubhankarvk@gmail.com, lee.jones@linaro.org, gustavoars@kernel.org, chunfeng.yun@mediatek.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kelly Devilliv Subject: [PATCH 2/3] usb: host: fotg210: fix the endpoint's transactional opportunities calculation Date: Sun, 27 Jun 2021 20:57:46 +0800 Message-Id: <20210627125747.127646-3-kelly.devilliv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210627125747.127646-1-kelly.devilliv@gmail.com> References: <20210627125747.127646-1-kelly.devilliv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Now that usb_endpoint_maxp() only returns the lowest 11 bits from wMaxPacketSize, we should make use of the usb_endpoint_* helpers instead and remove the unnecessary max_packet()/hb_mult() macro. Signed-off-by: Kelly Devilliv --- drivers/usb/host/fotg210-hcd.c | 36 ++++++++++++++++------------------ 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c index bb50a7a7318a..c38a6c2a8d95 100644 --- a/drivers/usb/host/fotg210-hcd.c +++ b/drivers/usb/host/fotg210-hcd.c @@ -2511,11 +2511,6 @@ static unsigned qh_completions(struct fotg210_hcd *fotg210, return count; } -/* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */ -#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) -/* ... and packet size, for any kind of endpoint descriptor */ -#define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff) - /* reverse of qh_urb_transaction: free a list of TDs. * used for cleanup after errors, before HC sees an URB's TDs. */ @@ -2601,7 +2596,7 @@ static struct list_head *qh_urb_transaction(struct fotg210_hcd *fotg210, token |= (1 /* "in" */ << 8); /* else it's already initted to "out" pid (0 << 8) */ - maxpacket = max_packet(usb_maxpacket(urb->dev, urb->pipe, !is_input)); + maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input); /* * buffer gets wrapped in one or more qtds; @@ -2715,9 +2710,11 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, gfp_t flags) { struct fotg210_qh *qh = fotg210_qh_alloc(fotg210, flags); + struct usb_host_endpoint *ep; u32 info1 = 0, info2 = 0; int is_input, type; int maxp = 0; + int mult; struct usb_tt *tt = urb->dev->tt; struct fotg210_qh_hw *hw; @@ -2732,14 +2729,15 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, is_input = usb_pipein(urb->pipe); type = usb_pipetype(urb->pipe); - maxp = usb_maxpacket(urb->dev, urb->pipe, !is_input); + ep = usb_pipe_endpoint(urb->dev, urb->pipe); + maxp = usb_endpoint_maxp(&ep->desc); + mult = usb_endpoint_maxp_mult(&ep->desc); /* 1024 byte maxpacket is a hardware ceiling. High bandwidth * acts like up to 3KB, but is built from smaller packets. */ - if (max_packet(maxp) > 1024) { - fotg210_dbg(fotg210, "bogus qh maxpacket %d\n", - max_packet(maxp)); + if (maxp > 1024) { + fotg210_dbg(fotg210, "bogus qh maxpacket %d\n", maxp); goto done; } @@ -2753,8 +2751,7 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, */ if (type == PIPE_INTERRUPT) { qh->usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH, - is_input, 0, - hb_mult(maxp) * max_packet(maxp))); + is_input, 0, mult * maxp)); qh->start = NO_FRAME; if (urb->dev->speed == USB_SPEED_HIGH) { @@ -2791,7 +2788,7 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, think_time = tt ? tt->think_time : 0; qh->tt_usecs = NS_TO_US(think_time + usb_calc_bus_time(urb->dev->speed, - is_input, 0, max_packet(maxp))); + is_input, 0, maxp)); qh->period = urb->interval; if (qh->period > fotg210->periodic_size) { qh->period = fotg210->periodic_size; @@ -2854,11 +2851,11 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, * to help them do so. So now people expect to use * such nonconformant devices with Linux too; sigh. */ - info1 |= max_packet(maxp) << 16; + info1 |= maxp << 16; info2 |= (FOTG210_TUNE_MULT_HS << 30); } else { /* PIPE_INTERRUPT */ - info1 |= max_packet(maxp) << 16; - info2 |= hb_mult(maxp) << 30; + info1 |= maxp << 16; + info2 |= mult << 30; } break; default: @@ -3928,6 +3925,7 @@ static void iso_stream_init(struct fotg210_hcd *fotg210, int is_input; long bandwidth; unsigned multi; + struct usb_host_endpoint *ep; /* * this might be a "high bandwidth" highspeed endpoint, @@ -3935,14 +3933,14 @@ static void iso_stream_init(struct fotg210_hcd *fotg210, */ epnum = usb_pipeendpoint(pipe); is_input = usb_pipein(pipe) ? USB_DIR_IN : 0; - maxp = usb_maxpacket(dev, pipe, !is_input); + ep = usb_pipe_endpoint(dev, pipe); + maxp = usb_endpoint_maxp(&ep->desc); if (is_input) buf1 = (1 << 11); else buf1 = 0; - maxp = max_packet(maxp); - multi = hb_mult(maxp); + multi = usb_endpoint_maxp_mult(&ep->desc); buf1 |= maxp; maxp *= multi; From patchwork Sun Jun 27 12:57:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kelly Devilliv X-Patchwork-Id: 467920 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC06BC48BC2 for ; Sun, 27 Jun 2021 12:58:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A26FF61C34 for ; Sun, 27 Jun 2021 12:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230436AbhF0NBK (ORCPT ); Sun, 27 Jun 2021 09:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230444AbhF0NBI (ORCPT ); Sun, 27 Jun 2021 09:01:08 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C52A4C061766; Sun, 27 Jun 2021 05:58:43 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id s137so4077298pfc.4; Sun, 27 Jun 2021 05:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fA84hBdi5Y61f4a0iRh+qsCOjJMAhTeQ0LqXQzqjcYE=; b=kEZ/tuMJaZhRd0Shzxehn/w/XJigpaWLtpSKHwxvu6ohAA0HgVDjn91wldLd/jU+0P l2t/YFrfqs/ewdL97EW3yItAEW/l5BMgbYdOy9rC/AuzfhafQoOAmONT6mJxuqd7K47s Ha7zE3zISV3biQiBGNxsH6++UqQHlpQywH8PqxClW/OEB1/bzbe/S4jUrTeFk6YcWPZ/ 7q9HdbQvnng8meyCQ++U2tTJAo2kSEchmfNQy7sgrCnTceGmfbXIkgATnOpI/OaaMXwp uf7q4dcbY896pCLxU+AKcS2sq6wVwpoC13v5ZWWiy5Pihs+AgMYqK22bz5esXqxvcCv0 5GGA== 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:mime-version:content-transfer-encoding; bh=fA84hBdi5Y61f4a0iRh+qsCOjJMAhTeQ0LqXQzqjcYE=; b=IPxds9Ia+dY0mX0d7UIadWFjJKqCmL7Jvz3xsDq9lph3i6aIWoRL1MD5l04+loWXCk NSPAF+Uzn7LTPcC94n8ARW0rkQYmqBaASPU7dgudTvDHuszMdhwXEg4Y12Hd99z7OpGJ BuQCBdIo5RW6vbRZMU139nhBhbdVoEQYwotJzayHqu410HEBF6SRXduZogo66sWXzZhR AFtwTp+tA7n3TSLtD8/8ILyfn0ki6Svsv/TUXJDYxrjDNPxnBRx+81oZzmxUBLiZZtBP wA18udME1WZ23f1GtUzqAoBkntmMjFNgTM6k4XlUCNtyT5XKWT7EL7Gf2q+lr9poUJ5q tmPA== X-Gm-Message-State: AOAM531XL2dFUKBXmJzrDpq9fUvgF1VkWvLrfeMMjtPFdM0+Qbtt6Cc0 7e1GcW2z5QXZ8CGapxRFqXo= X-Google-Smtp-Source: ABdhPJzYH1hH4Moa1z4YTuzEbau0wzXnw0FmnuJm62ox8cP9/xjBEoOgPt7f/VpRyDH75+62GBlSHw== X-Received: by 2002:a63:1a5b:: with SMTP id a27mr18843624pgm.427.1624798723452; Sun, 27 Jun 2021 05:58:43 -0700 (PDT) Received: from localhost.localdomain ([113.76.110.29]) by smtp.googlemail.com with ESMTPSA id c5sm11270260pfi.81.2021.06.27.05.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Jun 2021 05:58:43 -0700 (PDT) From: Kelly Devilliv To: gregkh@linuxfoundation.org, shubhankarvk@gmail.com, lee.jones@linaro.org, gustavoars@kernel.org, chunfeng.yun@mediatek.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kelly Devilliv Subject: [PATCH 3/3] usb: host: fotg210: fix the actual_length of an iso packet Date: Sun, 27 Jun 2021 20:57:47 +0800 Message-Id: <20210627125747.127646-4-kelly.devilliv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210627125747.127646-1-kelly.devilliv@gmail.com> References: <20210627125747.127646-1-kelly.devilliv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org We should acquire the actual_length of an iso packet from the iTD directly using FOTG210_ITD_LENGTH() macro. Signed-off-by: Kelly Devilliv --- drivers/usb/host/fotg210-hcd.c | 5 ++--- drivers/usb/host/fotg210.h | 5 ----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c index c38a6c2a8d95..48ff10958d0d 100644 --- a/drivers/usb/host/fotg210-hcd.c +++ b/drivers/usb/host/fotg210-hcd.c @@ -4462,13 +4462,12 @@ static bool itd_complete(struct fotg210_hcd *fotg210, struct fotg210_itd *itd) /* HC need not update length with this error */ if (!(t & FOTG210_ISOC_BABBLE)) { - desc->actual_length = - fotg210_itdlen(urb, desc, t); + desc->actual_length = FOTG210_ITD_LENGTH(t); urb->actual_length += desc->actual_length; } } else if (likely((t & FOTG210_ISOC_ACTIVE) == 0)) { desc->status = 0; - desc->actual_length = fotg210_itdlen(urb, desc, t); + desc->actual_length = FOTG210_ITD_LENGTH(t); urb->actual_length += desc->actual_length; } else { /* URB was too late */ diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h index 6cee40ec65b4..67f59517ebad 100644 --- a/drivers/usb/host/fotg210.h +++ b/drivers/usb/host/fotg210.h @@ -686,11 +686,6 @@ static inline unsigned fotg210_read_frame_index(struct fotg210_hcd *fotg210) return fotg210_readl(fotg210, &fotg210->regs->frame_index); } -#define fotg210_itdlen(urb, desc, t) ({ \ - usb_pipein((urb)->pipe) ? \ - (desc)->length - FOTG210_ITD_LENGTH(t) : \ - FOTG210_ITD_LENGTH(t); \ -}) /*-------------------------------------------------------------------------*/ #endif /* __LINUX_FOTG210_H */