Skip to content

Commit

Permalink
PCI: Use pci_physfn() rather than looking up physfn by hand
Browse files Browse the repository at this point in the history
Use the pci_physfn() helper rather than looking up physfn by hand.
No functional change.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Bjorn Helgaas committed Aug 13, 2015
1 parent afdd596 commit c39127d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/pci/ats.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void pci_ats_init(struct pci_dev *dev)
int pci_enable_ats(struct pci_dev *dev, int ps)
{
u16 ctrl;
struct pci_dev *pdev;

BUG_ON(dev->ats_cap && dev->ats_enabled);

Expand All @@ -57,8 +58,7 @@ int pci_enable_ats(struct pci_dev *dev, int ps)
*/
ctrl = PCI_ATS_CTRL_ENABLE;
if (dev->is_virtfn) {
struct pci_dev *pdev = dev->physfn;

pdev = pci_physfn(dev);
if (pdev->ats_stu != ps)
return -EINVAL;

Expand All @@ -80,6 +80,7 @@ EXPORT_SYMBOL_GPL(pci_enable_ats);
*/
void pci_disable_ats(struct pci_dev *dev)
{
struct pci_dev *pdev;
u16 ctrl;

BUG_ON(!dev->ats_cap || !dev->ats_enabled);
Expand All @@ -88,8 +89,7 @@ void pci_disable_ats(struct pci_dev *dev)
return; /* VFs still enabled */

if (dev->is_virtfn) {
struct pci_dev *pdev = dev->physfn;

pdev = pci_physfn(dev);
atomic_dec(&pdev->ats_ref_cnt);
}

Expand Down

0 comments on commit c39127d

Please sign in to comment.