@@ -411,8 +411,9 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
411
411
pm_request_idle(dev) and return its result
412
412
413
413
`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
416
417
417
418
`int __pm_runtime_put_autosuspend(struct device *dev); `
418
419
- 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
870
871
the appropriate PM routines); rather it means that runtime suspends will
871
872
automatically be delayed until the desired period of inactivity has elapsed.
872
873
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
878
877
registration the length should be controlled by user space, using the
879
878
/sys/devices/.../power/autosuspend_delay_ms attribute.
880
879
@@ -885,7 +884,7 @@ instead of the non-autosuspend counterparts::
885
884
886
885
Instead of: pm_runtime_suspend use: pm_runtime_autosuspend;
887
886
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 ;
889
888
Instead of: pm_runtime_put_sync use: pm_runtime_put_sync_autosuspend.
890
889
891
890
Drivers may also continue to use the non-autosuspend helper functions; they
@@ -922,12 +921,10 @@ Here is a schematic pseudo-code example::
922
921
foo_io_completion(struct foo_priv *foo, void *req)
923
922
{
924
923
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
929
927
foo_process_next_request(foo);
930
- }
931
928
unlock(&foo->private_lock);
932
929
/* Send req result back to the user ... */
933
930
}
0 commit comments