diff options
| author | Tomas Winkler <tomas.winkler@intel.com> | 2015-02-10 03:39:47 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-01 22:37:00 -0500 |
| commit | b3de8e3719e582f3182bb504295e4a8e43c8c96f (patch) | |
| tree | d8f70d9cedaadb0e2a9e917b9af8f471d39fef69 /drivers/misc | |
| parent | a9bed61053af13c0768f82c9d1c8793515dd067c (diff) | |
mei: bus: call device disable handler prior to disconnection
call device's disable handler prior to disconnection
so it can possibly close the communication with fw client
in graceful way
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
| -rw-r--r-- | drivers/misc/mei/bus.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index 17ca7e20fb6a..45896f95fed1 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c | |||
| @@ -467,37 +467,34 @@ int mei_cl_disable_device(struct mei_cl_device *device) | |||
| 467 | 467 | ||
| 468 | dev = cl->dev; | 468 | dev = cl->dev; |
| 469 | 469 | ||
| 470 | if (device->ops && device->ops->disable) | ||
| 471 | device->ops->disable(device); | ||
| 472 | |||
| 473 | device->event_cb = NULL; | ||
| 474 | |||
| 470 | mutex_lock(&dev->device_lock); | 475 | mutex_lock(&dev->device_lock); |
| 471 | 476 | ||
| 472 | if (cl->state != MEI_FILE_CONNECTED) { | 477 | if (cl->state != MEI_FILE_CONNECTED) { |
| 473 | mutex_unlock(&dev->device_lock); | ||
| 474 | dev_err(dev->dev, "Already disconnected"); | 478 | dev_err(dev->dev, "Already disconnected"); |
| 475 | 479 | err = 0; | |
| 476 | return 0; | 480 | goto out; |
| 477 | } | 481 | } |
| 478 | 482 | ||
| 479 | cl->state = MEI_FILE_DISCONNECTING; | 483 | cl->state = MEI_FILE_DISCONNECTING; |
| 480 | 484 | ||
| 481 | err = mei_cl_disconnect(cl); | 485 | err = mei_cl_disconnect(cl); |
| 482 | if (err < 0) { | 486 | if (err < 0) { |
| 483 | mutex_unlock(&dev->device_lock); | 487 | dev_err(dev->dev, "Could not disconnect from the ME client"); |
| 484 | dev_err(dev->dev, | 488 | goto out; |
| 485 | "Could not disconnect from the ME client"); | ||
| 486 | |||
| 487 | return err; | ||
| 488 | } | 489 | } |
| 489 | 490 | ||
| 490 | /* Flush queues and remove any pending read */ | 491 | /* Flush queues and remove any pending read */ |
| 491 | mei_cl_flush_queues(cl, NULL); | 492 | mei_cl_flush_queues(cl, NULL); |
| 492 | 493 | ||
| 493 | device->event_cb = NULL; | 494 | out: |
| 494 | |||
| 495 | mutex_unlock(&dev->device_lock); | 495 | mutex_unlock(&dev->device_lock); |
| 496 | return err; | ||
| 496 | 497 | ||
| 497 | if (!device->ops || !device->ops->disable) | ||
| 498 | return 0; | ||
| 499 | |||
| 500 | return device->ops->disable(device); | ||
| 501 | } | 498 | } |
| 502 | EXPORT_SYMBOL_GPL(mei_cl_disable_device); | 499 | EXPORT_SYMBOL_GPL(mei_cl_disable_device); |
| 503 | 500 | ||
