On 2021/6/14 13:42, Christoph Hellwig wrote:
On Sun, Jun 13, 2021 at 05:29:10PM +0800, Dongdong Liu wrote:
It will make sense to store the pcie_devcap value in the pci_dev
structure instead of reading Device Capabilities Register multiple
times. The fisrt place to use pcie_devcap is in set_pcie_port_type(),
get the pcie_devcap value here, then use cached pcie_devcap in the
needed place.
Acked-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
Signed-off-by: Dongdong Liu <liudongdong3@xxxxxxxxxx>
---
drivers/media/pci/cobalt/cobalt-driver.c | 4 ++--
drivers/pci/pci.c | 5 +----
drivers/pci/pcie/aspm.c | 11 ++++-------
drivers/pci/probe.c | 11 +++--------
drivers/pci/quirks.c | 3 +--
include/linux/pci.h | 1 +
6 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c
index 839503e..04e735f 100644
--- a/drivers/media/pci/cobalt/cobalt-driver.c
+++ b/drivers/media/pci/cobalt/cobalt-driver.c
@@ -193,11 +193,11 @@ void cobalt_pcie_status_show(struct cobalt *cobalt)
return;
/* Device */
- pcie_capability_read_dword(pci_dev, PCI_EXP_DEVCAP, &capa);
pcie_capability_read_word(pci_dev, PCI_EXP_DEVCTL, &ctrl);
pcie_capability_read_word(pci_dev, PCI_EXP_DEVSTA, &stat);
cobalt_info("PCIe device capability 0x%08x: Max payload %d\n",
- capa, get_payload_size(capa & PCI_EXP_DEVCAP_PAYLOAD));
+ capa,
+ get_payload_size(pci_dev->pcie_devcap & PCI_EXP_DEVCAP_PAYLOAD));
Overly long line.
Will fix
+ if (!(child->pcie_devcap & PCI_EXP_DEVCAP_RBER) && !aspm_force) {
Another one.
Will fix.
Thanks,
Dongdong
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
.