From nobody Thu Nov 28 14:01:59 2024 Received: from us-smtp-delivery-162.mimecast.com (us-smtp-delivery-162.mimecast.com [170.10.133.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F54F1CCB5E for ; Tue, 1 Oct 2024 17:32:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.162 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727803936; cv=none; b=JLZl+czgeMcz86MJ3JQnizw2nB6GoQVVU7d6O6qcBrxOcMq/CEVGUlvKcLMBFHoYd+w7CKzbbCdsvl/1E2J0qm+PGeK1PumvrDKCIJ4ZrkKhHLqZbS/h97iLCdTefl0cT0OUFTxSOxgXjiz7jpXtYtD7yR/w6dJDU8biFEDVjmQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727803936; c=relaxed/simple; bh=sVXoRa3TsqDBKsgTaREp1zzsof1dAq+XUY/Prh3ZPu4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Ao+ldZziO/ZN3Xzd849b7PB2OSNTdVPLq18K3xs90PMK9dzDViU+K/fsa/hmVnwvKDmbxVgOIOVhOdMJDeoLERfHB0jxgVtv1QwbARaXXXJOxpdBd1E1cmb/Vzgfn+5XrJdlb9+OCWGopm9YYqkCObux4phNsQ7mL+XrmW+HzcQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=hp.com; spf=pass smtp.mailfrom=hp.com; dkim=pass (1024-bit key) header.d=hp.com header.i=@hp.com header.b=VP5UEnGj; arc=none smtp.client-ip=170.10.133.162 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=hp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hp.com header.i=@hp.com header.b="VP5UEnGj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hp.com; s=mimecast20180716; t=1727803932; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sVXoRa3TsqDBKsgTaREp1zzsof1dAq+XUY/Prh3ZPu4=; b=VP5UEnGj0QS+SARoDlUp4YPdPSbCzs9ZBezkM4oaru4qBWtSJzyEpjKIdjGbIIFfORyGrA XP2/g+o1bpdBiHD4l4L8GiWRFJarRLqw8lYUPK5TK/aZc3W4lGUEEiE4EH76V4mIqVg7By AW7u5FzXexXib7yIbcCSsPpPirlDpOE= Received: from g8t13017g.inc.hp.com (g8t13017g.inc.hp.com [15.72.64.135]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-168-GrdOUHwCOLyxMv2YdaWF1Q-1; Tue, 01 Oct 2024 13:32:11 -0400 X-MC-Unique: GrdOUHwCOLyxMv2YdaWF1Q-1 Received: from g7t14407g.inc.hpicorp.net (g7t14407g.inc.hpicorp.net [15.63.19.131]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by g8t13017g.inc.hp.com (Postfix) with ESMTPS id BAAA160008BE; Tue, 1 Oct 2024 17:32:10 +0000 (UTC) Received: from localhost.localdomain (unknown [15.53.255.151]) by g7t14407g.inc.hpicorp.net (Postfix) with ESMTP id 4CB5D18; Tue, 1 Oct 2024 17:32:09 +0000 (UTC) From: Alexandru Gagniuc To: gregkh@linuxfoundation.org, stable@vger.kernel.org Cc: qin.wan@hp.com, andreas.noever@gmail.com, michael.jamet@intel.com, mika.westerberg@linux.intel.com, YehezkelShB@gmail.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandru Gagniuc Subject: [PATCH 6.6 06/14] thunderbolt: Use weight constants in tb_usb3_consumed_bandwidth() Date: Tue, 1 Oct 2024 17:31:01 +0000 Message-Id: <20241001173109.1513-7-alexandru.gagniuc@hp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241001173109.1513-1-alexandru.gagniuc@hp.com> References: <20241001173109.1513-1-alexandru.gagniuc@hp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: hp.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" From: Mika Westerberg [ Upstream commit 4d24db0c801461adeefd7e0bdc98c79c60ccefb0 ] Instead of magic numbers use the constants we introduced in the previous commit to make the code more readable. No functional changes. Signed-off-by: Mika Westerberg Signed-off-by: Qin Wan Signed-off-by: Alexandru Gagniuc --- drivers/thunderbolt/tunnel.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c index 9947b9d0d51a..b81344c6c06a 100644 --- a/drivers/thunderbolt/tunnel.c +++ b/drivers/thunderbolt/tunnel.c @@ -1747,14 +1747,17 @@ static int tb_usb3_activate(struct tb_tunnel *tunne= l, bool activate) static int tb_usb3_consumed_bandwidth(struct tb_tunnel *tunnel, int *consumed_up, int *consumed_down) { - int pcie_enabled =3D tb_acpi_may_tunnel_pcie(); + int pcie_weight =3D tb_acpi_may_tunnel_pcie() ? TB_PCI_WEIGHT : 0; =20 /* * PCIe tunneling, if enabled, affects the USB3 bandwidth so * take that it into account here. */ - *consumed_up =3D tunnel->allocated_up * (3 + pcie_enabled) / 3; - *consumed_down =3D tunnel->allocated_down * (3 + pcie_enabled) / 3; + *consumed_up =3D tunnel->allocated_up * + (TB_USB3_WEIGHT + pcie_weight) / TB_USB3_WEIGHT; + *consumed_down =3D tunnel->allocated_down * + (TB_USB3_WEIGHT + pcie_weight) / TB_USB3_WEIGHT; + return 0; } =20 --=20 2.45.1