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 08/10] PCI/PTM: Use FIELD_GET()
Date: Wed, 11 Oct 2023 14:15:36 +0300 (EEST) [thread overview]
Message-ID: <638694d-969a-1076-1d28-b4271f4ed68b@linux.intel.com> (raw)
In-Reply-To: <20231010204436.1000644-9-helgaas@kernel.org>
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>
You seem to be using FIELD_PREP() too below.
> ---
> drivers/pci/pcie/ptm.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c
> index b4e5f553467c..7cfb6c0d5dcb 100644
> --- a/drivers/pci/pcie/ptm.c
> +++ b/drivers/pci/pcie/ptm.c
> @@ -4,6 +4,7 @@
> * Copyright (c) 2016, Intel Corporation.
> */
>
> +#include <linux/bitfield.h>
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/pci.h>
> @@ -53,7 +54,7 @@ void pci_ptm_init(struct pci_dev *dev)
> pci_add_ext_cap_save_buffer(dev, PCI_EXT_CAP_ID_PTM, sizeof(u32));
>
> pci_read_config_dword(dev, ptm + PCI_PTM_CAP, &cap);
> - dev->ptm_granularity = (cap & PCI_PTM_GRANULARITY_MASK) >> 8;
> + dev->ptm_granularity = FIELD_GET(PCI_PTM_GRANULARITY_MASK, cap);
>
> /*
> * Per the spec recommendation (PCIe r6.0, sec 7.9.15.3), select the
> @@ -146,7 +147,7 @@ static int __pci_enable_ptm(struct pci_dev *dev)
>
> ctrl |= PCI_PTM_CTRL_ENABLE;
> ctrl &= ~PCI_PTM_GRANULARITY_MASK;
> - ctrl |= dev->ptm_granularity << 8;
> + ctrl |= FIELD_PREP(PCI_PTM_GRANULARITY_MASK, dev->ptm_granularity);
> if (dev->ptm_root)
> ctrl |= PCI_PTM_CTRL_ROOT;
>
>
--
i.
next prev parent reply other threads:[~2023-10-11 11:16 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 [this message]
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
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=638694d-969a-1076-1d28-b4271f4ed68b@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
all inboxes | Powered by JetHome®