Skip to contentSkip to conversation

drm/pci: use PCI_EXP_LNKCAP_SLS_2_5GB/5_0GB instead of hardcoded values

PATCH In review Jingoo Han 3 participants 4 messages Feb 6, 2013

Subsystems (3)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/1 drm/pci: use PCI_EXP_LNKCAP_SLS_2_5GB/5_0GB instead of hardcoded values

Use PCI_EXP_LNKCAP_SLS_2_5GB and PCI_EXP_LNKCAP_SLS_5_0GB instead of hardcoded values for readability. These bit definitions were added by commit 130f1b8 ("PCI: Add PCIe Link Capability link speed and width names")

---
 drivers/gpu/drm/drm_pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_pci.c +2 -2
index 754bc96..11c8add 100644
@@ -504,9 +504,9 @@ int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask)
 		if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_8_0GB)
 			*mask |= DRM_PCIE_SPEED_80;
 	} else {
-		if (lnkcap & 1)
+		if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB)
 			*mask |= DRM_PCIE_SPEED_25;
-		if (lnkcap & 2)
+		if (lnkcap & PCI_EXP_LNKCAP_SLS_5_0GB)
 			*mask |= DRM_PCIE_SPEED_50;
 	}
 
Signature · 1 line
1.7.2.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jingoo Han

Use PCI_EXP_LNKCAP_SLS_2_5GB and PCI_EXP_LNKCAP_SLS_5_0GB instead of hardcoded values for readability. These bit definitions were added by commit 130f1b8 ("PCI: Add PCIe Link Capability link speed and width names")

Quoted 28 lines
---
 drivers/gpu/drm/drm_pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_pci.c +2 -3
index 754bc96..11c8add 100644
@@ -504,9 +504,9 @@ int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask)
                if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_8_0GB)
                        *mask |= DRM_PCIE_SPEED_80;
        } else {
-               if (lnkcap & 1)
+               if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB)
                        *mask |= DRM_PCIE_SPEED_25;
-               if (lnkcap & 2)
+               if (lnkcap & PCI_EXP_LNKCAP_SLS_5_0GB)
                        *mask |= DRM_PCIE_SPEED_50;
        }
 
--

1.7.2.5

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer Reviewed-by
#2 lore raw
Quoted 9 lines · Alex Deucher
Quoted 6 lines · Jingoo Han

Use PCI_EXP_LNKCAP_SLS_2_5GB and PCI_EXP_LNKCAP_SLS_5_0GB instead of hardcoded values for readability. These bit definitions were added by commit 130f1b8 ("PCI: Add PCIe Link Capability link speed and width names")

I posted the same patch last month, along with two other patches that fix the reporting for pre-r3.0 devices and simplify the code a bit:

    http://marc.info/?l=linux-pci&m=135732663513525&w=2
    http://marc.info/?l=linux-pci&m=135732713413779&w=2
    http://marc.info/?l=linux-pci&m=135732666213542&w=2

I don't know the status of any of these; I'm expecting Dave to do whatever he thinks is best.

Quoted 33 lines
Quoted 25 lines
---
 drivers/gpu/drm/drm_pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_pci.c +2 -3
index 754bc96..11c8add 100644
@@ -504,9 +504,9 @@ int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask)
                if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_8_0GB)
                        *mask |= DRM_PCIE_SPEED_80;
        } else {
-               if (lnkcap & 1)
+               if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB)
                        *mask |= DRM_PCIE_SPEED_25;
-               if (lnkcap & 2)
+               if (lnkcap & PCI_EXP_LNKCAP_SLS_5_0GB)
                        *mask |= DRM_PCIE_SPEED_50;
        }
 
--

1.7.2.5

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#3 lore raw

On Thursday, February 07, 2013 2:08 AM, Bjorn Helgaas wrote

Quoted 12 lines · Alex Deucher
Quoted 9 lines · Jingoo Han
Quoted 6 lines

Use PCI_EXP_LNKCAP_SLS_2_5GB and PCI_EXP_LNKCAP_SLS_5_0GB instead of hardcoded values for readability. These bit definitions were added by commit 130f1b8 ("PCI: Add PCIe Link Capability link speed and width names")

Quoted 8 lines

I posted the same patch last month, along with two other patches that fix the reporting for pre-r3.0 devices and simplify the code a bit:

    http://marc.info/?l=linux-pci&m=135732663513525&w=2
    http://marc.info/?l=linux-pci&m=135732713413779&w=2
    http://marc.info/?l=linux-pci&m=135732666213542&w=2

Oh, I missed your patch.
I think that my patch will be abandoned.

Best regards,
Jingoo Han

Quoted 27 lines

I don't know the status of any of these; I'm expecting Dave to do whatever he thinks is best.

Quoted 23 lines
Quoted 23 lines
---
 drivers/gpu/drm/drm_pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_pci.c +2 -3
index 754bc96..11c8add 100644
@@ -504,9 +504,9 @@ int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask)
                if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_8_0GB)
                        *mask |= DRM_PCIE_SPEED_80;
        } else {
-               if (lnkcap & 1)
+               if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB)
                        *mask |= DRM_PCIE_SPEED_25;
-               if (lnkcap & 2)
+               if (lnkcap & PCI_EXP_LNKCAP_SLS_5_0GB)
                        *mask |= DRM_PCIE_SPEED_50;
        }
 
--

1.7.2.5