PCI: Fix devfn for VPD access through function 0
authorAlex Williamson <alex.williamson@redhat.com>
Tue, 15 Sep 2015 17:17:21 +0000 (11:17 -0600)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 27 Nov 2015 12:48:19 +0000 (12:48 +0000)
commit991e923fb23b1fff62283078fd4734f42e1bf398
tree9f92b9ca63962338cbea3450ba41f8694aae6e23
parentef0d3d064edcce08a3d3609ecf7129e17ee130e7
PCI: Fix devfn for VPD access through function 0

commit 9d9240756e63dd87d6cbf5da8b98ceb8f8192b55 upstream.

Commit 932c435caba8 ("PCI: Add dev_flags bit to access VPD through function
0") passes PCI_SLOT(devfn) for the devfn parameter of pci_get_slot().
Generally this works because we're fairly well guaranteed that a PCIe
device is at slot address 0, but for the general case, including
conventional PCI, it's incorrect.  We need to get the slot and then convert
it back into a devfn.

Fixes: 932c435caba8 ("PCI: Add dev_flags bit to access VPD through function 0")
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <helgaas@kernel.org>
Acked-by: Myron Stowe <myron.stowe@redhat.com>
Acked-by: Mark Rustad <mark.d.rustad@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/pci/access.c