From patchwork Mon Feb 25 15:51:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suwan Kim X-Patchwork-Id: 10828769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 365FE13B5 for ; Mon, 25 Feb 2019 15:51:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 276072BB7D for ; Mon, 25 Feb 2019 15:51:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25F502BBEB; Mon, 25 Feb 2019 15:51:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C109C2BB7D for ; Mon, 25 Feb 2019 15:51:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727723AbfBYPvu (ORCPT ); Mon, 25 Feb 2019 10:51:50 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:46764 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727657AbfBYPvu (ORCPT ); Mon, 25 Feb 2019 10:51:50 -0500 Received: by mail-pl1-f193.google.com with SMTP id c17so1509628plz.13 for ; Mon, 25 Feb 2019 07:51:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=V3m4plUj0QMjUECBwP3UufBrLpR884f+61RLcZARpUA=; b=frcHlCE6agPrjro3xBTyfv39hZg2LKXBZPlJUsLV6b1JOradEq6Kt0vkurPAD3rNrF hwlQT/aCn0fptwfH/YDz+s643sY3yAMmoQLkfZS4I+AxobozSf5r6PbzGRhLq7FPDExX 1o4E+15vODWvfZdSIGCrvOG3jhGCf6ZVOCUYMzIAD1Im7raJEOqjK6M0XLZ3ialo9vjs lNG5X4DTQm/Q2Fnt44AyS6+QvSaVlhHvHiEB5+y+bGmWOMUL66Mg2wlyz1ljEmfFwrGT 9GKu2VHeoElgvev4hb6gmx98cLMLm+4ucx7nJaXq3NOF2OOyzT4mn7jcuzIoNSr+d4Kt TdYQ== 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:mime-version :content-transfer-encoding; bh=V3m4plUj0QMjUECBwP3UufBrLpR884f+61RLcZARpUA=; b=KqJbzhSYvkGV8P2ZTF0pnzCzegJt9c5hMc7nX+g+sjlK7ivpu4M+brnWEon2Y8PM9S 532SyBMQC4qOU0AhCqtnfmsTcgjy76TKfs3PuHU/LGU2Y4ux21bJgB3Cy62GhdUu3iba dnQkYkTGZaoWLxqXTWLsbvlwYMMEz57x5AyfJ6/mPSMdNCgoBolmJfZyo6bADx01KB5A 4HipqlYBOBaFwTCcZveG3orsrkOLLCQnK3MmT59rmslZSKMQMPxegmjji33ggokbL7ml +cTbuxAoM3yO00Odwd+gfKRdwy2ERUKxrQNMX3JTQ3hD0ooh34xX6dz+jKGYhuFnTLou ltGQ== X-Gm-Message-State: AHQUAuaqgLGLc4Dz+1ThRZntjM0LOBCTW/jnHb53BNxFwyD+nIkCCs2L FFjoKDestW+AjPAzByhbEOKfI71q X-Google-Smtp-Source: AHgI3Ia4jHTtEQUrtcUxkmk/ED6eZ4GchrTAKALiWUhVKCtpKtmUGELmQvTCkSdTkfiIahKnTigY+g== X-Received: by 2002:a17:902:461:: with SMTP id 88mr2096514ple.216.1551109909743; Mon, 25 Feb 2019 07:51:49 -0800 (PST) Received: from localhost.localdomain ([125.142.23.13]) by smtp.googlemail.com with ESMTPSA id p78sm15210418pfa.84.2019.02.25.07.51.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Feb 2019 07:51:49 -0800 (PST) From: Suwan Kim To: stern@rowland.harvard.edu Cc: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org Subject: [PATCH] usb: ehci: Cleanup itd/sidt_complete() Date: Tue, 26 Feb 2019 00:51:44 +0900 Message-Id: <20190225155144.17424-1-suwan.kim027@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;