diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2017-03-20 15:04:02 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-08 17:38:25 +0200 |
commit | 5c4c0106e944930315ad3ea8d77043bed13222eb (patch) | |
tree | 05813a79cdf6ae436afc5365db447ce6c5500c84 /drivers/misc/mei/pci-txe.c | |
parent | f580ff0e404e5aad83f02093cd22f2475cad6e71 (diff) |
mei: add pci driver ops shutdown handler.
The shutdown handler quiesces the device, it performs link reset in
order to close all connections and notify the device that is not longer
managed by the driver.
This is essentially a stripped down version of the PCI remove() function
where only the necessary amount of work is done to stop any further
activity.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/pci-txe.c')
-rw-r--r-- | drivers/misc/mei/pci-txe.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/misc/mei/pci-txe.c b/drivers/misc/mei/pci-txe.c index fe088b40daf9..f811cd524468 100644 --- a/drivers/misc/mei/pci-txe.c +++ b/drivers/misc/mei/pci-txe.c @@ -161,6 +161,33 @@ end: } /** + * mei_txe_remove - Device Shutdown Routine + * + * @pdev: PCI device structure + * + * mei_txe_shutdown is called from the reboot notifier + * it's a simplified version of remove so we go down + * faster. + */ +static void mei_txe_shutdown(struct pci_dev *pdev) +{ + struct mei_device *dev; + + dev = pci_get_drvdata(pdev); + if (!dev) + return; + + dev_dbg(&pdev->dev, "shutdown\n"); + mei_stop(dev); + + if (!pci_dev_run_wake(pdev)) + mei_txe_unset_pm_domain(dev); + + mei_disable_interrupts(dev); + free_irq(pdev->irq, dev); +} + +/** * mei_txe_remove - Device Removal Routine * * @pdev: PCI device structure @@ -386,7 +413,7 @@ static struct pci_driver mei_txe_driver = { .id_table = mei_txe_pci_tbl, .probe = mei_txe_probe, .remove = mei_txe_remove, - .shutdown = mei_txe_remove, + .shutdown = mei_txe_shutdown, .driver.pm = MEI_TXE_PM_OPS, }; |