diff mbox series

usb: ehci: Cleanup itd/sidt_complete()

Message ID 20190225155144.17424-1-suwan.kim027@gmail.com (mailing list archive)
State New, archived
Headers show
Series usb: ehci: Cleanup itd/sidt_complete() | expand

Commit Message

Suwan Kim Feb. 25, 2019, 3:51 p.m. UTC
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(-)

Comments

Greg KH Feb. 25, 2019, 4:41 p.m. UTC | #1
On Tue, Feb 26, 2019 at 12:51:44AM +0900, Suwan Kim wrote:
> This patch makes itd/sitd_complete() use *bus instead of referening
> ehci_to_hcd(ehci)->self. And remove unnecessary "urb = NULL" lines.

That is two different things to do in the same patch, please break this
up into different patches.

And when you do, say _why_ you are making these changes, not just a
description of the change itself.  We can read the patch to see what it
does, but we do not know why you want to do this.

thanks,

greg k-h
Suwan Kim Feb. 26, 2019, 3:17 a.m. UTC | #2
On Mon, Feb 25, 2019 at 05:41:45PM +0100, Greg KH wrote:
> On Tue, Feb 26, 2019 at 12:51:44AM +0900, Suwan Kim wrote:
> > This patch makes itd/sitd_complete() use *bus instead of referening
> > ehci_to_hcd(ehci)->self. And remove unnecessary "urb = NULL" lines.
> 
> That is two different things to do in the same patch, please break this
> up into different patches.

Sorry. I will break it up and send separate patches.

> And when you do, say _why_ you are making these changes, not just a
> description of the change itself.  We can read the patch to see what it
> does, but we do not know why you want to do this.
> 
> thanks,
> 
> greg k-h

Ok, you are right. My description is very short. I will rewrite the
description including why i do this and resend v2.

Regards

Suwan Kim
diff mbox series

Patch

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;