39 #include <linux/slab.h>
40 #include <linux/device.h>
42 #include <linux/export.h>
74 spin_unlock_irqrestore(&dev->
power.lock, flags);
95 &req->
node, action, value);
101 (
unsigned long)curr_value,
115 static int dev_pm_qos_constraints_allocate(
struct device *
dev)
131 plist_head_init(&c->
list);
137 spin_lock_irq(&dev->
power.lock);
138 dev->
power.constraints =
c;
139 spin_unlock_irq(&dev->
power.lock);
174 dev_pm_qos_hide_latency_limit(dev);
179 c = dev->
power.constraints;
190 memset(req, 0,
sizeof(*req));
193 spin_lock_irq(&dev->
power.lock);
195 spin_unlock_irq(&dev->
power.lock);
230 if (
WARN(dev_pm_qos_request_active(req),
231 "%s() called for already added request\n", __func__))
238 if (!dev->
power.constraints) {
250 ret = dev_pm_qos_constraints_allocate(dev);
287 if (
WARN(!dev_pm_qos_request_active(req),
288 "%s() called for unknown object\n", __func__))
293 if (req->
dev->power.constraints) {
294 if (new_value != req->
node.prio)
326 if (
WARN(!dev_pm_qos_request_active(req),
327 "%s() called for unknown object\n", __func__))
332 if (req->
dev->power.constraints) {
335 memset(req, 0,
sizeof(*req));
365 if (!dev->
power.constraints)
367 dev_pm_qos_constraints_allocate(dev) : -
ENODEV;
371 dev->
power.constraints->notifiers, notifier);
396 if (dev->
power.constraints)
398 dev->
power.constraints->notifiers,
448 while (ancestor && !ancestor->
power.ignore_children)
449 ancestor = ancestor->
parent;
461 #ifdef CONFIG_PM_RUNTIME
462 static void __dev_pm_qos_drop_user_request(
struct device *dev)
473 int dev_pm_qos_expose_latency_limit(
struct device *dev,
s32 value)
478 if (!device_is_registered(dev) || value < 0)
481 if (dev->
power.pq_req)
495 __dev_pm_qos_drop_user_request(dev);
505 void dev_pm_qos_hide_latency_limit(
struct device *dev)
507 if (dev->
power.pq_req) {
509 __dev_pm_qos_drop_user_request(dev);