]> git.hungrycats.org Git - linux/commit
PCI: hv: Fix wslot_to_devfn() to fix warnings on device removal
authorDexuan Cui <decui@microsoft.com>
Fri, 10 Feb 2017 21:18:46 +0000 (15:18 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Mar 2017 05:44:14 +0000 (06:44 +0100)
commit91f5bce789d9083f1e24bc09b00c8c781c015835
tree894522f67e89260e9a6a58b46966ba7511018217
parent1306371f6cacc7a0928e2088320acd47a83e05e4
PCI: hv: Fix wslot_to_devfn() to fix warnings on device removal

commit 60e2e2fbafdd1285ae1b4ad39ded41603e0c74d0 upstream.

The devfn of 00:02.0 is 0x10.  devfn_to_wslot(0x10) == 0x2, and
wslot_to_devfn(0x2) should be 0x10, while it's 0x2 in the current code.

Due to this, hv_eject_device_work() -> pci_get_domain_bus_and_slot()
returns NULL and pci_stop_and_remove_bus_device() is not called.

Later when the real device driver's .remove() is invoked by
hv_pci_remove() -> pci_stop_root_bus(), some warnings can be noticed
because the VM has lost the access to the underlying device at that
time.

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
CC: K. Y. Srinivasan <kys@microsoft.com>
CC: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/host/pci-hyperv.c