Commit c39127db authored by Bjorn Helgaas's avatar Bjorn Helgaas

PCI: Use pci_physfn() rather than looking up physfn by hand

Use the pci_physfn() helper rather than looking up physfn by hand.
No functional change.
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarJoerg Roedel <jroedel@suse.de>
parent afdd596c
...@@ -42,6 +42,7 @@ void pci_ats_init(struct pci_dev *dev) ...@@ -42,6 +42,7 @@ void pci_ats_init(struct pci_dev *dev)
int pci_enable_ats(struct pci_dev *dev, int ps) int pci_enable_ats(struct pci_dev *dev, int ps)
{ {
u16 ctrl; u16 ctrl;
struct pci_dev *pdev;
BUG_ON(dev->ats_cap && dev->ats_enabled); BUG_ON(dev->ats_cap && dev->ats_enabled);
...@@ -57,8 +58,7 @@ int pci_enable_ats(struct pci_dev *dev, int ps) ...@@ -57,8 +58,7 @@ int pci_enable_ats(struct pci_dev *dev, int ps)
*/ */
ctrl = PCI_ATS_CTRL_ENABLE; ctrl = PCI_ATS_CTRL_ENABLE;
if (dev->is_virtfn) { if (dev->is_virtfn) {
struct pci_dev *pdev = dev->physfn; pdev = pci_physfn(dev);
if (pdev->ats_stu != ps) if (pdev->ats_stu != ps)
return -EINVAL; return -EINVAL;
...@@ -80,6 +80,7 @@ EXPORT_SYMBOL_GPL(pci_enable_ats); ...@@ -80,6 +80,7 @@ EXPORT_SYMBOL_GPL(pci_enable_ats);
*/ */
void pci_disable_ats(struct pci_dev *dev) void pci_disable_ats(struct pci_dev *dev)
{ {
struct pci_dev *pdev;
u16 ctrl; u16 ctrl;
BUG_ON(!dev->ats_cap || !dev->ats_enabled); BUG_ON(!dev->ats_cap || !dev->ats_enabled);
...@@ -88,8 +89,7 @@ void pci_disable_ats(struct pci_dev *dev) ...@@ -88,8 +89,7 @@ void pci_disable_ats(struct pci_dev *dev)
return; /* VFs still enabled */ return; /* VFs still enabled */
if (dev->is_virtfn) { if (dev->is_virtfn) {
struct pci_dev *pdev = dev->physfn; pdev = pci_physfn(dev);
atomic_dec(&pdev->ats_ref_cnt); atomic_dec(&pdev->ats_ref_cnt);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment