[COMMON] power: qos: added the function for reading request value
authorJongyun Jung <j_y.jung@samsung.com>
Tue, 23 Feb 2016 07:00:04 +0000 (16:00 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:09:02 +0000 (17:09 +0900)
Added the function for reading the value not adjusted, but requested.

Change-Id: Ief4fefe5a867ab1643e75bd4ae927966f24bc588
Signed-off-by: Jongyun Jung <j_y.jung@samsung.com>
include/linux/pm_qos.h
kernel/power/qos.c

index 531f0a95d4330343b2fddef1fb8acbce927cbae9..289e716690587ae317f9152a53cb6f68af155752 100644 (file)
@@ -164,6 +164,7 @@ void pm_qos_update_request_timeout(struct pm_qos_request *req,
                                   s32 new_value, unsigned long timeout_us);
 void pm_qos_remove_request(struct pm_qos_request *req);
 
+int pm_qos_read_req_value(int pm_qos_class, struct pm_qos_request *req);
 int pm_qos_request(int pm_qos_class);
 int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);
 int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
index 0906e70abb69c70e150f15911aafee3727109e6b..0863d732ba182f4f450d1c8a4fc8676f9aa380d4 100644 (file)
@@ -519,6 +519,33 @@ bool pm_qos_update_flags(struct pm_qos_flags *pqf,
        return prev_value != curr_value;
 }
 
+/**
+ * pm_qos_read_req_value - returns requested qos value
+ * @pm_qos_class: identification of which qos value is requested
+ * @req: request wanted to find set value
+ *
+ * This function returns the requested qos value by sysfs node.
+ */
+int pm_qos_read_req_value(int pm_qos_class, struct pm_qos_request *req)
+{
+       struct plist_node *p;
+       unsigned long flags;
+
+       spin_lock_irqsave(&pm_qos_lock, flags);
+
+       plist_for_each(p, &pm_qos_array[pm_qos_class]->constraints->list) {
+               if (req == container_of(p, struct pm_qos_request, node)) {
+                       spin_unlock_irqrestore(&pm_qos_lock, flags);
+                       return p->prio;
+               }
+       }
+
+       spin_unlock_irqrestore(&pm_qos_lock, flags);
+
+       return -ENODATA;
+}
+EXPORT_SYMBOL_GPL(pm_qos_read_req_value);
+
 /**
  * pm_qos_request - returns current system wide qos expectation
  * @pm_qos_class: identification of which qos value is requested