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)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 17 Feb 2017 11:13:29 +0000 (22:13 +1100)
commit49f4b08e61547a5ccd2db551d994c4503efe5666
treeaccdce0ba7fd9e780e8fe50d0549a1911ef517a3
parent303529d6ef1293513c2c73c9ab86489eebb37d08
pci/hotplug/pnv-php: Disable MSI and PCI device properly

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.

Cc: <stable@vger.kernel.org> # v4.9+
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>
drivers/pci/hotplug/pnv_php.c