Thread (11 messages) flat view 11 messages, 1 author, 2012-11-21
STALE5051d

Revision v10 of 6 in this series.

Revisions (6)
  1. v8 [diff vs current]
  2. v9 [diff vs current]
  3. v10 current
  4. v11 [diff vs current]
  5. v12 [diff vs current]
  6. v13 [diff vs current]

[PATCH v10 08/10] PM / BLOCK: add PM_QOS_FLAG_NO_POLL to skip events checking

From: Aaron Lu <hidden>
Date: 2012-11-21 11:50:44
Also in: linux-acpi
Subsystem: block layer, power management core, the rest · Maintainers: Jens Axboe, "Rafael J. Wysocki", Linus Torvalds

Some device may enter into a power state when events checking is no
longer necessary, this patch introduces the PM_QOS_FLAG_NO_POLL flag
and once set, events checking work function in block layer will skip
invoke the disk's check_events callback.

This will be used by ZPODD, when ODD is powered off, it doesn't make
sense to poll for media change events anymore.

Signed-off-by: Aaron Lu <redacted>
---
 block/genhd.c          | 8 +++++++-
 include/linux/pm_qos.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/block/genhd.c b/block/genhd.c
index 6cace66..b0092bb 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -18,6 +18,7 @@
 #include <linux/mutex.h>
 #include <linux/idr.h>
 #include <linux/log2.h>
+#include <linux/pm_qos.h>
 
 #include "blk.h"
 
@@ -1595,9 +1596,14 @@ static void disk_events_workfn(struct work_struct *work)
 	unsigned int events;
 	unsigned long intv;
 	int nr_events = 0, i;
+	enum pm_qos_flags_status stat;
 
 	/* check events */
-	events = disk->fops->check_events(disk, clearing);
+	stat = dev_pm_qos_flags(disk->driverfs_dev, PM_QOS_FLAG_NO_POLL);
+	if (stat == PM_QOS_FLAGS_ALL)
+		events = 0;
+	else
+		events = disk->fops->check_events(disk, clearing);
 
 	/* accumulate pending events and schedule next poll if necessary */
 	spin_lock_irq(&ev->lock);
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 5a95013..318a422 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -36,6 +36,7 @@ enum pm_qos_flags_status {
 
 #define PM_QOS_FLAG_NO_POWER_OFF	(1 << 0)
 #define PM_QOS_FLAG_REMOTE_WAKEUP	(1 << 1)
+#define PM_QOS_FLAG_NO_POLL		(1 << 3)
 
 struct pm_qos_request {
 	struct plist_node node;
-- 
1.7.12.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help