diff options
Diffstat (limited to 'drivers/misc/mei/pci-me.c')
-rw-r--r-- | drivers/misc/mei/pci-me.c | 52 |
1 files changed, 7 insertions, 45 deletions
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index b40ec0601ab0..b8b5c9c3ad03 100644 --- a/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c | |||
@@ -247,44 +247,14 @@ static void mei_remove(struct pci_dev *pdev) | |||
247 | 247 | ||
248 | hw = to_me_hw(dev); | 248 | hw = to_me_hw(dev); |
249 | 249 | ||
250 | mutex_lock(&dev->device_lock); | ||
251 | |||
252 | cancel_delayed_work(&dev->timer_work); | ||
253 | 250 | ||
254 | mei_wd_stop(dev); | 251 | dev_err(&pdev->dev, "stop\n"); |
252 | mei_stop(dev); | ||
255 | 253 | ||
256 | mei_pdev = NULL; | 254 | mei_pdev = NULL; |
257 | 255 | ||
258 | if (dev->iamthif_cl.state == MEI_FILE_CONNECTED) { | ||
259 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTING; | ||
260 | mei_cl_disconnect(&dev->iamthif_cl); | ||
261 | } | ||
262 | if (dev->wd_cl.state == MEI_FILE_CONNECTED) { | ||
263 | dev->wd_cl.state = MEI_FILE_DISCONNECTING; | ||
264 | mei_cl_disconnect(&dev->wd_cl); | ||
265 | } | ||
266 | |||
267 | /* Unregistering watchdog device */ | ||
268 | mei_watchdog_unregister(dev); | 256 | mei_watchdog_unregister(dev); |
269 | 257 | ||
270 | /* remove entry if already in list */ | ||
271 | dev_dbg(&pdev->dev, "list del iamthif and wd file list.\n"); | ||
272 | |||
273 | if (dev->open_handle_count > 0) | ||
274 | dev->open_handle_count--; | ||
275 | mei_cl_unlink(&dev->wd_cl); | ||
276 | |||
277 | if (dev->open_handle_count > 0) | ||
278 | dev->open_handle_count--; | ||
279 | mei_cl_unlink(&dev->iamthif_cl); | ||
280 | |||
281 | dev->iamthif_current_cb = NULL; | ||
282 | dev->me_clients_num = 0; | ||
283 | |||
284 | mutex_unlock(&dev->device_lock); | ||
285 | |||
286 | flush_scheduled_work(); | ||
287 | |||
288 | /* disable interrupts */ | 258 | /* disable interrupts */ |
289 | mei_disable_interrupts(dev); | 259 | mei_disable_interrupts(dev); |
290 | 260 | ||
@@ -308,28 +278,20 @@ static int mei_pci_suspend(struct device *device) | |||
308 | { | 278 | { |
309 | struct pci_dev *pdev = to_pci_dev(device); | 279 | struct pci_dev *pdev = to_pci_dev(device); |
310 | struct mei_device *dev = pci_get_drvdata(pdev); | 280 | struct mei_device *dev = pci_get_drvdata(pdev); |
311 | int err; | ||
312 | 281 | ||
313 | if (!dev) | 282 | if (!dev) |
314 | return -ENODEV; | 283 | return -ENODEV; |
315 | mutex_lock(&dev->device_lock); | ||
316 | 284 | ||
317 | cancel_delayed_work(&dev->timer_work); | 285 | dev_err(&pdev->dev, "suspend\n"); |
318 | 286 | ||
319 | /* Stop watchdog if exists */ | 287 | mei_stop(dev); |
320 | err = mei_wd_stop(dev); | 288 | |
321 | /* Set new mei state */ | 289 | mei_disable_interrupts(dev); |
322 | if (dev->dev_state == MEI_DEV_ENABLED || | ||
323 | dev->dev_state == MEI_DEV_RECOVERING_FROM_RESET) { | ||
324 | dev->dev_state = MEI_DEV_POWER_DOWN; | ||
325 | mei_reset(dev, 0); | ||
326 | } | ||
327 | mutex_unlock(&dev->device_lock); | ||
328 | 290 | ||
329 | free_irq(pdev->irq, dev); | 291 | free_irq(pdev->irq, dev); |
330 | pci_disable_msi(pdev); | 292 | pci_disable_msi(pdev); |
331 | 293 | ||
332 | return err; | 294 | return 0; |
333 | } | 295 | } |
334 | 296 | ||
335 | static int mei_pci_resume(struct device *device) | 297 | static int mei_pci_resume(struct device *device) |