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.kim...@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;
-- 
2.20.1

Reply via email to