linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kelly Devilliv <kelly.devilliv@gmail.com>
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 <kelly.devilliv@gmail.com>
Subject: [PATCH 3/3] usb: host: fotg210: fix the actual_length of an iso packet
Date: Sun, 27 Jun 2021 20:57:47 +0800	[thread overview]
Message-ID: <20210627125747.127646-4-kelly.devilliv@gmail.com> (raw)
In-Reply-To: <20210627125747.127646-1-kelly.devilliv@gmail.com>

We should acquire the actual_length of an iso packet
from the iTD directly using FOTG210_ITD_LENGTH() macro.

Signed-off-by: Kelly Devilliv <kelly.devilliv@gmail.com>
---
 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 */
-- 
2.25.1


  parent reply	other threads:[~2021-06-27 12:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-27 12:57 [PATCH 0/3] usb: host: fotg210: fix malfunctions in usb camera scenario Kelly Devilliv
2021-06-27 12:57 ` [PATCH 1/3] Revert "usb: host: fotg210: Use dma_pool_zalloc" Kelly Devilliv
2021-06-27 12:57 ` [PATCH 2/3] usb: host: fotg210: fix the endpoint's transactional opportunities calculation Kelly Devilliv
2021-06-27 12:57 ` Kelly Devilliv [this message]
2021-07-21  8:03 ` [PATCH 0/3] usb: host: fotg210: fix malfunctions in usb camera scenario Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210627125747.127646-4-kelly.devilliv@gmail.com \
    --to=kelly.devilliv@gmail.com \
    --cc=chunfeng.yun@mediatek.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shubhankarvk@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).