Commit dc844b0d authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

mei: remove flash_work_queue

Cancel each work properly and remove flash_work_queue.

Quoting documentation:

In most situations flushing the entire workqueue is overkill; you merely
need to know that a particular work item isn't queued and isn't running.
In such cases you should use cancel_delayed_work_sync() or
cancel_work_sync() instead.
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6ce4eac1
...@@ -131,6 +131,15 @@ int mei_start(struct mei_device *dev) ...@@ -131,6 +131,15 @@ int mei_start(struct mei_device *dev)
} }
EXPORT_SYMBOL_GPL(mei_start); EXPORT_SYMBOL_GPL(mei_start);
void mei_cancel_work(struct mei_device *dev)
{
cancel_work_sync(&dev->init_work);
cancel_delayed_work(&dev->timer_work);
}
EXPORT_SYMBOL_GPL(mei_cancel_work);
/** /**
* mei_reset - resets host and fw. * mei_reset - resets host and fw.
* *
...@@ -215,16 +224,14 @@ void mei_stop(struct mei_device *dev) ...@@ -215,16 +224,14 @@ void mei_stop(struct mei_device *dev)
{ {
dev_dbg(&dev->pdev->dev, "stopping the device.\n"); dev_dbg(&dev->pdev->dev, "stopping the device.\n");
flush_scheduled_work(); mei_cancel_work(dev);
mutex_lock(&dev->device_lock); mei_nfc_host_exit(dev);
cancel_delayed_work(&dev->timer_work); mutex_lock(&dev->device_lock);
mei_wd_stop(dev); mei_wd_stop(dev);
mei_nfc_host_exit();
dev->dev_state = MEI_DEV_POWER_DOWN; dev->dev_state = MEI_DEV_POWER_DOWN;
mei_reset(dev, 0); mei_reset(dev, 0);
......
...@@ -463,6 +463,7 @@ void mei_device_init(struct mei_device *dev); ...@@ -463,6 +463,7 @@ void mei_device_init(struct mei_device *dev);
void mei_reset(struct mei_device *dev, int interrupts); void mei_reset(struct mei_device *dev, int interrupts);
int mei_start(struct mei_device *dev); int mei_start(struct mei_device *dev);
void mei_stop(struct mei_device *dev); void mei_stop(struct mei_device *dev);
void mei_cancel_work(struct mei_device *dev);
/* /*
* MEI interrupt functions prototype * MEI interrupt functions prototype
...@@ -510,7 +511,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots); ...@@ -510,7 +511,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots);
* NFC functions * NFC functions
*/ */
int mei_nfc_host_init(struct mei_device *dev); int mei_nfc_host_init(struct mei_device *dev);
void mei_nfc_host_exit(void); void mei_nfc_host_exit(struct mei_device *dev);
/* /*
* NFC Client UUID * NFC Client UUID
......
...@@ -547,12 +547,16 @@ int mei_nfc_host_init(struct mei_device *dev) ...@@ -547,12 +547,16 @@ int mei_nfc_host_init(struct mei_device *dev)
return ret; return ret;
} }
void mei_nfc_host_exit(void) void mei_nfc_host_exit(struct mei_device *dev)
{ {
struct mei_nfc_dev *ndev = &nfc_dev; struct mei_nfc_dev *ndev = &nfc_dev;
cancel_work_sync(&ndev->init_work);
mutex_lock(&dev->device_lock);
if (ndev->cl && ndev->cl->device) if (ndev->cl && ndev->cl->device)
mei_cl_remove_device(ndev->cl->device); mei_cl_remove_device(ndev->cl->device);
mei_nfc_free(ndev); mei_nfc_free(ndev);
mutex_unlock(&dev->device_lock);
} }
...@@ -195,8 +195,8 @@ static int mei_me_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -195,8 +195,8 @@ static int mei_me_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0; return 0;
release_irq: release_irq:
mei_cancel_work(dev);
mei_disable_interrupts(dev); mei_disable_interrupts(dev);
flush_scheduled_work();
free_irq(pdev->irq, dev); free_irq(pdev->irq, dev);
disable_msi: disable_msi:
pci_disable_msi(pdev); pci_disable_msi(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment