PM: runtime: return at once for active device in rpm_resume
Subsystems (4)
PATCH 1/1 PM: runtime: return at once for active device in rpm_resume
From: Ming Lei <[email protected]>
This patch moves ahead check for active rpm state of device, so that rpm_resume can return immediately for device with active rpm state.
Considered rpm_resume is run in atomic context and is often in hot path(such as in usbnet, called before transmitting every network frame), this patch should make sense.
--- drivers/base/power/runtime.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/base/power/runtime.c +5 -5
@@ -455,6 +455,11 @@ static int rpm_resume(struct device *dev, int rpmflags)dev_dbg (dev,"%s flags 0x%x\n" , __func__, rpmflags); repeat: +if (dev->power.runtime_status ==RPM_ACTIVE ) { + retval =1 ; + goto out; + } +if (dev->power.runtime_error) retval = -EINVAL ;else if (dev->power.disable_depth >0 )
@@ -472,11 +477,6 @@ static int rpm_resume(struct device *dev, int rpmflags)if (!dev->power.timer_autosuspends)pm_runtime_deactivate_timer (dev); -if (dev->power.runtime_status ==RPM_ACTIVE ) { - retval =1 ; - goto out; - } -if (dev->power.runtime_status ==RPM_RESUMING || dev->power.runtime_status ==RPM_SUSPENDING ) {DEFINE_WAIT (wait);
Signature · 1 line
1.7.4.1
Quoted 9 lines · On Tuesday, June 14, 2011, [email protected] wrote:
From: Ming Lei <[email protected]>
This patch moves ahead check for active rpm state of device, so that
rpm_resumecan return immediately for device with active rpm state.Considered
rpm_resumeis run in atomic context and is often in hotpath(such as in usbnet, called before transmitting every network frame), this patch should make sense.
It ignores the fact that rpm_resume() cancels pending runtime PM requests in addition to resuming suspended devices.
Thanks,
Rafael
Quoted 34 lines
Signed-off-by Ming Lei <[email protected]>--- drivers/base/power/runtime.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)drivers/base/power/runtime.c +5
-5@@ -455,6 +455,11 @@ static int rpm_resume(struct device *dev, int rpmflags)dev_dbg (dev,"%s flags 0x%x\n" , __func__, rpmflags); repeat: +if (dev->power.runtime_status ==RPM_ACTIVE ) { + retval =1 ; + goto out; + } +if (dev->power.runtime_error) retval = -EINVAL ;else if (dev->power.disable_depth >0 )@@ -472,11 +477,6 @@ static int rpm_resume(struct device *dev, int rpmflags)if (!dev->power.timer_autosuspends)pm_runtime_deactivate_timer (dev); -if (dev->power.runtime_status ==RPM_ACTIVE ) { - retval =1 ; - goto out; - } -if (dev->power.runtime_status ==RPM_RESUMING || dev->power.runtime_status ==RPM_SUSPENDING ) {DEFINE_WAIT (wait);