Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6739104rdb; Tue, 2 Jan 2024 11:33:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFc2zC9jwnjSFUbUaDErRbV4WLWerC7D2vhYL4jDB7CJlHQGSD2e00ZxIBMc/Rdumqe45sP X-Received: by 2002:a05:620a:2186:b0:781:62cf:85ef with SMTP id g6-20020a05620a218600b0078162cf85efmr13497551qka.49.1704224002086; Tue, 02 Jan 2024 11:33:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704224002; cv=none; d=google.com; s=arc-20160816; b=pcfyOrTuRl40rlHxtx/Z6rf0Yhwfl6GUWE61l7ITXq/JLmHYAjegkIBR/YNlbNGF9O zhefQQRiUCcte8xZWRs6GAPtAAdIc3o/C4pTFos/cJw+T4z+6HS42N4R6j8xjoMLOkNr Ua/R1/Yxsz9CRNTcM8cBVvKujKrnJCQ5f3AtouXaKyEA8SkbvJ+E0Gssc1pwJvWX33Pt qE0I+d1q5Vm6TIurxY1LVSZuT6mssc2fAOSnwUA6po8NKws+IP+CJc+dy/X4I55WX/at Yz8zX819YM0LR0LuvM5gWwbnwpkKTRikU+d6sZWrdI/+YBYryI1g5ZWf+X8lVZPRA/b8 Hxyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=EB8sT5wgcgVMIrbYDePIvUmnwGjgDoDJ3qyqAdGeARs=; fh=SnuNAHeD2CDeWEwrWsbpHM1muWDT7gSAURXCbGYnCtk=; b=kXs/eP/OuXHWgZ6Xv8zAnVdjDA5ieXN5fULYsc7XarY783phrp1nd+gM38sfejd723 H3nSGMkCsFrWTZ+oqLGLxB+BJvvjYfOGJXBLkopPMeWM5d2w7L6a28WSme8TIao0MLwD KMsjX8kMZEqy7or19dXq4uCDfjC/H5PGlihwvZ4MT/oFT0M8ggDxmfnORKbgGRWxJao0 +/C0su/WkHMURg8X/fuR4OE+/Za8/Gr0PfECr3vWnXaUeAP+GABlPIYHnanaMaGnBN0y cIkNzmhLZ6l7O/UP6vdwslb11VeguMO8nr8pGM3Sln1OlMN3bIMrhkTPoBj8156Bg5VR lk3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nIMz+fNY; spf=pass (google.com: domain of linux-wireless+bounces-1394-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1394-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g1-20020a37e201000000b00781cb2fb3b1si4135701qki.51.2024.01.02.11.33.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 11:33:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1394-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nIMz+fNY; spf=pass (google.com: domain of linux-wireless+bounces-1394-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1394-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D3A141C22776 for ; Tue, 2 Jan 2024 19:33:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3ED491640B; Tue, 2 Jan 2024 19:33:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nIMz+fNY" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0EFA1640D for ; Tue, 2 Jan 2024 19:33:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2ccec119587so38551481fa.0 for ; Tue, 02 Jan 2024 11:33:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704223991; x=1704828791; darn=vger.kernel.org; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=EB8sT5wgcgVMIrbYDePIvUmnwGjgDoDJ3qyqAdGeARs=; b=nIMz+fNYdSu706najX2i64c1H1GxU5HiqUfNxyI6i7rZWG0sZbE9Y5R+f6O8qntJNW g6FgtI9U0zY0+GcbTsM+eQUUsy61L8aWLsoLhJg8yh0mG7PIrr+HxGVYJwYLhJ3IOm81 yodLiG02yY98FYgFhJqQ4n5+dcon5ZL+nzAyICHud7P6AvCWHTYRVb8d1BmUeZ/73Guo aSTKwyNYy0g4JPwcBAKgxaVH7Bq8ZkrkPE8u/MhjDk/Or/MQp1jBcYZ6bBynd1oRCnfx JH2W6EaU3ZLI1Go5u0bzcC0+7DbiKmO12VTGl2MUFaEwoB7vRQPnD/t6e9egAeGiH3NN W+0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704223991; x=1704828791; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=EB8sT5wgcgVMIrbYDePIvUmnwGjgDoDJ3qyqAdGeARs=; b=PdrMfI+udTX6DxHD59edscLCrjZbAg9WrPh3mRmone1i6AB/rC/dt+qKus6xFERBRp ZSV0ehNiA0djWuvkTo18IYGmi9+RjMYSBfEJhKtoav4Z2oNuVFke1n6MIjPA0ovYnIM9 Iw99GiOcyuA45vS7AZYCEK4DPt/d63ExZWk/T7atLmc/Ipn4tgtPgzyPzsctAViZNFY2 lHdOICcny9kY65bVITDAXHsRNDtwe2WBuTJK7g9uJUZbQdHpsAB3B7JacombNzdApeVH nSPuolKsK/sNdh/FlAAdmsASnfSh6ge1FQroNPBKFDAkJrCYhN9q/Zy5noZHEWv00SF6 FFWw== X-Gm-Message-State: AOJu0Yz+pRgBjb1kowamLcZjJmeFT9pCE2YPoR/RPcBinZAQOvIfQnN2 2Hf1yYiQGmkxliIe3bnEdCitdst1iFM= X-Received: by 2002:a2e:9049:0:b0:2cc:7849:f4b with SMTP id n9-20020a2e9049000000b002cc78490f4bmr8323802ljg.97.1704223990491; Tue, 02 Jan 2024 11:33:10 -0800 (PST) Received: from [192.168.1.50] ([81.196.40.51]) by smtp.gmail.com with ESMTPSA id h8-20020a2ebc88000000b002cd0465f297sm1050735ljf.95.2024.01.02.11.33.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Jan 2024 11:33:10 -0800 (PST) Message-ID: <761e6836-6cd6-4930-91b6-0446834655c5@gmail.com> Date: Tue, 2 Jan 2024 21:33:07 +0200 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "linux-wireless@vger.kernel.org" Cc: Jes Sorensen , Ping-Ke Shih From: Bitterblue Smith Subject: [PATCH v2] wifi: rtl8xxxu: Fix off by one initial RTS rate Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit rtl8xxxu_set_basic_rates() sets the wrong initial RTS rate. It sets the next higher rate than the one it should set, e.g. 36M instead of 24M. The while loop was supposed to find the index of the most significant bit which is 1, but it was copied incorrectly from the vendor driver. Use __fls() instead. Signed-off-by: Bitterblue Smith --- v2: - Use __fls(). --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 180907319e8c..2b1b633a1f96 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4839,10 +4839,9 @@ static void rtl8xxxu_set_basic_rates(struct rtl8xxxu_priv *priv, u32 rate_cfg) dev_dbg(&priv->udev->dev, "%s: rates %08x\n", __func__, rate_cfg); - while (rate_cfg) { - rate_cfg = (rate_cfg >> 1); - rate_idx++; - } + if (rate_cfg) + rate_idx = __fls(rate_cfg); + rtl8xxxu_write8(priv, REG_INIRTS_RATE_SEL, rate_idx); } -- 2.43.0