pci/hotplug/pnv-php: Disable MSI and PCI device properly
authorGavin Shan <gwshan@linux.vnet.ibm.com>
Wed, 15 Feb 2017 23:22:34 +0000 (10:22 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Mar 2017 05:41:47 +0000 (06:41 +0100)
commit1fb738a3dc1304250c755e5e31715137c1c44c50
tree60e87e08d11b7785a99933438f4c0aff40933d3e
parentbc5338a4fd3d9042107ce3fe40792c1c4839ebab
pci/hotplug/pnv-php: Disable MSI and PCI device properly

commit 49f4b08e61547a5ccd2db551d994c4503efe5666 upstream.

pnv_php_disable_irq() can be called in two paths: Bailing path in
pnv_php_enable_irq() or releasing slot. The MSI (or MSIx) interrupts
is disabled unconditionally in pnv_php_disable_irq(). It's wrong
because that might be enabled by drivers other than pnv-php.

This disables MSI (or MSIx) interrupts and the PCI device only if
it was enabled by pnv-php. In the error path of pnv_php_enable_irq(),
we rely on the newly added parameter @disable_device. In the path
of releasing slot, @pnv_php->irq is checked.

Fixes: 360aebd85a4c ("drivers/pci/hotplug: Support surprise hotplug in powernv driver")
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/hotplug/pnv_php.c