Skip to content

Commit 9cb1c98

Browse files
committed
PM: sleep: Relocate two device PM core functions
Move is_async() and dpm_async_fn() in the PM core to a more suitable place. No functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
1 parent 86686b8 commit 9cb1c98

1 file changed

Lines changed: 29 additions & 29 deletions

File tree

drivers/base/power/main.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,35 @@ bool dev_pm_skip_resume(struct device *dev)
578578
return !dev->power.must_resume;
579579
}
580580

581+
static bool is_async(struct device *dev)
582+
{
583+
return dev->power.async_suspend && pm_async_enabled
584+
&& !pm_trace_is_enabled();
585+
}
586+
587+
static bool dpm_async_fn(struct device *dev, async_func_t func)
588+
{
589+
reinit_completion(&dev->power.completion);
590+
591+
if (is_async(dev)) {
592+
dev->power.async_in_progress = true;
593+
594+
get_device(dev);
595+
596+
if (async_schedule_dev_nocall(func, dev))
597+
return true;
598+
599+
put_device(dev);
600+
}
601+
/*
602+
* Because async_schedule_dev_nocall() above has returned false or it
603+
* has not been called at all, func() is not running and it is safe to
604+
* update the async_in_progress flag without extra synchronization.
605+
*/
606+
dev->power.async_in_progress = false;
607+
return false;
608+
}
609+
581610
/**
582611
* device_resume_noirq - Execute a "noirq resume" callback for given device.
583612
* @dev: Device to handle.
@@ -664,35 +693,6 @@ static void device_resume_noirq(struct device *dev, pm_message_t state, bool asy
664693
}
665694
}
666695

667-
static bool is_async(struct device *dev)
668-
{
669-
return dev->power.async_suspend && pm_async_enabled
670-
&& !pm_trace_is_enabled();
671-
}
672-
673-
static bool dpm_async_fn(struct device *dev, async_func_t func)
674-
{
675-
reinit_completion(&dev->power.completion);
676-
677-
if (is_async(dev)) {
678-
dev->power.async_in_progress = true;
679-
680-
get_device(dev);
681-
682-
if (async_schedule_dev_nocall(func, dev))
683-
return true;
684-
685-
put_device(dev);
686-
}
687-
/*
688-
* Because async_schedule_dev_nocall() above has returned false or it
689-
* has not been called at all, func() is not running and it is safe to
690-
* update the async_in_progress flag without extra synchronization.
691-
*/
692-
dev->power.async_in_progress = false;
693-
return false;
694-
}
695-
696696
static void async_resume_noirq(void *data, async_cookie_t cookie)
697697
{
698698
struct device *dev = data;

0 commit comments

Comments
 (0)