aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2014-03-18 16:52:01 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-03 19:20:24 -0400
commita532bbedc85ff3b834ba81e49163a3f543be1775 (patch)
tree44dd2f1934aa24dda9a42e303497c35f943efc48 /drivers/misc
parentba9cdd0e1ad88004c68395697fb2ec6b9b4ff020 (diff)
mei: add function to check write queues
The driver needs to check whether the write queue idle before entering power gating Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/mei/init.c21
-rw-r--r--drivers/misc/mei/mei_dev.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index 4b1eb37344cb..abc5ea053bf7 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -303,7 +303,28 @@ void mei_stop(struct mei_device *dev)
303} 303}
304EXPORT_SYMBOL_GPL(mei_stop); 304EXPORT_SYMBOL_GPL(mei_stop);
305 305
306/**
307 * mei_write_is_idle - check if the write queues are idle
308 *
309 * @dev: the device structure
310 *
311 * returns true of there is no pending write
312 */
313bool mei_write_is_idle(struct mei_device *dev)
314{
315 bool idle = (dev->dev_state == MEI_DEV_ENABLED &&
316 list_empty(&dev->ctrl_wr_list.list) &&
317 list_empty(&dev->write_list.list));
306 318
319 dev_dbg(&dev->pdev->dev, "write pg: is idle[%d] state=%s ctrl=%d write=%d\n",
320 idle,
321 mei_dev_state_str(dev->dev_state),
322 list_empty(&dev->ctrl_wr_list.list),
323 list_empty(&dev->write_list.list));
324
325 return idle;
326}
327EXPORT_SYMBOL_GPL(mei_write_is_idle);
307 328
308void mei_device_init(struct mei_device *dev) 329void mei_device_init(struct mei_device *dev)
309{ 330{
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index bec6adef68bd..fe76e5b4cd2a 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -680,6 +680,8 @@ static inline int mei_count_full_read_slots(struct mei_device *dev)
680 680
681bool mei_hbuf_acquire(struct mei_device *dev); 681bool mei_hbuf_acquire(struct mei_device *dev);
682 682
683bool mei_write_is_idle(struct mei_device *dev);
684
683#if IS_ENABLED(CONFIG_DEBUG_FS) 685#if IS_ENABLED(CONFIG_DEBUG_FS)
684int mei_dbgfs_register(struct mei_device *dev, const char *name); 686int mei_dbgfs_register(struct mei_device *dev, const char *name);
685void mei_dbgfs_deregister(struct mei_device *dev); 687void mei_dbgfs_deregister(struct mei_device *dev);