aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLan Tianyu <tianyu.lan@intel.com>2012-11-07 22:14:08 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-10 16:56:19 -0500
commit7e4d68443a80574392d1027ff34992ab945934a6 (patch)
tree3b04de31cf03502a89968aa14db3439ec37f1757
parent436ede8942ab43474182c6454f420d71f7bb1163 (diff)
PM / QoS: Resume device before exposing/hiding PM QoS flags
Since dev_pm_qos_add_request(), dev_pm_qos_update_request() and dev_pm_qos_remove_request() for PM QoS flags should not be invoked when device in RPM_SUSPENDED, add pm_runtime_get_sync() and pm_runtime_put() around these functions in dev_pm_qos_expose_flags() and dev_pm_qos_hide_flags(). [rjw: Modified the subject and changelog to better reflect the code changes made.] Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/base/power/qos.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 081db2d25daa..fdc3894bc33a 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -633,15 +633,18 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val)
633 if (!req) 633 if (!req)
634 return -ENOMEM; 634 return -ENOMEM;
635 635
636 pm_runtime_get_sync(dev);
636 ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_FLAGS, val); 637 ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_FLAGS, val);
637 if (ret < 0) 638 if (ret < 0)
638 return ret; 639 goto fail;
639 640
640 dev->power.qos->flags_req = req; 641 dev->power.qos->flags_req = req;
641 ret = pm_qos_sysfs_add_flags(dev); 642 ret = pm_qos_sysfs_add_flags(dev);
642 if (ret) 643 if (ret)
643 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 644 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
644 645
646fail:
647 pm_runtime_put(dev);
645 return ret; 648 return ret;
646} 649}
647EXPORT_SYMBOL_GPL(dev_pm_qos_expose_flags); 650EXPORT_SYMBOL_GPL(dev_pm_qos_expose_flags);
@@ -654,7 +657,9 @@ void dev_pm_qos_hide_flags(struct device *dev)
654{ 657{
655 if (dev->power.qos && dev->power.qos->flags_req) { 658 if (dev->power.qos && dev->power.qos->flags_req) {
656 pm_qos_sysfs_remove_flags(dev); 659 pm_qos_sysfs_remove_flags(dev);
660 pm_runtime_get_sync(dev);
657 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 661 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
662 pm_runtime_put(dev);
658 } 663 }
659} 664}
660EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags); 665EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags);