All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suwan Kim <suwan.kim027@gmail.com>
To: stern@rowland.harvard.edu
Cc: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org
Subject: usb: ehci: Cleanup itd/sidt_complete()
Date: Tue, 26 Feb 2019 00:51:44 +0900	[thread overview]
Message-ID: <20190225155144.17424-1-suwan.kim027@gmail.com> (raw)

This patch makes itd/sitd_complete() use *bus instead of referening
ehci_to_hcd(ehci)->self. And remove unnecessary "urb = NULL" lines.

Signed-off-by: Suwan Kim <suwan.kim027@gmail.com>
---
 drivers/usb/host/ehci-sched.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index da7b00a6110b..418825bd94fd 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1836,6 +1836,7 @@ static bool itd_complete(struct ehci_hcd *ehci, struct ehci_itd *itd)
 	int					urb_index = -1;
 	struct ehci_iso_stream			*stream = itd->stream;
 	bool					retval = false;
+	struct usb_bus			*bus = &ehci_to_hcd(ehci)->self;
 
 	/* for each uframe with a packet */
 	for (uframe = 0; uframe < 8; uframe++) {
@@ -1887,20 +1888,18 @@ static bool itd_complete(struct ehci_hcd *ehci, struct ehci_itd *itd)
 	/* give urb back to the driver; completion often (re)submits */
 	ehci_urb_done(ehci, urb, 0);
 	retval = true;
-	urb = NULL;
 
 	--ehci->isoc_count;
 	disable_periodic(ehci);
 
-	ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
-	if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) {
+	bus->bandwidth_isoc_reqs--;
+	if (bus->bandwidth_isoc_reqs == 0) {
 		if (ehci->amd_pll_fix == 1)
 			usb_amd_quirk_pll_enable();
 	}
 
 	if (unlikely(list_is_singular(&stream->td_list)))
-		ehci_to_hcd(ehci)->self.bandwidth_allocated
-				-= stream->bandwidth;
+		bus->bandwidth_allocated -= stream->bandwidth;
 
 done:
 	itd->urb = NULL;
@@ -2229,6 +2228,7 @@ static bool sitd_complete(struct ehci_hcd *ehci, struct ehci_sitd *sitd)
 	int					urb_index;
 	struct ehci_iso_stream			*stream = sitd->stream;
 	bool					retval = false;
+	struct usb_bus			*bus = &ehci_to_hcd(ehci)->self;
 
 	urb_index = sitd->index;
 	desc = &urb->iso_frame_desc[urb_index];
@@ -2267,20 +2267,18 @@ static bool sitd_complete(struct ehci_hcd *ehci, struct ehci_sitd *sitd)
 	/* give urb back to the driver; completion often (re)submits */
 	ehci_urb_done(ehci, urb, 0);
 	retval = true;
-	urb = NULL;
 
 	--ehci->isoc_count;
 	disable_periodic(ehci);
 
-	ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
-	if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) {
+	bus->bandwidth_isoc_reqs--;
+	if (bus->bandwidth_isoc_reqs == 0) {
 		if (ehci->amd_pll_fix == 1)
 			usb_amd_quirk_pll_enable();
 	}
 
 	if (list_is_singular(&stream->td_list))
-		ehci_to_hcd(ehci)->self.bandwidth_allocated
-				-= stream->bandwidth;
+		bus->bandwidth_allocated -= stream->bandwidth;
 
 done:
 	sitd->urb = NULL;

             reply	other threads:[~2019-02-25 15:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-25 15:51 Suwan Kim [this message]
2019-02-25 16:41 usb: ehci: Cleanup itd/sidt_complete() Greg Kroah-Hartman
2019-02-26  3:17 Suwan Kim

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=20190225155144.17424-1-suwan.kim027@gmail.com \
    --to=suwan.kim027@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.