summaryrefslogtreecommitdiffstats
path: root/drivers/pci/ats.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2015-07-20 09:24:32 -0500
committerBjorn Helgaas <bhelgaas@google.com>2015-08-13 15:59:58 -0500
commita71f938f3a9a7bc879296cd34ecae9effe5edf3f (patch)
tree87649fae821222f40fc9a15231623fc3dcdc25a9 /drivers/pci/ats.c
parentff9bee895c4d11a519a6b2c49451376025a6af4e (diff)
downloadlinux-a71f938f3a9a7bc879296cd34ecae9effe5edf3f.tar.bz2
PCI: Stop caching ATS Invalidate Queue Depth
Stop caching the Invalidate Queue Depth in struct pci_dev. pci_ats_queue_depth() is typically called only once per device, and it returns a fixed value per-device, so callers who need the value frequently can cache it themselves. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/pci/ats.c')
-rw-r--r--drivers/pci/ats.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
index 9355f754c7c2..ceda7dc556d4 100644
--- a/drivers/pci/ats.c
+++ b/drivers/pci/ats.c
@@ -20,16 +20,12 @@
void pci_ats_init(struct pci_dev *dev)
{
int pos;
- u16 cap;
pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS);
if (!pos)
return;
dev->ats_cap = pos;
- pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CAP, &cap);
- dev->ats_qdep = PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) :
- PCI_ATS_MAX_QDEP;
}
/**
@@ -131,13 +127,16 @@ EXPORT_SYMBOL_GPL(pci_restore_ats_state);
*/
int pci_ats_queue_depth(struct pci_dev *dev)
{
+ u16 cap;
+
if (!dev->ats_cap)
return -EINVAL;
if (dev->is_virtfn)
return 0;
- return dev->ats_qdep;
+ pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CAP, &cap);
+ return PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) : PCI_ATS_MAX_QDEP;
}
EXPORT_SYMBOL_GPL(pci_ats_queue_depth);