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:44:14 +0000 (06:44 +0100)
commitbc4c9766324a7e9fda48de58691796430c8511bf
treef64dd040f2afe6da82d012040ed2f78d36e2e75c
parent91f5bce789d9083f1e24bc09b00c8c781c015835
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