Messages in this thread | | | From | "Rafael J. Wysocki" <> | Date | Fri, 5 Jun 2020 14:10:30 +0200 | Subject | Re: [PATCH] PM: runtime: add RPM_IDLE_SUSPEND / RPM_IDLE_NO_SUSPEND constants |
| |
On Sat, May 30, 2020 at 6:33 PM Heiner Kallweit <hkallweit1@gmail.com> wrote: > > runtime_idle() callback implementations have to return a non-zero value > if they don't intend to suspend now. Several drivers use an errno like > -EBUSY for this purpose. This can be problematic because the return > value is propagated up the call chain, from rpm_idle() to > __pm_runtime_idle(), and from there to callers like > pm_runtime_put_sync(). A driver author checking the return value of > e.g. pm_runtime_put_sync() may as usual check for retval < 0 and > bail out.
Which would be a bug anyway, because rpm_idle() may return -EAGAIN or -EINPROGRESS due to concurrency and -EBUSY should be treated similarly.
> Therefore a positive value should be returned.
While it is recommended to return a positive value then, returning -EBUSY or -EAGAIN should still work if the callers are careful enough (and they should be).
Thanks!
| |