From patchwork Tue Oct 10 20:44:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 13416137 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8A48CD98C0 for ; Tue, 10 Oct 2023 20:44:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343715AbjJJUot (ORCPT ); Tue, 10 Oct 2023 16:44:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343770AbjJJUos (ORCPT ); Tue, 10 Oct 2023 16:44:48 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEFF294; Tue, 10 Oct 2023 13:44:47 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49463C433C7; Tue, 10 Oct 2023 20:44:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696970687; bh=oX9EO48DOGu50ALvL0FYfxc5TiflrGjNP6ANRfmI9nU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dcp3Ta1ofBM/0hVvBvQbyhk73p/llhkdXpQaTl1ZjbgsdgaaoEmhzgGWOnkhv6Qe5 Xer7iep60LI6bO6zzWTJ34UHf8Fk15BdG+WOEEO7IA13mVNGzSF8kUlhHh/agRKMuq NS26PXFgBE3R4TDGJ0qvUynINjbx3Zo/Va0BTbruZ7kCZ3vS5bVq7R5nBJA8dW//Wo Vnnu5lskieJpGXUYtWzQiejyyaUc37rHZ9AaD29ewJjV4QAfe0bAjlwLMe/BhCYpV5 V55Ks1gx7/eD/5s/KTOFbUsKnbzkPCHG78UlYNsDCDybtqO+/AyRaVf+67Kf/FQDEN TG3LDBJAHorAg== From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Jonathan Cameron , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Lorenzo Pieralisi , linux-kernel@vger.kernel.org, Bjorn Helgaas , Nirmoy Das Subject: [PATCH 02/10] PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk Date: Tue, 10 Oct 2023 15:44:28 -0500 Message-Id: <20231010204436.1000644-3-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010204436.1000644-1-helgaas@kernel.org> References: <20231010204436.1000644-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Bjorn Helgaas Use FIELD_GET() to remove dependences on the field position, i.e., the shift value. No functional change intended. Separate because this isn't as trivial as the other FIELD_GET() changes. See 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse") Signed-off-by: Bjorn Helgaas Cc: Nirmoy Das Reviewed-by: Jonathan Cameron Reviewed-by: Ilpo Järvinen --- drivers/pci/pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 848c9ee65d7f..5dc6e7cdfb71 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3751,14 +3751,14 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar) return 0; pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap); - cap &= PCI_REBAR_CAP_SIZES; + cap = FIELD_GET(PCI_REBAR_CAP_SIZES, cap); /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */ if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f && - bar == 0 && cap == 0x7000) - cap = 0x3f000; + bar == 0 && cap == 0x700) + return 0x3f00; - return cap >> 4; + return cap; } EXPORT_SYMBOL(pci_rebar_get_possible_sizes);