From patchwork Fri Apr 30 07:15:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 12232767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FFC7C43461 for ; Fri, 30 Apr 2021 07:17:58 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0BFE361424 for ; Fri, 30 Apr 2021 07:17:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0BFE361424 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VGnBo/AVgT8P0BkKxl2O9DwrarWcFsqrjKXA5O3psKM=; b=YWW2c5HkCcuQ3/zON8SplH63X Jd4FUvsxusry8/L+ZUJEubAE4x5A1cxa9WsbfYujwA1XvqJbhGPmhDr9prlgsDAK9t+GxYh7ScS1D adXygsuSCEhRvNyaVVZ8WTaUv4bDQjQts38VEIbBRknVnqT4Hox624sIsbhQzGspyr+DzxAwPFGhj QnEBNdDYdblUmUbklOKv+PO3w5Vpsna2UDpfItdnkiDebYZS2cyp6acqsS7oX8CG/JvvqYpDzQoLm NxFACwsSifnQFLcV7JRSQDn+8piMyjQTEWeQ5kR5xIOd4XloISAy1Xw+hOLUqLL3H2dnYuphPziv7 t4IjPgROA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lcNNZ-007PPc-5R; Fri, 30 Apr 2021 07:16:02 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcNNP-007PNN-Qv; Fri, 30 Apr 2021 07:15:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=Y6p/N2IMKgTVs8mPSuLOuxZ5NAQHWn+tSEJ0GJfZpqI=; b=siPeqlR2qByqCKcmEXhrUCfw3H ml27eEGJzqU0xHul8QOpiphD/Su7ChpgDQH0kOJVUdg3YJKgVNfm7szEpod26n/xkeIINj6xcf0aF nxQODqBp44p2Oa3FPysfy3HdEnsfokxioKUuwDs8iRzxSlCw+8lGQqQedB+RzGxI0A7eROUvC25GC Ai2LyAv9DovsEjqnMKVNNMf/7NNnsUl8t5zTFDAFu/+J7t6UrpA6bfmr8K80q/h4q8kvwMi6c/dRz FlJ6qbPg0ieJptYH37iuJm/J9T9xyP7etj2EEU5XjaN6SgO5LtxCU1khbS4E4wvkMZtBV1AZT7tr4 kixnXSFg==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcNNM-001C2U-4k; Fri, 30 Apr 2021 07:15:50 +0000 X-UUID: 4ed6b260b323458f894865969c6d1502-20210430 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Y6p/N2IMKgTVs8mPSuLOuxZ5NAQHWn+tSEJ0GJfZpqI=; b=qjfqghnJNaPE6fLiCO1jqYckzKmzCdDBxI/B7rCW04yH1ZjTARXmvCiKtyBONoVp172OWidP14dOhfqDoyymHk9L8CCt2vwmFygXhsuBarR1yUHI68gOunKbKqBDlchpcSdLL5J47Vci8xbC5JK+Od/ZXqfnx5imoI5oKDyqhKE=; X-UUID: 4ed6b260b323458f894865969c6d1502-20210430 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1186803886; Fri, 30 Apr 2021 00:15:43 -0700 Received: from MTKMBS06N2.mediatek.inc (172.21.101.130) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 30 Apr 2021 00:15:42 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 30 Apr 2021 15:15:40 +0800 Received: from mtkslt301.mediatek.inc (10.21.14.114) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 30 Apr 2021 15:15:33 +0800 From: Chunfeng Yun To: Mathias Nyman CC: Chunfeng Yun , Greg Kroah-Hartman , Matthias Brugger , , , , , "Ikjoon Jang" , Eddie Hung Subject: [PATCH 2/3] usb: xhci-mtk: remove unnecessary assignments in periodic TT scheduler Date: Fri, 30 Apr 2021 15:15:31 +0800 Message-ID: <20210430071532.51794-2-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210430071532.51794-1-chunfeng.yun@mediatek.com> References: <20210430071532.51794-1-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 3B889F7DC6F4CC29E02595BDB4B5B9FBE3C2A6CAC0E4967797B6CB878464D79C2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210430_001549_111233_605D7402 X-CRM114-Status: GOOD ( 13.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ikjoon Jang Remove unnecessary variables in check_sch_bw(). No functional changes, just for better readability. Signed-off-by: Ikjoon Jang Signed-off-by: Chunfeng Yun --- drivers/usb/host/xhci-mtk-sch.c | 37 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c index 8b90da5a6ed1..9fb75085e40f 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -476,6 +476,9 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset) u32 start_cs, last_cs; int i; + if (!sch_ep->sch_tt) + return 0; + start_ss = offset % 8; if (sch_ep->ep_type == ISOC_OUT_EP) { @@ -603,54 +606,42 @@ static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep) static int check_sch_bw(struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep) { + const u32 esit_boundary = get_esit_boundary(sch_ep); + const u32 bw_boundary = get_bw_boundary(sch_ep->speed); u32 offset; - u32 min_bw; - u32 min_index; u32 worst_bw; - u32 bw_boundary; - u32 esit_boundary; - u32 min_num_budget; - u32 min_cs_count; + u32 min_bw = ~0; + int min_index = -1; int ret = 0; /* * Search through all possible schedule microframes. * and find a microframe where its worst bandwidth is minimum. */ - min_bw = ~0; - min_index = 0; - min_cs_count = sch_ep->cs_count; - min_num_budget = sch_ep->num_budget_microframes; - esit_boundary = get_esit_boundary(sch_ep); for (offset = 0; offset < sch_ep->esit; offset++) { - if (sch_ep->sch_tt) { - ret = check_sch_tt(sch_ep, offset); - if (ret) - continue; - } + ret = check_sch_tt(sch_ep, offset); + if (ret) + continue; if ((offset + sch_ep->num_budget_microframes) > esit_boundary) break; worst_bw = get_max_bw(sch_bw, sch_ep, offset); + if (worst_bw > bw_boundary) + continue; + if (min_bw > worst_bw) { min_bw = worst_bw; min_index = offset; - min_cs_count = sch_ep->cs_count; - min_num_budget = sch_ep->num_budget_microframes; } if (min_bw == 0) break; } - bw_boundary = get_bw_boundary(sch_ep->speed); - /* check bandwidth */ - if (min_bw > bw_boundary) + if (min_index < 0) return ret ? ret : -ESCH_BW_OVERFLOW; sch_ep->offset = min_index; - sch_ep->cs_count = min_cs_count; - sch_ep->num_budget_microframes = min_num_budget; return load_ep_bw(sch_bw, sch_ep, true); }