From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: linux-pci@vger.kernel.org,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>
Subject: Re: [PATCH 09/10] PCI/VC: Use FIELD_GET()
Date: Wed, 11 Oct 2023 14:39:59 +0300 (EEST) [thread overview]
Message-ID: <5bf5368a-97cb-eac7-2880-4fc654f36f3@linux.intel.com> (raw)
In-Reply-To: <20231010204436.1000644-10-helgaas@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]
On Tue, 10 Oct 2023, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Use FIELD_GET() to remove dependences on the field position, i.e., the
> shift value. No functional change intended.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/pci/vc.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/vc.c b/drivers/pci/vc.c
> index 5fc59ac31145..a4ff7f5f66dd 100644
> --- a/drivers/pci/vc.c
> +++ b/drivers/pci/vc.c
> @@ -6,6 +6,7 @@
> * Author: Alex Williamson <alex.williamson@redhat.com>
> */
>
> +#include <linux/bitfield.h>
> #include <linux/device.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> @@ -201,9 +202,9 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos,
> /* Extended VC Count (not counting VC0) */
> evcc = cap1 & PCI_VC_CAP1_EVCC;
> /* Low Priority Extended VC Count (not counting VC0) */
> - lpevcc = (cap1 & PCI_VC_CAP1_LPEVCC) >> 4;
> + lpevcc = FIELD_GET(PCI_VC_CAP1_LPEVCC, cap1);
> /* Port Arbitration Table Entry Size (bits) */
> - parb_size = 1 << ((cap1 & PCI_VC_CAP1_ARB_SIZE) >> 10);
> + parb_size = 1 << FIELD_GET(PCI_VC_CAP1_ARB_SIZE, cap1);
>
> /*
> * Port VC Control Register contains VC Arbitration Select, which
> @@ -231,7 +232,7 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos,
> int vcarb_offset;
>
> pci_read_config_dword(dev, pos + PCI_VC_PORT_CAP2, &cap2);
> - vcarb_offset = ((cap2 & PCI_VC_CAP2_ARB_OFF) >> 24) * 16;
> + vcarb_offset = FIELD_GET(PCI_VC_CAP2_ARB_OFF, cap2) * 16;
>
> if (vcarb_offset) {
> int size, vcarb_phases = 0;
> @@ -277,7 +278,7 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos,
>
> pci_read_config_dword(dev, pos + PCI_VC_RES_CAP +
> (i * PCI_CAP_VC_PER_VC_SIZEOF), &cap);
> - parb_offset = ((cap & PCI_VC_RES_CAP_ARB_OFF) >> 24) * 16;
> + parb_offset = FIELD_GET(PCI_VC_RES_CAP_ARB_OFF, cap) * 16;
> if (parb_offset) {
> int size, parb_phases = 0;
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
next prev parent reply other threads:[~2023-10-11 11:40 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 20:44 [PATCH 00/10] PCI: Use FIELD_GET() and FIELD_PREP() Bjorn Helgaas
2023-10-10 20:44 ` [PATCH 01/10] PCI: Use FIELD_GET() Bjorn Helgaas
2023-10-11 10:50 ` Jonathan Cameron
2023-10-11 11:24 ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 02/10] PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk Bjorn Helgaas
2023-10-11 10:59 ` Jonathan Cameron
2023-10-11 11:31 ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 03/10] PCI/ASPM: Use FIELD_GET() Bjorn Helgaas
2023-10-10 21:07 ` Bjorn Helgaas
2023-10-10 20:44 ` [PATCH 04/10] PCI/ATS: Show PASID Capability register width in bitmasks Bjorn Helgaas
2023-10-11 11:00 ` Jonathan Cameron
2023-10-11 11:31 ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 05/10] PCI/ATS: Use FIELD_GET() Bjorn Helgaas
2023-10-11 11:02 ` Jonathan Cameron
2023-10-11 11:20 ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 06/10] PCI/DPC: " Bjorn Helgaas
2023-10-11 11:01 ` Ilpo Järvinen
2023-10-13 11:23 ` Ilpo Järvinen
2023-10-13 20:02 ` Bjorn Helgaas
2023-10-16 12:55 ` Ilpo Järvinen
2023-10-16 15:10 ` Ilpo Järvinen
2023-10-16 15:14 ` Ilpo Järvinen
2023-10-11 11:07 ` Jonathan Cameron
2023-10-11 11:13 ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 07/10] PCI/PME: " Bjorn Helgaas
2023-10-11 11:10 ` Jonathan Cameron
2023-10-11 11:38 ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 08/10] PCI/PTM: " Bjorn Helgaas
2023-10-11 11:11 ` Jonathan Cameron
2023-10-11 11:15 ` Ilpo Järvinen
2023-10-10 20:44 ` [PATCH 09/10] PCI/VC: " Bjorn Helgaas
2023-10-11 11:13 ` Jonathan Cameron
2023-10-11 11:39 ` Ilpo Järvinen [this message]
2023-10-10 20:44 ` [PATCH 10/10] PCI/portdrv: " Bjorn Helgaas
2023-10-11 11:14 ` Jonathan Cameron
2023-10-11 11:40 ` Ilpo Järvinen
2023-10-11 14:50 ` [PATCH 00/10] PCI: Use FIELD_GET() and FIELD_PREP() Kuppuswamy Sathyanarayanan
2023-10-18 21:00 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5bf5368a-97cb-eac7-2880-4fc654f36f3@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=bhelgaas@google.com \
--cc=helgaas@kernel.org \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox