Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1089225pxy; Wed, 5 May 2021 23:32:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs+DMEodLlRZzEc0OSFqo9FIWCTQ7A91GZd0BxBcA7uohOq4k+AsdAZH53bk3KCfuKi6Z+ X-Received: by 2002:a17:903:4104:b029:ed:7bda:412c with SMTP id r4-20020a1709034104b02900ed7bda412cmr2779296pld.31.1620282758241; Wed, 05 May 2021 23:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620282758; cv=none; d=google.com; s=arc-20160816; b=jjQgkv/a6QqnQgpK1Znw2Hkj3oRFyAK/hSBv23/lRL6h/cK2lrcmOuWPbCXZCnUdOF mJeADcLF80MMLAe/EViM6MaCcyXjh/CHJV2Jde7/I4rAICqwa4IIRKqzdDLIL/aPaHN1 GQJOJxfZP8OvYo7uQBf7MVUNtHIfd4m+pvVdeyXh9SaSRn50XMdiBiknp5zC7dsDXT8z TsDLZh6wbVENisSGW7IFGKZidWi4DAUaAoM7fCI6eY9FJCcAuz2ctPBx4F4JTaNmHq36 8ipNTW75ui4ItshGPo03M7v+z9VxngSZbFX0MTUqGgmQbzyiuCeNgT/7JEg7eqdjE0Wq bskQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=KdcmUA+CgPpY56O2SVnLroC/P9H2EGeuga4WtJ1so/c=; b=qGszRBoBvukggQj8P5qHlmza9L4HAgliw/tTFz4AmR2dZY/YvurT4xmXFWaXEB57qx QpzzBzDBNGjd5pQ1oMiaU+PNlzavwRqi1GtarhGZ0ysHd6ZXJHyfhX6MZwCg4zCPAfgZ vzk8+SP1/O10jaZyvcQUjUwj66U1rt8nRkwkhZr1ypPbNNNUpScS85C+abVySAjGlUdF WRgPhwhSYf/q70v0Bj8X0b4L/IsiamDOqrQ2wGWosvWcrxngxWlUcK34U1ficwSoKG69 KvQNK2O0hDXyW0hX3DoyhPY53rRlbB4PIcyCg3jChpPV2qqimPGJ6VGHg/gdr4QgVcS7 A1zA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f3si1918090pjh.27.2021.05.05.23.32.26; Wed, 05 May 2021 23:32:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232274AbhEFGcV (ORCPT + 99 others); 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-kernel@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