From mboxrd@z Thu Jan 1 00:00:00 1970 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham 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 C4162C43461 for ; Thu, 6 May 2021 06:31:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A0EB4613E6 for ; Thu, 6 May 2021 06:31:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229622AbhEFGcV (ORCPT ); Thu, 6 May 2021 02:32:21 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:46580 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230424AbhEFGcU (ORCPT ); Thu, 6 May 2021 02:32:20 -0400 X-UUID: 337a7d8c49fd4b099ecdb15c56b60a71-20210506 X-UUID: 337a7d8c49fd4b099ecdb15c56b60a71-20210506 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1264631471; Thu, 06 May 2021 14:31:20 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 6 May 2021 14:31:18 +0800 Received: from mtkslt301.mediatek.inc (10.21.14.114) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 6 May 2021 14:31:17 +0800 From: Chunfeng Yun To: Mathias Nyman CC: Chunfeng Yun , Greg Kroah-Hartman , Matthias Brugger , , , , , Ikjoon Jang , Eddie Hung Subject: [PATCH v2 2/3] usb: xhci-mtk: remove unnecessary assignments in periodic TT scheduler Date: Thu, 6 May 2021 14:31:15 +0800 Message-ID: <20210506063116.41757-2-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210506063116.41757-1-chunfeng.yun@mediatek.com> References: <20210506063116.41757-1-chunfeng.yun@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 3AD3668E849FEE7EE933129F7B2DD64AFC12A0E253AB5CFDDB7F0114C4F524AB2000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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 --- v2: no changes --- 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); } -- 2.18.0