void mei_stop(struct mei_device *dev)
{
	dev_dbg(&dev->pdev->dev, "stopping the device.\n");

	mei_cancel_work(dev);

	mei_nfc_host_exit(dev);

	mutex_lock(&dev->device_lock);

	mei_wd_stop(dev);

	dev->dev_state = MEI_DEV_POWER_DOWN;
	mei_reset(dev);

	mutex_unlock(&dev->device_lock);

	mei_watchdog_unregister(dev);
}
void mei_stop(struct mei_device *dev)
{
	dev_dbg(&dev->pdev->dev, "stopping the device.\n");

	mei_cancel_work(dev);

	mei_nfc_host_exit(dev);

	mutex_lock(&dev->device_lock);

	mei_wd_stop(dev);

	dev->dev_state = MEI_DEV_POWER_DOWN;
	mei_reset(dev);
	/* move device to disabled state unconditionally */
	dev->dev_state = MEI_DEV_DISABLED;

	mutex_unlock(&dev->device_lock);

	mei_watchdog_unregister(dev);
}
Beispiel #3
0
/**
 * mei_remove - Device Removal Routine
 *
 * @pdev: PCI device structure
 *
 * mei_remove is called by the PCI subsystem to alert the driver
 * that it should release a PCI device.
 */
static void mei_remove(struct pci_dev *pdev)
{
	struct mei_device *dev;
	struct mei_me_hw *hw;

	if (mei_pdev != pdev)
		return;

	dev = pci_get_drvdata(pdev);
	if (!dev)
		return;

	hw = to_me_hw(dev);


	dev_err(&pdev->dev, "stop\n");
	mei_stop(dev);

	mei_pdev = NULL;

	mei_watchdog_unregister(dev);

	/* disable interrupts */
	mei_disable_interrupts(dev);

	free_irq(pdev->irq, dev);
	pci_disable_msi(pdev);
	pci_set_drvdata(pdev, NULL);

	if (hw->mem_addr)
		pci_iounmap(pdev, hw->mem_addr);

	kfree(dev);

	pci_release_regions(pdev);
	pci_disable_device(pdev);

	mei_deregister();

}