diff options
Diffstat (limited to 'drivers/base/power/qos.c')
-rw-r--r-- | drivers/base/power/qos.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 71855570922d..fd849a2c4fa8 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c | |||
@@ -352,21 +352,26 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_remove_request); | |||
352 | * | 352 | * |
353 | * Will register the notifier into a notification chain that gets called | 353 | * Will register the notifier into a notification chain that gets called |
354 | * upon changes to the target value for the device. | 354 | * upon changes to the target value for the device. |
355 | * | ||
356 | * If the device's constraints object doesn't exist when this routine is called, | ||
357 | * it will be created (or error code will be returned if that fails). | ||
355 | */ | 358 | */ |
356 | int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier) | 359 | int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier) |
357 | { | 360 | { |
358 | int retval = 0; | 361 | int ret = 0; |
359 | 362 | ||
360 | mutex_lock(&dev_pm_qos_mtx); | 363 | mutex_lock(&dev_pm_qos_mtx); |
361 | 364 | ||
362 | /* Silently return if the constraints object is not present. */ | 365 | if (!dev->power.constraints) |
363 | if (dev->power.constraints) | 366 | ret = dev->power.power_state.event != PM_EVENT_INVALID ? |
364 | retval = blocking_notifier_chain_register( | 367 | dev_pm_qos_constraints_allocate(dev) : -ENODEV; |
365 | dev->power.constraints->notifiers, | 368 | |
366 | notifier); | 369 | if (!ret) |
370 | ret = blocking_notifier_chain_register( | ||
371 | dev->power.constraints->notifiers, notifier); | ||
367 | 372 | ||
368 | mutex_unlock(&dev_pm_qos_mtx); | 373 | mutex_unlock(&dev_pm_qos_mtx); |
369 | return retval; | 374 | return ret; |
370 | } | 375 | } |
371 | EXPORT_SYMBOL_GPL(dev_pm_qos_add_notifier); | 376 | EXPORT_SYMBOL_GPL(dev_pm_qos_add_notifier); |
372 | 377 | ||