@@ -411,8 +411,9 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
411411 pm_request_idle(dev) and return its result
412412
413413 `int pm_runtime_put_autosuspend(struct device *dev); `
414- - does the same as __pm_runtime_put_autosuspend() for now, but in the
415- future, will also call pm_runtime_mark_last_busy() as well, DO NOT USE!
414+ - set the power.last_busy field to the current time and decrement the
415+ device's usage counter; if the result is 0 then run
416+ pm_request_autosuspend(dev) and return its result
416417
417418 `int __pm_runtime_put_autosuspend(struct device *dev); `
418419 - decrement the device's usage counter; if the result is 0 then run
@@ -870,11 +871,9 @@ device is automatically suspended (the subsystem or driver still has to call
870871the appropriate PM routines); rather it means that runtime suspends will
871872automatically be delayed until the desired period of inactivity has elapsed.
872873
873- Inactivity is determined based on the power.last_busy field. Drivers should
874- call pm_runtime_mark_last_busy() to update this field after carrying out I/O,
875- typically just before calling __pm_runtime_put_autosuspend(). The desired
876- length of the inactivity period is a matter of policy. Subsystems can set this
877- length initially by calling pm_runtime_set_autosuspend_delay(), but after device
874+ Inactivity is determined based on the power.last_busy field. The desired length
875+ of the inactivity period is a matter of policy. Subsystems can set this length
876+ initially by calling pm_runtime_set_autosuspend_delay(), but after device
878877registration the length should be controlled by user space, using the
879878/sys/devices/.../power/autosuspend_delay_ms attribute.
880879
@@ -885,7 +884,7 @@ instead of the non-autosuspend counterparts::
885884
886885 Instead of: pm_runtime_suspend use: pm_runtime_autosuspend;
887886 Instead of: pm_schedule_suspend use: pm_request_autosuspend;
888- Instead of: pm_runtime_put use: __pm_runtime_put_autosuspend ;
887+ Instead of: pm_runtime_put use: pm_runtime_put_autosuspend ;
889888 Instead of: pm_runtime_put_sync use: pm_runtime_put_sync_autosuspend.
890889
891890Drivers may also continue to use the non-autosuspend helper functions; they
@@ -922,12 +921,10 @@ Here is a schematic pseudo-code example::
922921 foo_io_completion(struct foo_priv *foo, void *req)
923922 {
924923 lock(&foo->private_lock);
925- if (--foo->num_pending_requests == 0) {
926- pm_runtime_mark_last_busy(&foo->dev);
927- __pm_runtime_put_autosuspend(&foo->dev);
928- } else {
924+ if (--foo->num_pending_requests == 0)
925+ pm_runtime_put_autosuspend(&foo->dev);
926+ else
929927 foo_process_next_request(foo);
930- }
931928 unlock(&foo->private_lock);
932929 /* Send req result back to the user ... */
933930 }
0 commit comments