[PATCH 0/8] PCI/treewide: PCIe Link Width field access cleanup

Ilpo Järvinen posted 8 patches 2 years, 3 months ago
drivers/infiniband/hw/hfi1/pcie.c          |  5 +++--
drivers/media/pci/cobalt/cobalt-driver.c   | 11 ++++++-----
drivers/net/ethernet/intel/igb/e1000_mac.c |  6 +++---
drivers/pci/controller/dwc/pcie-tegra194.c |  9 ++++-----
drivers/pci/controller/pci-mvebu.c         |  2 +-
drivers/pci/pci-sysfs.c                    |  5 ++---
drivers/pci/pci.c                          |  6 +++---
drivers/scsi/esas2r/esas2r_ioctl.c         |  8 ++++----
drivers/scsi/qla2xxx/qla_os.c              |  3 ++-
9 files changed, 28 insertions(+), 27 deletions(-)
[PATCH 0/8] PCI/treewide: PCIe Link Width field access cleanup
Posted by Ilpo Järvinen 2 years, 3 months ago
Instead of custom code to extract the PCIe Negotiated and Maximum Link
Width fields, make the code more obvious using FIELD_GET/PREP().

Ilpo Järvinen (8):
  IB/hfi1: Use FIELD_GET() to extract Link Width
  media: cobalt: Use FIELD_GET() to extract Link Width
  igb: Use FIELD_GET() to extract Link Width
  PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields
  PCI: mvebu: Use FIELD_PREP() with Link Width
  PCI: Use FIELD_GET() to extract Link Width
  scsi: esas2r: Use FIELD_GET() to extract Link Width
  scsi: qla2xxx: Use FIELD_GET() to extract Link Width

 drivers/infiniband/hw/hfi1/pcie.c          |  5 +++--
 drivers/media/pci/cobalt/cobalt-driver.c   | 11 ++++++-----
 drivers/net/ethernet/intel/igb/e1000_mac.c |  6 +++---
 drivers/pci/controller/dwc/pcie-tegra194.c |  9 ++++-----
 drivers/pci/controller/pci-mvebu.c         |  2 +-
 drivers/pci/pci-sysfs.c                    |  5 ++---
 drivers/pci/pci.c                          |  6 +++---
 drivers/scsi/esas2r/esas2r_ioctl.c         |  8 ++++----
 drivers/scsi/qla2xxx/qla_os.c              |  3 ++-
 9 files changed, 28 insertions(+), 27 deletions(-)

-- 
2.30.2

Re: [PATCH 0/8] PCI/treewide: PCIe Link Width field access cleanup
Posted by Jonathan Cameron 2 years, 3 months ago
On Mon, 11 Sep 2023 15:14:53 +0300
Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:

> Instead of custom code to extract the PCIe Negotiated and Maximum Link
> Width fields, make the code more obvious using FIELD_GET/PREP().
> 
> Ilpo Järvinen (8):
>   IB/hfi1: Use FIELD_GET() to extract Link Width
>   media: cobalt: Use FIELD_GET() to extract Link Width
>   igb: Use FIELD_GET() to extract Link Width
>   PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields
>   PCI: mvebu: Use FIELD_PREP() with Link Width
>   PCI: Use FIELD_GET() to extract Link Width
>   scsi: esas2r: Use FIELD_GET() to extract Link Width
>   scsi: qla2xxx: Use FIELD_GET() to extract Link Width

I'd like to see this done more generally rather than just
for this one field, but I guess it's a step in the right direction.
I'm particularly in favour of the cases where 4 was used
rather than the define.

> 
>  drivers/infiniband/hw/hfi1/pcie.c          |  5 +++--

As an example, immediately above the link width code is link
speed code.  Using FIELD_GET there as well would avoid people
having to 'know' that field is at 0 shift.

So for what you have 
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
but I'd like to see this taken further.

A few minor comments in some of the individual patches.

>  drivers/media/pci/cobalt/cobalt-driver.c   | 11 ++++++-----
>  drivers/net/ethernet/intel/igb/e1000_mac.c |  6 +++---
>  drivers/pci/controller/dwc/pcie-tegra194.c |  9 ++++-----
>  drivers/pci/controller/pci-mvebu.c         |  2 +-
>  drivers/pci/pci-sysfs.c                    |  5 ++---
>  drivers/pci/pci.c                          |  6 +++---
>  drivers/scsi/esas2r/esas2r_ioctl.c         |  8 ++++----
>  drivers/scsi/qla2xxx/qla_os.c              |  3 ++-
>  9 files changed, 28 insertions(+), 27 deletions(-)
>